Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include
File: libaio.h
/* /usr/include/libaio.h
[0] Fix | Delete
*
[1] Fix | Delete
* Copyright 2000,2001,2002 Red Hat, Inc.
[2] Fix | Delete
*
[3] Fix | Delete
* Written by Benjamin LaHaise <bcrl@redhat.com>
[4] Fix | Delete
*
[5] Fix | Delete
* libaio Linux async I/O interface
[6] Fix | Delete
*
[7] Fix | Delete
* This library is free software; you can redistribute it and/or
[8] Fix | Delete
* modify it under the terms of the GNU Lesser General Public
[9] Fix | Delete
* License as published by the Free Software Foundation; either
[10] Fix | Delete
* version 2 of the License, or (at your option) any later version.
[11] Fix | Delete
*
[12] Fix | Delete
* This library is distributed in the hope that it will be useful,
[13] Fix | Delete
* but WITHOUT ANY WARRANTY; without even the implied warranty of
[14] Fix | Delete
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[15] Fix | Delete
* Lesser General Public License for more details.
[16] Fix | Delete
*
[17] Fix | Delete
* You should have received a copy of the GNU Lesser General Public
[18] Fix | Delete
* License along with this library; if not, write to the Free Software
[19] Fix | Delete
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
[20] Fix | Delete
*/
[21] Fix | Delete
#ifndef __LIBAIO_H
[22] Fix | Delete
#define __LIBAIO_H
[23] Fix | Delete
[24] Fix | Delete
#ifdef __cplusplus
[25] Fix | Delete
extern "C" {
[26] Fix | Delete
#endif
[27] Fix | Delete
[28] Fix | Delete
#include <sys/types.h>
[29] Fix | Delete
#include <string.h>
[30] Fix | Delete
#include <signal.h>
[31] Fix | Delete
[32] Fix | Delete
struct timespec;
[33] Fix | Delete
struct sockaddr;
[34] Fix | Delete
struct iovec;
[35] Fix | Delete
[36] Fix | Delete
typedef struct io_context *io_context_t;
[37] Fix | Delete
[38] Fix | Delete
typedef enum io_iocb_cmd {
[39] Fix | Delete
IO_CMD_PREAD = 0,
[40] Fix | Delete
IO_CMD_PWRITE = 1,
[41] Fix | Delete
[42] Fix | Delete
IO_CMD_FSYNC = 2,
[43] Fix | Delete
IO_CMD_FDSYNC = 3,
[44] Fix | Delete
[45] Fix | Delete
IO_CMD_POLL = 5,
[46] Fix | Delete
IO_CMD_NOOP = 6,
[47] Fix | Delete
IO_CMD_PREADV = 7,
[48] Fix | Delete
IO_CMD_PWRITEV = 8,
[49] Fix | Delete
} io_iocb_cmd_t;
[50] Fix | Delete
[51] Fix | Delete
/* little endian, 32 bits */
[52] Fix | Delete
#if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \
[53] Fix | Delete
defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \
[54] Fix | Delete
defined(__cris__) || (defined(__riscv) && __riscv_xlen == 32) || \
[55] Fix | Delete
(defined(__GNUC__) && defined(__BYTE_ORDER__) && \
[56] Fix | Delete
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 4)
[57] Fix | Delete
#define PADDED(x, y) x; unsigned y
[58] Fix | Delete
#define PADDEDptr(x, y) x; unsigned y
[59] Fix | Delete
#define PADDEDul(x, y) unsigned long x; unsigned y
[60] Fix | Delete
[61] Fix | Delete
/* little endian, 64 bits */
[62] Fix | Delete
#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || \
[63] Fix | Delete
(defined(__aarch64__) && defined(__AARCH64EL__)) || \
[64] Fix | Delete
(defined(__riscv) && __riscv_xlen == 64) || \
[65] Fix | Delete
(defined(__GNUC__) && defined(__BYTE_ORDER__) && \
[66] Fix | Delete
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 8)
[67] Fix | Delete
#define PADDED(x, y) x, y
[68] Fix | Delete
#define PADDEDptr(x, y) x
[69] Fix | Delete
#define PADDEDul(x, y) unsigned long x
[70] Fix | Delete
[71] Fix | Delete
/* big endian, 64 bits */
[72] Fix | Delete
#elif defined(__powerpc64__) || defined(__s390x__) || \
[73] Fix | Delete
(defined(__sparc__) && defined(__arch64__)) || \
[74] Fix | Delete
(defined(__aarch64__) && defined(__AARCH64EB__)) || \
[75] Fix | Delete
(defined(__GNUC__) && defined(__BYTE_ORDER__) && \
[76] Fix | Delete
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 8)
[77] Fix | Delete
#define PADDED(x, y) unsigned y; x
[78] Fix | Delete
#define PADDEDptr(x,y) x
[79] Fix | Delete
#define PADDEDul(x, y) unsigned long x
[80] Fix | Delete
[81] Fix | Delete
/* big endian, 32 bits */
[82] Fix | Delete
#elif defined(__PPC__) || defined(__s390__) || \
[83] Fix | Delete
(defined(__arm__) && defined(__ARMEB__)) || \
[84] Fix | Delete
defined(__sparc__) || defined(__MIPSEB__) || defined(__m68k__) || \
[85] Fix | Delete
defined(__hppa__) || defined(__frv__) || defined(__avr32__) || \
[86] Fix | Delete
(defined(__GNUC__) && defined(__BYTE_ORDER__) && \
[87] Fix | Delete
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 4)
[88] Fix | Delete
#define PADDED(x, y) unsigned y; x
[89] Fix | Delete
#define PADDEDptr(x, y) unsigned y; x
[90] Fix | Delete
#define PADDEDul(x, y) unsigned y; unsigned long x
[91] Fix | Delete
[92] Fix | Delete
#else
[93] Fix | Delete
#error endian?
[94] Fix | Delete
#endif
[95] Fix | Delete
[96] Fix | Delete
struct io_iocb_poll {
[97] Fix | Delete
PADDED(int events, __pad1);
[98] Fix | Delete
}; /* result code is the set of result flags or -'ve errno */
[99] Fix | Delete
[100] Fix | Delete
struct io_iocb_sockaddr {
[101] Fix | Delete
struct sockaddr *addr;
[102] Fix | Delete
int len;
[103] Fix | Delete
}; /* result code is the length of the sockaddr, or -'ve errno */
[104] Fix | Delete
[105] Fix | Delete
struct io_iocb_common {
[106] Fix | Delete
PADDEDptr(void *buf, __pad1);
[107] Fix | Delete
PADDEDul(nbytes, __pad2);
[108] Fix | Delete
long long offset;
[109] Fix | Delete
long long __pad3;
[110] Fix | Delete
unsigned flags;
[111] Fix | Delete
unsigned resfd;
[112] Fix | Delete
}; /* result code is the amount read or -'ve errno */
[113] Fix | Delete
[114] Fix | Delete
struct io_iocb_vector {
[115] Fix | Delete
const struct iovec *vec;
[116] Fix | Delete
int nr;
[117] Fix | Delete
long long offset;
[118] Fix | Delete
}; /* result code is the amount read or -'ve errno */
[119] Fix | Delete
[120] Fix | Delete
struct iocb {
[121] Fix | Delete
PADDEDptr(void *data, __pad1); /* Return in the io completion event */
[122] Fix | Delete
/* key: For use in identifying io requests */
[123] Fix | Delete
/* aio_rw_flags: RWF_* flags (such as RWF_NOWAIT) */
[124] Fix | Delete
PADDED(unsigned key, aio_rw_flags);
[125] Fix | Delete
[126] Fix | Delete
short aio_lio_opcode;
[127] Fix | Delete
short aio_reqprio;
[128] Fix | Delete
int aio_fildes;
[129] Fix | Delete
[130] Fix | Delete
union {
[131] Fix | Delete
struct io_iocb_common c;
[132] Fix | Delete
struct io_iocb_vector v;
[133] Fix | Delete
struct io_iocb_poll poll;
[134] Fix | Delete
struct io_iocb_sockaddr saddr;
[135] Fix | Delete
} u;
[136] Fix | Delete
};
[137] Fix | Delete
[138] Fix | Delete
struct io_event {
[139] Fix | Delete
PADDEDptr(void *data, __pad1);
[140] Fix | Delete
PADDEDptr(struct iocb *obj, __pad2);
[141] Fix | Delete
PADDEDul(res, __pad3);
[142] Fix | Delete
PADDEDul(res2, __pad4);
[143] Fix | Delete
};
[144] Fix | Delete
[145] Fix | Delete
#undef PADDED
[146] Fix | Delete
#undef PADDEDptr
[147] Fix | Delete
#undef PADDEDul
[148] Fix | Delete
[149] Fix | Delete
typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2);
[150] Fix | Delete
[151] Fix | Delete
/* library wrappers */
[152] Fix | Delete
extern int io_queue_init(int maxevents, io_context_t *ctxp);
[153] Fix | Delete
/*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/
[154] Fix | Delete
extern int io_queue_release(io_context_t ctx);
[155] Fix | Delete
/*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/
[156] Fix | Delete
extern int io_queue_run(io_context_t ctx);
[157] Fix | Delete
[158] Fix | Delete
/* Actual syscalls */
[159] Fix | Delete
extern int io_setup(int maxevents, io_context_t *ctxp);
[160] Fix | Delete
extern int io_destroy(io_context_t ctx);
[161] Fix | Delete
extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]);
[162] Fix | Delete
extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt);
[163] Fix | Delete
extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout);
[164] Fix | Delete
extern int io_pgetevents(io_context_t ctx_id, long min_nr, long nr,
[165] Fix | Delete
struct io_event *events, struct timespec *timeout,
[166] Fix | Delete
sigset_t *sigmask);
[167] Fix | Delete
[168] Fix | Delete
[169] Fix | Delete
static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
[170] Fix | Delete
{
[171] Fix | Delete
iocb->data = (void *)cb;
[172] Fix | Delete
}
[173] Fix | Delete
[174] Fix | Delete
static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
[175] Fix | Delete
{
[176] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[177] Fix | Delete
iocb->aio_fildes = fd;
[178] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_PREAD;
[179] Fix | Delete
iocb->aio_reqprio = 0;
[180] Fix | Delete
iocb->u.c.buf = buf;
[181] Fix | Delete
iocb->u.c.nbytes = count;
[182] Fix | Delete
iocb->u.c.offset = offset;
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
[186] Fix | Delete
{
[187] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[188] Fix | Delete
iocb->aio_fildes = fd;
[189] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_PWRITE;
[190] Fix | Delete
iocb->aio_reqprio = 0;
[191] Fix | Delete
iocb->u.c.buf = buf;
[192] Fix | Delete
iocb->u.c.nbytes = count;
[193] Fix | Delete
iocb->u.c.offset = offset;
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
[197] Fix | Delete
{
[198] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[199] Fix | Delete
iocb->aio_fildes = fd;
[200] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_PREADV;
[201] Fix | Delete
iocb->aio_reqprio = 0;
[202] Fix | Delete
iocb->u.c.buf = (void *)iov;
[203] Fix | Delete
iocb->u.c.nbytes = iovcnt;
[204] Fix | Delete
iocb->u.c.offset = offset;
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
[208] Fix | Delete
{
[209] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[210] Fix | Delete
iocb->aio_fildes = fd;
[211] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_PWRITEV;
[212] Fix | Delete
iocb->aio_reqprio = 0;
[213] Fix | Delete
iocb->u.c.buf = (void *)iov;
[214] Fix | Delete
iocb->u.c.nbytes = iovcnt;
[215] Fix | Delete
iocb->u.c.offset = offset;
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
static inline void io_prep_preadv2(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset, int flags)
[219] Fix | Delete
{
[220] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[221] Fix | Delete
iocb->aio_fildes = fd;
[222] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_PREADV;
[223] Fix | Delete
iocb->aio_reqprio = 0;
[224] Fix | Delete
iocb->aio_rw_flags = flags;
[225] Fix | Delete
iocb->u.c.buf = (void *)iov;
[226] Fix | Delete
iocb->u.c.nbytes = iovcnt;
[227] Fix | Delete
iocb->u.c.offset = offset;
[228] Fix | Delete
}
[229] Fix | Delete
[230] Fix | Delete
static inline void io_prep_pwritev2(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset, int flags)
[231] Fix | Delete
{
[232] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[233] Fix | Delete
iocb->aio_fildes = fd;
[234] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_PWRITEV;
[235] Fix | Delete
iocb->aio_reqprio = 0;
[236] Fix | Delete
iocb->aio_rw_flags = flags;
[237] Fix | Delete
iocb->u.c.buf = (void *)iov;
[238] Fix | Delete
iocb->u.c.nbytes = iovcnt;
[239] Fix | Delete
iocb->u.c.offset = offset;
[240] Fix | Delete
}
[241] Fix | Delete
[242] Fix | Delete
static inline void io_prep_poll(struct iocb *iocb, int fd, int events)
[243] Fix | Delete
{
[244] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[245] Fix | Delete
iocb->aio_fildes = fd;
[246] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_POLL;
[247] Fix | Delete
iocb->aio_reqprio = 0;
[248] Fix | Delete
iocb->u.poll.events = events;
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events)
[252] Fix | Delete
{
[253] Fix | Delete
io_prep_poll(iocb, fd, events);
[254] Fix | Delete
io_set_callback(iocb, cb);
[255] Fix | Delete
return io_submit(ctx, 1, &iocb);
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
static inline void io_prep_fsync(struct iocb *iocb, int fd)
[259] Fix | Delete
{
[260] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[261] Fix | Delete
iocb->aio_fildes = fd;
[262] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_FSYNC;
[263] Fix | Delete
iocb->aio_reqprio = 0;
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
[267] Fix | Delete
{
[268] Fix | Delete
io_prep_fsync(iocb, fd);
[269] Fix | Delete
io_set_callback(iocb, cb);
[270] Fix | Delete
return io_submit(ctx, 1, &iocb);
[271] Fix | Delete
}
[272] Fix | Delete
[273] Fix | Delete
static inline void io_prep_fdsync(struct iocb *iocb, int fd)
[274] Fix | Delete
{
[275] Fix | Delete
memset(iocb, 0, sizeof(*iocb));
[276] Fix | Delete
iocb->aio_fildes = fd;
[277] Fix | Delete
iocb->aio_lio_opcode = IO_CMD_FDSYNC;
[278] Fix | Delete
iocb->aio_reqprio = 0;
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
[282] Fix | Delete
{
[283] Fix | Delete
io_prep_fdsync(iocb, fd);
[284] Fix | Delete
io_set_callback(iocb, cb);
[285] Fix | Delete
return io_submit(ctx, 1, &iocb);
[286] Fix | Delete
}
[287] Fix | Delete
[288] Fix | Delete
static inline void io_set_eventfd(struct iocb *iocb, int eventfd)
[289] Fix | Delete
{
[290] Fix | Delete
iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */;
[291] Fix | Delete
iocb->u.c.resfd = eventfd;
[292] Fix | Delete
}
[293] Fix | Delete
[294] Fix | Delete
#ifdef __cplusplus
[295] Fix | Delete
}
[296] Fix | Delete
#endif
[297] Fix | Delete
[298] Fix | Delete
#endif /* __LIBAIO_H */
[299] Fix | Delete
[300] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function