DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Asynchronous I/O

Using other system calls with asynchronous I/O

This section describes how an Asynchronous I/O application affects and is affected by the fork, exec, exit and close system calls.

fork and forkall

No Asynchronous I/O is inherited for fork and forkall. Asynchronous I/O operations that occur after the fork or forkall do not affect the copy of the aiocb control block in the child's address space and the child does not receive any notification from the completion of the parent's I/O. For example, if the parent process does a forkall while an I/O is in progress, the I/O completion will not be delivered to the child process.

exec and exit

Before calling exec and exit, you must attempt to cancel all outstanding Asynchronous I/O requests. The exit function will wait for all outstanding Asynchronous I/O operations to complete before returning. It will unlock the area of memory locked by the aio_memlock call.

The sbrk, brk and shmdt functions will return EBUSY if the areas of locked memory are within the area affected by the call.

The exec function will fail if there are any outstanding Asynchronous I/O operations, so you must ensure that no requests are outstanding before calling exec.

close

When using the AIO_RAW flag on raw slices of hard disks, close will block until all outstanding asynchronous I/O operations are completed. When the call returns, the application is free to reuse the control block and buffers.

If the AIO_RAW flag is not used, the close(fd) has to be trapped so that all outstanding requests to fd can be canceled. This is done by first calling aio_cancel until all have been canceled, and then _close to close the file.


Next topic: How to use asynchronous I/O with your application
Previous topic: aio_cancel

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005