mirror of
https://github.com/espressif/openthread.git
synced 2026-07-09 22:00:19 +00:00
posix/uart: Fixes for failure to terminate (#568)
These changes address various issues found in the POSIX platform UART
driver which lead to the process not terminating properly when the
parent dies or closes `stdin`/`stdout`. Some of the errors could even
lead to unexpected program termination.
Among the various errors corrected are:
* Using `assert()` to terminate under normal operating conditions.
* `posixUartProcess()` only checked `s_in_fd` for readability and
did not check `s_out_fd` for writability. It also caused data
corruption if `write()` ever returned less than all of the bytes
sent.
* `ISIG` was being set on the termios flags. This can cause problems
when the serial API is used for binary data (Like when used with
the NCP app). (This requires the CLI be explicitly able to be able
to handle CTRL-C when built for POSIX)
* Socket errors weren't being tracked on `select()`.
* The platform main loop would (possibly) terminate if `select()`
failed with `EINTR`, which makes it difficult to attach to the
process with a debugger.
This commit is contained in:
committed by
Jonathan Hui
parent
56f3239c44
commit
9b1de7bbb2
@@ -98,6 +98,13 @@ void Uart::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
|
||||
break;
|
||||
|
||||
#ifdef OPENTHREAD_EXAMPLES_POSIX
|
||||
|
||||
case 0x03: // ASCII for Ctrl-C
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case '\b':
|
||||
case 127:
|
||||
if (mRxLength > 0)
|
||||
|
||||
Reference in New Issue
Block a user