aio_cancel.c 483 B

12345678910111213141516
  1. #include <aio.h>
  2. #include <pthread.h>
  3. #include <errno.h>
  4. int aio_cancel(int fd, struct aiocb *cb)
  5. {
  6. if (!cb) {
  7. /* FIXME: for correctness, we should return AIO_ALLDONE
  8. * if there are no outstanding aio operations on this
  9. * file descriptor, but that would require making aio
  10. * much slower, and seems to have little advantage since
  11. * we don't support cancellation anyway. */
  12. return AIO_NOTCANCELED;
  13. }
  14. return cb->__err==EINPROGRESS ? AIO_NOTCANCELED : AIO_ALLDONE;
  15. }