Don't use nxsem_wait_uninterruptible in read()/write()
- Dominant language
- C
- Stars
- 4k
- Forks
- 1.7k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 237
Description
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.
Contributor guide
Assessment
This issue has not been assessed yet.