Red Hat Bugzilla – Bug 170257
aio operations are inherited partially after fork()
Last modified: 2007-11-30 17:11:14 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.7.8-2
Description of problem:
POSIX says that "No asynchronous input or asynchronous output operations shall be inherited by the child process.".
However if a request is posted in the one process, aio_cancel() returns AIO_CANCELED instead AIO_ALLDONE in child (but request, of course, is not cancelled).
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create pair of connected sockets.
2. Post 2 read requests on the one socket.
3. fork the child process.
4. Call aio_cancel() for the second request.
Actual Results: aio_cancel() returns AIO_CANCELED.
Expected Results: aio_cancel() should return AIO_ALLDONE.
You can't call aio_cancel in the child.
..."the child process may only execute async-signal-safe operations
until such time as one of the exec functions is called."
(aio_cancel is not async-signal-safe function)
Agree, aio_cancel() cannot be used.
However aio_error() is async-signal-safe, but is returns EINPROGRESS instead 0
in forked child...
And why should it aio_error return zero? The request in the new process is not
defined at all. If anything, it should return EINVAL and this isn't required.
Returning zero gives a completely invalid picture of the situation.