/usr/share/cagefs-skeleton/usr/include
/* /usr/include/libaio.h * * Copyright 2000,2001,2002 Red Hat, Inc. * * Written by Benjamin LaHaise <bcrl@redhat.com> * * libaio Linux async I/O interface * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LIBAIO_H #define __LIBAIO_H #ifdef __cplusplus extern "C" { #endif #include <sys/types.h> #include <string.h> struct timespec; struct sockaddr; struct iovec; typedef struct io_context *io_context_t; typedef enum io_iocb_cmd { IO_CMD_PREAD = 0, IO_CMD_PWRITE = 1, IO_CMD_FSYNC = 2, IO_CMD_FDSYNC = 3, IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */ IO_CMD_NOOP = 6, IO_CMD_PREADV = 7, IO_CMD_PWRITEV = 8, } io_iocb_cmd_t; /* little endian, 32 bits */ #if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \ defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \ defined(__cris__) || (defined(__riscv) && __riscv_xlen == 32) || \ (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 4) #define PADDED(x, y) x; unsigned y #define PADDEDptr(x, y) x; unsigned y #define PADDEDul(x, y) unsigned long x; unsigned y /* little endian, 64 bits */ #elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || \ (defined(__aarch64__) && defined(__AARCH64EL__)) || \ (defined(__riscv) && __riscv_xlen == 64) || \ (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 8) #define PADDED(x, y) x, y #define PADDEDptr(x, y) x #define PADDEDul(x, y) unsigned long x /* big endian, 64 bits */ #elif defined(__powerpc64__) || defined(__s390x__) || \ (defined(__sparc__) && defined(__arch64__)) || \ (defined(__aarch64__) && defined(__AARCH64EB__)) || \ (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 8) #define PADDED(x, y) unsigned y; x #define PADDEDptr(x,y) x #define PADDEDul(x, y) unsigned long x /* big endian, 32 bits */ #elif defined(__PPC__) || defined(__s390__) || \ (defined(__arm__) && defined(__ARMEB__)) || \ defined(__sparc__) || defined(__MIPSEB__) || defined(__m68k__) || \ defined(__hppa__) || defined(__frv__) || defined(__avr32__) || \ (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 4) #define PADDED(x, y) unsigned y; x #define PADDEDptr(x, y) unsigned y; x #define PADDEDul(x, y) unsigned y; unsigned long x #else #error endian? #endif struct io_iocb_poll { PADDED(int events, __pad1); }; /* result code is the set of result flags or -'ve errno */ struct io_iocb_sockaddr { struct sockaddr *addr; int len; }; /* result code is the length of the sockaddr, or -'ve errno */ struct io_iocb_common { PADDEDptr(void *buf, __pad1); PADDEDul(nbytes, __pad2); long long offset; long long __pad3; unsigned flags; unsigned resfd; }; /* result code is the amount read or -'ve errno */ struct io_iocb_vector { const struct iovec *vec; int nr; long long offset; }; /* result code is the amount read or -'ve errno */ struct iocb { PADDEDptr(void *data, __pad1); /* Return in the io completion event */ /* key: For use in identifying io requests */ /* aio_rw_flags: RWF_* flags (such as RWF_NOWAIT) */ PADDED(unsigned key, aio_rw_flags); short aio_lio_opcode; short aio_reqprio; int aio_fildes; union { struct io_iocb_common c; struct io_iocb_vector v; struct io_iocb_poll poll; struct io_iocb_sockaddr saddr; } u; }; struct io_event { PADDEDptr(void *data, __pad1); PADDEDptr(struct iocb *obj, __pad2); PADDEDul(res, __pad3); PADDEDul(res2, __pad4); }; #undef PADDED #undef PADDEDptr #undef PADDEDul typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2); /* library wrappers */ extern int io_queue_init(int maxevents, io_context_t *ctxp); /*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/ extern int io_queue_release(io_context_t ctx); /*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/ extern int io_queue_run(io_context_t ctx); /* Actual syscalls */ extern int io_setup(int maxevents, io_context_t *ctxp); extern int io_destroy(io_context_t ctx); extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]); extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt); extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout); static inline void io_set_callback(struct iocb *iocb, io_callback_t cb) { iocb->data = (void *)cb; } static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PREAD; iocb->aio_reqprio = 0; iocb->u.c.buf = buf; iocb->u.c.nbytes = count; iocb->u.c.offset = offset; } static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PWRITE; iocb->aio_reqprio = 0; iocb->u.c.buf = buf; iocb->u.c.nbytes = count; iocb->u.c.offset = offset; } static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PREADV; iocb->aio_reqprio = 0; iocb->u.c.buf = (void *)iov; iocb->u.c.nbytes = iovcnt; iocb->u.c.offset = offset; } static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PWRITEV; iocb->aio_reqprio = 0; iocb->u.c.buf = (void *)iov; iocb->u.c.nbytes = iovcnt; iocb->u.c.offset = offset; } static inline void io_prep_preadv2(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset, int flags) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PREADV; iocb->aio_reqprio = 0; iocb->aio_rw_flags = flags; iocb->u.c.buf = (void *)iov; iocb->u.c.nbytes = iovcnt; iocb->u.c.offset = offset; } static inline void io_prep_pwritev2(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset, int flags) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PWRITEV; iocb->aio_reqprio = 0; iocb->aio_rw_flags = flags; iocb->u.c.buf = (void *)iov; iocb->u.c.nbytes = iovcnt; iocb->u.c.offset = offset; } /* Jeff Moyer says this was implemented in Red Hat AS2.1 and RHEL3. * AFAICT, it was never in mainline, and should not be used. --RR */ static inline void io_prep_poll(struct iocb *iocb, int fd, int events) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_POLL; iocb->aio_reqprio = 0; iocb->u.poll.events = events; } static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events) { io_prep_poll(iocb, fd, events); io_set_callback(iocb, cb); return io_submit(ctx, 1, &iocb); } static inline void io_prep_fsync(struct iocb *iocb, int fd) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_FSYNC; iocb->aio_reqprio = 0; } static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) { io_prep_fsync(iocb, fd); io_set_callback(iocb, cb); return io_submit(ctx, 1, &iocb); } static inline void io_prep_fdsync(struct iocb *iocb, int fd) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_FDSYNC; iocb->aio_reqprio = 0; } static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) { io_prep_fdsync(iocb, fd); io_set_callback(iocb, cb); return io_submit(ctx, 1, &iocb); } static inline void io_set_eventfd(struct iocb *iocb, int eventfd) { iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */; iocb->u.c.resfd = eventfd; } #ifdef __cplusplus } #endif #endif /* __LIBAIO_H */
.
Edit
..
Edit
FlexLexer.h
Edit
GL
Edit
X11
Edit
a.out.h
Edit
absl
Edit
aio.h
Edit
aliases.h
Edit
alloca.h
Edit
ar.h
Edit
ares.h
Edit
ares_build.h
Edit
ares_dns.h
Edit
ares_nameser.h
Edit
ares_rules.h
Edit
ares_version.h
Edit
argp.h
Edit
argz.h
Edit
arpa
Edit
asm
Edit
asm-generic
Edit
assert.h
Edit
autosprintf.h
Edit
bind9
Edit
bits
Edit
blkid
Edit
brotli
Edit
bsock
Edit
byteswap.h
Edit
bzlib.h
Edit
c++
Edit
com_err.h
Edit
complex.h
Edit
cpio.h
Edit
cpuidle.h
Edit
crypt.h
Edit
ctype.h
Edit
curl
Edit
curses.h
Edit
cursesapp.h
Edit
cursesf.h
Edit
cursesm.h
Edit
cursesp.h
Edit
cursesw.h
Edit
cursslk.h
Edit
dbm.h
Edit
dirent.h
Edit
dlfcn.h
Edit
drm
Edit
e2p
Edit
elf.h
Edit
endian.h
Edit
entities.h
Edit
envz.h
Edit
err.h
Edit
errno.h
Edit
error.h
Edit
et
Edit
eti.h
Edit
etip.h
Edit
evdns.h
Edit
event.h
Edit
event2
Edit
evhttp.h
Edit
evrpc.h
Edit
evutil.h
Edit
execinfo.h
Edit
expat.h
Edit
expat_config.h
Edit
expat_external.h
Edit
ext2fs
Edit
fcntl.h
Edit
features-time64.h
Edit
features.h
Edit
fenv.h
Edit
ffi-x86_64.h
Edit
ffi.h
Edit
ffitarget-x86_64.h
Edit
ffitarget.h
Edit
finclude
Edit
fmtmsg.h
Edit
fnmatch.h
Edit
fontconfig
Edit
form.h
Edit
fpu_control.h
Edit
freetype2
Edit
fstab.h
Edit
fstrm
Edit
fstrm.h
Edit
fts.h
Edit
ftw.h
Edit
gconv.h
Edit
gd.h
Edit
gd_color_map.h
Edit
gd_errors.h
Edit
gd_io.h
Edit
gdbm
Edit
gdbm.h
Edit
gdcache.h
Edit
gdfontg.h
Edit
gdfontl.h
Edit
gdfontmb.h
Edit
gdfonts.h
Edit
gdfontt.h
Edit
gdfx.h
Edit
gdpp.h
Edit
getopt.h
Edit
gettext-po.h
Edit
gio-unix-2.0
Edit
glib-2.0
Edit
glob.h
Edit
gmock
Edit
gnu
Edit
gnu-versions.h
Edit
gnumake.h
Edit
google
Edit
gpg-error.h
Edit
gpgrt.h
Edit
graphite2
Edit
grp.h
Edit
grpc
Edit
grpc++
Edit
grpcpp
Edit
gshadow.h
Edit
gssapi
Edit
gssapi.h
Edit
gssrpc
Edit
gtest
Edit
harfbuzz
Edit
iconv.h
Edit
idn-free.h
Edit
idn-int.h
Edit
idna.h
Edit
ieee754.h
Edit
ifaddrs.h
Edit
inttypes.h
Edit
jconfig-64.h
Edit
jconfig.h
Edit
jerror.h
Edit
jmorecfg.h
Edit
jpegint.h
Edit
jpeglib.h
Edit
json-c
Edit
kadm5
Edit
kdb.h
Edit
keyutils.h
Edit
krad.h
Edit
krb5
Edit
krb5.h
Edit
langinfo.h
Edit
lastlog.h
Edit
libaio.h
Edit
libexslt
Edit
libgen.h
Edit
libintl.h
Edit
libltdl
Edit
libmount
Edit
libpng16
Edit
libxml2
Edit
libxslt
Edit
limits.h
Edit
link.h
Edit
linux
Edit
lmdb.h
Edit
locale.h
Edit
ltdl.h
Edit
lzma
Edit
lzma.h
Edit
malloc.h
Edit
math.h
Edit
maxminddb.h
Edit
maxminddb_config-64.h
Edit
maxminddb_config.h
Edit
mcheck.h
Edit
memory.h
Edit
menu.h
Edit
misc
Edit
mntent.h
Edit
monetary.h
Edit
mqueue.h
Edit
mtd
Edit
mysql
Edit
nc_tparm.h
Edit
ncurses
Edit
ncurses.h
Edit
ncurses_dll.h
Edit
ncursesw
Edit
ndbm.h
Edit
net
Edit
netash
Edit
netatalk
Edit
netax25
Edit
netdb.h
Edit
neteconet
Edit
netinet
Edit
netipx
Edit
netiucv
Edit
netpacket
Edit
netrom
Edit
netrose
Edit
nfs
Edit
nl_types.h
Edit
nss.h
Edit
obstack.h
Edit
openssl
Edit
panel.h
Edit
paths.h
Edit
pcp
Edit
pcre.h
Edit
pcre2.h
Edit
pcre2posix.h
Edit
pcre_scanner.h
Edit
pcre_stringpiece.h
Edit
pcrecpp.h
Edit
pcrecpparg.h
Edit
pcreposix.h
Edit
png.h
Edit
pngconf.h
Edit
pnglibconf.h
Edit
poll.h
Edit
powercap.h
Edit
pr29.h
Edit
printf.h
Edit
proc_service.h
Edit
profile.h
Edit
protobuf-c
Edit
protocols
Edit
pthread.h
Edit
pty.h
Edit
punycode.h
Edit
pwd.h
Edit
python3.9
Edit
rdma
Edit
re2
Edit
re_comp.h
Edit
regex.h
Edit
regexp.h
Edit
resolv.h
Edit
rpc
Edit
sched.h
Edit
scsi
Edit
search.h
Edit
security
Edit
selinux
Edit
semaphore.h
Edit
sepol
Edit
setjmp.h
Edit
sgtty.h
Edit
shadow.h
Edit
signal.h
Edit
sound
Edit
spawn.h
Edit
stab.h
Edit
stdc-predef.h
Edit
stdint.h
Edit
stdio.h
Edit
stdio_ext.h
Edit
stdlib.h
Edit
string.h
Edit
stringprep.h
Edit
strings.h
Edit
sys
Edit
syscall.h
Edit
sysexits.h
Edit
syslog.h
Edit
sysprof-4
Edit
tar.h
Edit
term.h
Edit
term_entry.h
Edit
termcap.h
Edit
termio.h
Edit
termios.h
Edit
tgmath.h
Edit
thread_db.h
Edit
threads.h
Edit
tic.h
Edit
tiff.h
Edit
tiffconf-64.h
Edit
tiffconf.h
Edit
tiffio.h
Edit
tiffio.hxx
Edit
tiffvers.h
Edit
time.h
Edit
tld.h
Edit
ttyent.h
Edit
uchar.h
Edit
ucontext.h
Edit
ulimit.h
Edit
unctrl.h
Edit
unicode
Edit
unistd.h
Edit
utime.h
Edit
utmp.h
Edit
utmpx.h
Edit
values.h
Edit
verto-module.h
Edit
verto.h
Edit
video
Edit
wait.h
Edit
wchar.h
Edit
wctype.h
Edit
webp
Edit
wordexp.h
Edit
xcb
Edit
xen
Edit
zconf.h
Edit
zlib.h
Edit