15#if defined(XTC_IO_BACKEND_EPOLL)
17#elif defined(XTC_IO_BACKEND_KQUEUE)
21#elif defined(XTC_IO_BACKEND_SOLARIS)
24struct __xtc_solaris_reg {
29#elif defined(XTC_IO_BACKEND_IOCP)
63struct __xtc_iocp_reg {
64 struct __xtc_iocp_overlapped *ovp;
85struct __xtc_iocp_aio {
90#elif defined(XTC_IO_BACKEND_AIX)
99#elif defined(XTC_IO_BACKEND_URING)
122struct __xtc_uring_fd {
133 struct __xtc_uring_fd *next;
134 struct __xtc_uring_fd *prev;
135 struct __xtc_uring_fd *pnext;
136 struct __xtc_uring_fd *lnext;
137 struct __xtc_uring_fd *lprev;
139#elif defined(XTC_IO_BACKEND_POLL)
142#elif defined(XTC_IO_BACKEND_SELECT)
143#include <sys/select.h>
145#elif defined(XTC_IO_BACKEND_SIM)
151# error "M2 build expects XTC_IO_BACKEND_{POLL,EPOLL,URING,KQUEUE,IOCP,SOLARIS,AIX,SELECT,SIM} to be defined"
158#if defined(XTC_IO_BACKEND_EPOLL)
160#elif defined(XTC_IO_BACKEND_KQUEUE)
165#elif defined(XTC_IO_BACKEND_SOLARIS)
167 struct __xtc_solaris_reg *reg_fds;
170#elif defined(XTC_IO_BACKEND_IOCP)
173 _Atomic
int wakeup_pending;
174 struct __xtc_iocp_reg **reg_iocp;
177 struct __xtc_iocp_reg **dead_iocp;
180 struct __xtc_iocp_aio *aio_pend;
197 _Atomic
int has_pending_del;
198 pthread_mutex_t del_lock;
200 _Atomic
int owner_set;
201#elif defined(XTC_IO_BACKEND_AIX)
206#elif defined(XTC_IO_BACKEND_URING)
207 struct io_uring ring;
208 struct __xtc_uring_fd **tab;
210 struct __xtc_uring_fd *zombies;
211 struct __xtc_uring_fd *pending;
213 struct __xtc_uring_fd *lingers;
214 struct __xtc_uring_fd **ltab;
217 unsigned long n_adopted;
218 unsigned long n_cancels;
236 _Atomic
int has_pending_del;
237 pthread_mutex_t del_lock;
258 _Atomic uint64_t owner_tok;
259 _Atomic
int owner_active;
261 _Atomic
int owner_set;
282 unsigned long n_enter_submit;
283 unsigned long n_enter_wait;
295 struct io_uring preempt_ring;
297 struct __kernel_timespec preempt_ts;
298#elif defined(XTC_IO_BACKEND_POLL)
319 _Atomic
int has_pending_del;
320 pthread_mutex_t del_lock;
322 _Atomic
int owner_set;
323#elif defined(XTC_IO_BACKEND_SELECT)
347 _Atomic
int has_pending_del;
348 pthread_mutex_t del_lock;
350 _Atomic
int owner_set;
351#elif defined(XTC_IO_BACKEND_SIM)
355 struct __xtc_sim_io *sim;
366int __xtc_io_defer_del_fd(xtc_io_t *io,
int fd);
373void __xtc_io_set_tail_loop_id(xtc_io_t *io,
int id);
380int __xtc_io_reg_stats(xtc_io_t *io,
int *live,
int *zombies,
int *pending);
389int __xtc_io_uring_info(xtc_io_t *io,
unsigned *flags,
unsigned *sq_consumed,
399void __xtc_io_owner_leave(xtc_io_t *io);
406int __xtc_io_uring_poll_stats(xtc_io_t *io,
unsigned long *cancels,
407 unsigned long *adopted);
416int __xtc_io_uring_enter_stats(xtc_io_t *io,
unsigned long *submits,
417 unsigned long *waits,
unsigned *queued);
425#define __XTC_AIO_SIZE_2_0 (offsetof(xtc_aio_t, res) + sizeof(int32_t))
426#define __XTC_AIO_OK(a) ((a) != NULL && (a)->size >= __XTC_AIO_SIZE_2_0)