diff options
author | Jerry Zhang <zhangjerry@google.com> | 2018-02-12 16:15:50 -0800 |
---|---|---|
committer | Jerry Zhang <zhangjerry@google.com> | 2018-03-02 16:28:15 -0800 |
commit | c3d4e7226a74c3c4092480606ef07e0d30a2d42d (patch) | |
tree | c8384c535758600369b6f545d6ae49567b8e955a /libasyncio/AsyncIO.cpp | |
parent | fd01164a8d3f350abf2ba26f6ff693d7ec4afa0e (diff) |
Make libasyncio headers usable from C
This allows us to enable LTP tests
for io_* syscalls.
Bug: 31152298
Test: LTP tests pass
Change-Id: Ic25189d8bf25cdacfa0f144ac57c7b2827adcd9f
Diffstat (limited to 'libasyncio/AsyncIO.cpp')
-rw-r--r-- | libasyncio/AsyncIO.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libasyncio/AsyncIO.cpp b/libasyncio/AsyncIO.cpp index 7430bc81e..6149f09d1 100644 --- a/libasyncio/AsyncIO.cpp +++ b/libasyncio/AsyncIO.cpp @@ -17,9 +17,10 @@ #include <asyncio/AsyncIO.h> #include <sys/syscall.h> #include <unistd.h> +#include <cstdint> +#include <cstring> int io_setup(unsigned nr, aio_context_t* ctxp) { - memset(ctxp, 0, sizeof(*ctxp)); return syscall(__NR_io_setup, nr, ctxp); } @@ -48,3 +49,11 @@ void io_prep(iocb* iocb, int fd, const void* buf, uint64_t count, int64_t offset iocb->aio_nbytes = count; iocb->aio_offset = offset; } + +void io_prep_pread(struct iocb* iocb, int fd, void* buf, size_t count, long long offset) { + io_prep(iocb, fd, buf, count, offset, true); +} + +void io_prep_pwrite(struct iocb* iocb, int fd, void* buf, size_t count, long long offset) { + io_prep(iocb, fd, buf, count, offset, false); +} |