diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-15 02:01:33 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-15 02:01:59 +0100 |
| commit | 3b3325f761b09ebbfef04c44eed546cc4fdeb329 (patch) | |
| tree | aa19ea259bcda2410c2b3dd4512f19fb85aeaf8f /lib/libc/aio/aio_return.c | |
| parent | 15d2df7811ef3cb79cc3e501d0d5f9b993d42bea (diff) | |
Added aio and eventfd support, along with sleep and yes utilities
Diffstat (limited to 'lib/libc/aio/aio_return.c')
| -rw-r--r-- | lib/libc/aio/aio_return.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/libc/aio/aio_return.c b/lib/libc/aio/aio_return.c new file mode 100644 index 00000000..45b0d795 --- /dev/null +++ b/lib/libc/aio/aio_return.c @@ -0,0 +1,26 @@ +#include <__aio.h> +#include <errno.h> +#include <stddef.h> +#include <stdlib.h> + +ssize_t aio_return(struct aiocb *aiocbp) +{ + ssize_t result; + struct aio_request *req; + + if (aiocbp == NULL) { + errno = EINVAL; + return -1; + } + + req = __aio_remove(aiocbp); + + if (req->status == AIO_REQUEST_STATUS_PENDING) { + free(req); + return -1; + } + + result = req->result; + free(req); + return result; +} |
