Bug 170257 - aio operations are inherited partially after fork()
Summary: aio operations are inherited partially after fork()
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 4
Hardware: i686
OS: Linux
medium
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-10-10 09:55 UTC by Elena Vengerova
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-02-22 19:09:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Elena Vengerova 2005-10-10 09:55:04 UTC
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):


How reproducible:
Always

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.

Additional info:

Comment 1 Jakub Jelinek 2005-10-10 10:20:41 UTC
You can't call aio_cancel in the child.
See
http://www.opengroup.org/onlinepubs/009695399/functions/fork.html
..."the child process may only execute async-signal-safe operations
until such time as one of the exec functions is called."
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
(aio_cancel is not async-signal-safe function)

Comment 2 Elena Vengerova 2005-10-10 11:39:38 UTC
Agree, aio_cancel() cannot be used.
However aio_error() is async-signal-safe, but is returns EINPROGRESS instead 0
in forked child...

Comment 3 Ulrich Drepper 2006-01-04 08:30:52 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.