about summary refs log tree commit diff
path: root/src/aio/aio_cancel.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-09-09 01:07:38 -0400
committerRich Felker <dalias@aerifal.cx>2011-09-09 01:07:38 -0400
commitb4de6f93aed733b8fc8d103e5ced69ebe7d659e6 (patch)
tree33664a468c80b6b37a079d7d9bdbadf5adf4f93c /src/aio/aio_cancel.c
parent96cea94ad258be262ecf15b33d13cf775e59720d (diff)
downloadmusl-b4de6f93aed733b8fc8d103e5ced69ebe7d659e6.tar.gz
musl-b4de6f93aed733b8fc8d103e5ced69ebe7d659e6.tar.xz
musl-b4de6f93aed733b8fc8d103e5ced69ebe7d659e6.zip
implement POSIX asynchronous io
some features are not yet supported, and only minimal testing has been
performed. should be considered experimental at this point.
Diffstat (limited to 'src/aio/aio_cancel.c')
-rw-r--r--src/aio/aio_cancel.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/aio/aio_cancel.c b/src/aio/aio_cancel.c
new file mode 100644
index 00000000..5a753b1f
--- /dev/null
+++ b/src/aio/aio_cancel.c
@@ -0,0 +1,16 @@
+#include <aio.h>
+#include <pthread.h>
+#include <errno.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;
+}