Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use nxsem_wait_uninterruptible in read()/write() #669

Open
patacongo opened this issue Mar 31, 2020 · 0 comments
Open

Don't use nxsem_wait_uninterruptible in read()/write() #669

patacongo opened this issue Mar 31, 2020 · 0 comments
Labels
Area: Standards NuttX application interfaces must compy to standards Type: Bug Something isn't working

Comments

@patacongo
Copy link
Contributor

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.

@patacongo patacongo changed the title Don't use nxsem_wait_interruptible in read()/write() Don't use nxsem_wait_uninterruptible in read()/write() Apr 4, 2020
@patacongo patacongo added Type: Bug Something isn't working Area: Standards NuttX application interfaces must compy to standards labels May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Standards NuttX application interfaces must compy to standards Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant