summaryrefslogtreecommitdiff
path: root/src/aio/aio_cancel.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-02-13 00:27:45 -0500
committerRich Felker <dalias@aerifal.cx>2015-02-13 01:10:11 -0500
commit4e8a3561652ebcda6a126b3162fc545573889dc4 (patch)
treeeb83d08f7b14a6c160118c053452e9cb7774833f /src/aio/aio_cancel.c
parent594ffed82f4e6ee7da85e9c5da35e32946ae32c9 (diff)
downloadmusl-4e8a3561652ebcda6a126b3162fc545573889dc4.tar.gz
overhaul aio implementation for correctness
previously, aio operations were not tracked by file descriptor; each operation was completely independent. this resulted in non-conforming behavior for non-seekable/append-mode writes (which are required to be ordered) and made it impossible to implement aio_cancel, which in turn made closing file descriptors with outstanding aio operations unsafe. the new implementation is significantly heavier (roughly twice the size, and seems to be slightly slower) and presently aims mainly at correctness, not performance. most of the public interfaces have been moved into a single file, aio.c, because there is little benefit to be had from splitting them. whenever any aio functions are used, aio_cancel and the internal queue lifetime management and fd-to-queue mapping code must be linked, and these functions make up the bulk of the code size. the close function's interaction with aio is implemented with weak alias magic, to avoid pulling in heavy aio cancellation code in programs that don't use aio, and the expensive cancellation path (which includes signal blocking) is optimized out when there are no active aio queues.
Diffstat (limited to 'src/aio/aio_cancel.c')
-rw-r--r--src/aio/aio_cancel.c19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/aio/aio_cancel.c b/src/aio/aio_cancel.c
deleted file mode 100644
index 16fc431f..00000000
--- a/src/aio/aio_cancel.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <aio.h>
-#include <pthread.h>
-#include <errno.h>
-#include "libc.h"
-
-int aio_cancel(int fd, struct aiocb *cb)
-{
- if (!cb) {
- /* FIXME: for correctness, we should return AIO_ALLDONE
- * if there are no outstanding aio operations on this
- * file descriptor, but that would require making aio
- * much slower, and seems to have little advantage since
- * we don't support cancellation anyway. */
- return AIO_NOTCANCELED;
- }
- return cb->__err==EINPROGRESS ? AIO_NOTCANCELED : AIO_ALLDONE;
-}
-
-LFS64(aio_cancel);