1 | /* |
1 | /* |
2 | * libev native API header |
2 | * libev native API header |
3 | * |
3 | * |
4 | * Copyright (c) 2007-2018 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007-2019 Marc Alexander Lehmann <libev@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
49 | # endif |
49 | # endif |
50 | #else |
50 | #else |
51 | # define EV_CPP(x) |
51 | # define EV_CPP(x) |
52 | # define EV_NOEXCEPT |
52 | # define EV_NOEXCEPT |
53 | #endif |
53 | #endif |
|
|
54 | #define EV_THROW EV_NOEXCEPT /* pre-4.25, do not use in new code */ |
54 | |
55 | |
55 | EV_CPP(extern "C" {) |
56 | EV_CPP(extern "C" {) |
56 | |
57 | |
57 | /*****************************************************************************/ |
58 | /*****************************************************************************/ |
58 | |
59 | |
… | |
… | |
148 | # define EV_SIGNAL_ENABLE 1 |
149 | # define EV_SIGNAL_ENABLE 1 |
149 | #endif |
150 | #endif |
150 | |
151 | |
151 | /*****************************************************************************/ |
152 | /*****************************************************************************/ |
152 | |
153 | |
153 | typedef double ev_tstamp; |
154 | #ifndef EV_TSTAMP_T |
|
|
155 | # define EV_TSTAMP_T double |
|
|
156 | #endif |
|
|
157 | typedef EV_TSTAMP_T ev_tstamp; |
154 | |
158 | |
155 | #include <string.h> /* for memmove */ |
159 | #include <string.h> /* for memmove */ |
156 | |
160 | |
157 | #ifndef EV_ATOMIC_T |
161 | #ifndef EV_ATOMIC_T |
158 | # include <signal.h> |
162 | # include <signal.h> |
… | |
… | |
209 | #endif |
213 | #endif |
210 | |
214 | |
211 | /*****************************************************************************/ |
215 | /*****************************************************************************/ |
212 | |
216 | |
213 | #define EV_VERSION_MAJOR 4 |
217 | #define EV_VERSION_MAJOR 4 |
214 | #define EV_VERSION_MINOR 24 |
218 | #define EV_VERSION_MINOR 31 |
215 | |
219 | |
216 | /* eventmask, revents, events... */ |
220 | /* eventmask, revents, events... */ |
217 | enum { |
221 | enum { |
218 | EV_UNDEF = (int)0xFFFFFFFF, /* guaranteed to be invalid */ |
222 | EV_UNDEF = (int)0xFFFFFFFF, /* guaranteed to be invalid */ |
219 | EV_NONE = 0x00, /* no events */ |
223 | EV_NONE = 0x00, /* no events */ |
… | |
… | |
498 | }; |
502 | }; |
499 | |
503 | |
500 | /* flag bits for ev_default_loop and ev_loop_new */ |
504 | /* flag bits for ev_default_loop and ev_loop_new */ |
501 | enum { |
505 | enum { |
502 | /* the default */ |
506 | /* the default */ |
503 | EVFLAG_AUTO = 0x00000000U, /* not quite a mask */ |
507 | EVFLAG_AUTO = 0x00000000U, /* not quite a mask */ |
504 | /* flag bits */ |
508 | /* flag bits */ |
505 | EVFLAG_NOENV = 0x01000000U, /* do NOT consult environment */ |
509 | EVFLAG_NOENV = 0x01000000U, /* do NOT consult environment */ |
506 | EVFLAG_FORKCHECK = 0x02000000U, /* check for a fork in each iteration */ |
510 | EVFLAG_FORKCHECK = 0x02000000U, /* check for a fork in each iteration */ |
507 | /* debugging/feature disable */ |
511 | /* debugging/feature disable */ |
508 | EVFLAG_NOINOTIFY = 0x00100000U, /* do not attempt to use inotify */ |
512 | EVFLAG_NOINOTIFY = 0x00100000U, /* do not attempt to use inotify */ |
509 | #if EV_COMPAT3 |
513 | #if EV_COMPAT3 |
510 | EVFLAG_NOSIGFD = 0, /* compatibility to pre-3.9 */ |
514 | EVFLAG_NOSIGFD = 0, /* compatibility to pre-3.9 */ |
511 | #endif |
515 | #endif |
512 | EVFLAG_SIGNALFD = 0x00200000U, /* attempt to use signalfd */ |
516 | EVFLAG_SIGNALFD = 0x00200000U, /* attempt to use signalfd */ |
513 | EVFLAG_NOSIGMASK = 0x00400000U /* avoid modifying the signal mask */ |
517 | EVFLAG_NOSIGMASK = 0x00400000U, /* avoid modifying the signal mask */ |
|
|
518 | EVFLAG_NOTIMERFD = 0x00800000U /* avoid creating a timerfd */ |
514 | }; |
519 | }; |
515 | |
520 | |
516 | /* method bits to be ored together */ |
521 | /* method bits to be ored together */ |
517 | enum { |
522 | enum { |
518 | EVBACKEND_SELECT = 0x00000001U, /* available just about anywhere */ |
523 | EVBACKEND_SELECT = 0x00000001U, /* available just about anywhere */ |
519 | EVBACKEND_POLL = 0x00000002U, /* !win, !aix, broken on osx */ |
524 | EVBACKEND_POLL = 0x00000002U, /* !win, !aix, broken on osx */ |
520 | EVBACKEND_EPOLL = 0x00000004U, /* linux */ |
525 | EVBACKEND_EPOLL = 0x00000004U, /* linux */ |
521 | EVBACKEND_KQUEUE = 0x00000008U, /* bsd, broken on osx */ |
526 | EVBACKEND_KQUEUE = 0x00000008U, /* bsd, broken on osx */ |
522 | EVBACKEND_DEVPOLL = 0x00000010U, /* solaris 8 */ /* NYI */ |
527 | EVBACKEND_DEVPOLL = 0x00000010U, /* solaris 8 */ /* NYI */ |
523 | EVBACKEND_PORT = 0x00000020U, /* solaris 10 */ |
528 | EVBACKEND_PORT = 0x00000020U, /* solaris 10 */ |
|
|
529 | EVBACKEND_LINUXAIO = 0x00000040U, /* linux AIO, 4.19+ */ |
|
|
530 | EVBACKEND_IOURING = 0x00000080U, /* linux io_uring, 5.1+ */ |
524 | EVBACKEND_ALL = 0x0000003FU, /* all known backends */ |
531 | EVBACKEND_ALL = 0x000000FFU, /* all known backends */ |
525 | EVBACKEND_MASK = 0x0000FFFFU /* all future backends */ |
532 | EVBACKEND_MASK = 0x0000FFFFU /* all future backends */ |
526 | }; |
533 | }; |
527 | |
534 | |
528 | #if EV_PROTOTYPES |
535 | #if EV_PROTOTYPES |
529 | EV_API_DECL int ev_version_major (void) EV_NOEXCEPT; |
536 | EV_API_DECL int ev_version_major (void) EV_NOEXCEPT; |
530 | EV_API_DECL int ev_version_minor (void) EV_NOEXCEPT; |
537 | EV_API_DECL int ev_version_minor (void) EV_NOEXCEPT; |