Don't use nxsem_wait_uninterruptible in read()/write() #669
Labels
Area: Standards
NuttX application interfaces must compy to standards
Type: Bug
Something isn't working
In many places, nxsem_wait_uninterruptible() is used directly in directly in the read() or write() methods of character drivers. POSIX, however, requires that these methods return EINTR if interrupted by a signal.
For read(), EINTR should be returned to indicate "The read operation was terminated due to the receipt of a signal, and no data was transferred." https://pubs.opengroup.org/onlinepubs/009695399/functions/read.html
For write(), EINTR means that "The write operation was terminated due to the receipt of a signal, and no data was transferred."
POSIX also requires that the open() and close() method return EINTR if any signal is received (although I think supporting this in close() would cause issues since people seldom check the return value from close).
More general, the read() and write() methods should return EINTR if a signal is received even if there is no underlying character driver. This means that the block read/write methods of block and MTD drivers also must return EINTR if interrupt.
The text was updated successfully, but these errors were encountered: