aio_cancel(3aio)


aio_cancel, aio_cancel64 -- asynchronous cancel

Synopsis

   

cc [options] -Kthread file

#include <aio.h>

struct aiocb *aio_cancel(int fildes, struct aiocb *aiocbp);

struct aiocb64 *aio_cancel64(int fildes, struct aiocb64 *aiocbp);

Description

aio_cancel allows you to cancel one or more outstanding asynchronous I/O requests. fildes and key are used to identify the asynchronous I/O requests that should be canceled.

The aio_cancel function attempts to cancel one or more asynchronous I/O requests currently outstanding against file descriptor fildes. The aiocbp argument points to the asynchronous I/O control block for a particular request to be canceled. If aiocbp is NULL, all outstanding cancelable asynchronous I/O requests agains fildes are canceled.

Normal notification occurs for asynchronous I/O operations that are successfully canceled. If there are requests which cannot be canceled, then the normal asynchronous completion process shall take place for those requests when they are completed.

For requested operations that are successfully canceled, the associated error status is set to ECANCELED and the return status is -1. For requested operations that are not successfully canceled, the aiocbp is not modified by aio_cancel.

If aiocbp is not NULL, and fildes does not have the same value as the file descriptor with which the asynchronous operation was initiated, unspecified results occur.

Return values

The aio_cancel and aio_cancel64 functions return the value AIO_CANCELED to the calling process if the requested operation(s) were canceled. The value AIO_NOTCANCELED is returned if at least one of the requested operation(s) cannot be canceled because it is in progress. In this case, the state of the other operations, if any, referenced in a call to aio_cancel or aio_cancel64 is not indicated by the return value of aio_cancel or aio_cancel64. The application may determine the state of affairs for these operations by using aio_error or aio_error64. The value AIO_ALLDONE is returned if all of the operations have already completed. Otherwise, the functions return -1, and set errno to indicate the error.

Errors

Under the following conditions, aio_cancel and aio_cancel64 fail and set errno to:

EBADF
fildes is not a valid file descriptor.

EINVAL
No asynchronous I/O has ever been requested for fildes.

ENOMEM
There were no internal kernal aio control blocks available to service the request (number of kernel aio control blocks is tunable via the NUMAIO kernel parameter; see ``Miscellaneous parameters'' in Monitoring and tuning the system).

ENOSYS
aio_cancel called on SVR4.2.

References

aiocb(5), aio_read(3aio), aio_suspend(3aio), aio_write(3aio) intro(2)

Notices

Considerations for large file support

aio_cancel64 supports large files, but is otherwise identical to aio_cancel. For details on programming for large file capable applications, see ``Large File Support'' on intro(2).
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004