You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ev_vars.h 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*
  2. * loop member variable declarations
  3. *
  4. * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2019 Marc Alexander Lehmann <libev@schmorp.de>
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without modifica-
  8. * tion, are permitted provided that the following conditions are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright notice,
  11. * this list of conditions and the following disclaimer.
  12. *
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the distribution.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  18. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
  19. * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  20. * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
  21. * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  23. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  24. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
  25. * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  26. * OF THE POSSIBILITY OF SUCH DAMAGE.
  27. *
  28. * Alternatively, the contents of this file may be used under the terms of
  29. * the GNU General Public License ("GPL") version 2 or any later version,
  30. * in which case the provisions of the GPL are applicable instead of
  31. * the above. If you wish to allow the use of your version of this file
  32. * only under the terms of the GPL and not to allow others to use your
  33. * version of this file under the BSD license, indicate your decision
  34. * by deleting the provisions above and replace them with the notice
  35. * and other provisions required by the GPL. If you do not delete the
  36. * provisions above, a recipient may use your version of this file under
  37. * either the BSD or the GPL.
  38. */
  39. #define VARx(type,name) VAR(name, type name)
  40. VARx(ev_tstamp, now_floor) /* last time we refreshed rt_time */
  41. VARx(ev_tstamp, mn_now) /* monotonic clock "now" */
  42. VARx(ev_tstamp, rtmn_diff) /* difference realtime - monotonic time */
  43. /* for reverse feeding of events */
  44. VARx(W *, rfeeds)
  45. VARx(int, rfeedmax)
  46. VARx(int, rfeedcnt)
  47. VAR (pendings, ANPENDING *pendings [NUMPRI])
  48. VAR (pendingmax, int pendingmax [NUMPRI])
  49. VAR (pendingcnt, int pendingcnt [NUMPRI])
  50. VARx(int, pendingpri) /* highest priority currently pending */
  51. VARx(ev_prepare, pending_w) /* dummy pending watcher */
  52. VARx(ev_tstamp, io_blocktime)
  53. VARx(ev_tstamp, timeout_blocktime)
  54. VARx(int, backend)
  55. VARx(int, activecnt) /* total number of active events ("refcount") */
  56. VARx(EV_ATOMIC_T, loop_done) /* signal by ev_break */
  57. VARx(int, backend_fd)
  58. VARx(ev_tstamp, backend_mintime) /* assumed typical timer resolution */
  59. VAR (backend_modify, void (*backend_modify)(EV_P_ int fd, int oev, int nev))
  60. VAR (backend_poll , void (*backend_poll)(EV_P_ ev_tstamp timeout))
  61. VARx(ANFD *, anfds)
  62. VARx(int, anfdmax)
  63. VAR (evpipe, int evpipe [2])
  64. VARx(ev_io, pipe_w)
  65. VARx(EV_ATOMIC_T, pipe_write_wanted)
  66. VARx(EV_ATOMIC_T, pipe_write_skipped)
  67. #if !defined(_WIN32) || EV_GENWRAP
  68. VARx(pid_t, curpid)
  69. #endif
  70. VARx(char, postfork) /* true if we need to recreate kernel state after fork */
  71. #if EV_USE_SELECT || EV_GENWRAP
  72. VARx(void *, vec_ri)
  73. VARx(void *, vec_ro)
  74. VARx(void *, vec_wi)
  75. VARx(void *, vec_wo)
  76. #if defined(_WIN32) || EV_GENWRAP
  77. VARx(void *, vec_eo)
  78. #endif
  79. VARx(int, vec_max)
  80. #endif
  81. #if EV_USE_POLL || EV_GENWRAP
  82. VARx(struct pollfd *, polls)
  83. VARx(int, pollmax)
  84. VARx(int, pollcnt)
  85. VARx(int *, pollidxs) /* maps fds into structure indices */
  86. VARx(int, pollidxmax)
  87. #endif
  88. #if EV_USE_EPOLL || EV_GENWRAP
  89. VARx(struct epoll_event *, epoll_events)
  90. VARx(int, epoll_eventmax)
  91. VARx(int *, epoll_eperms)
  92. VARx(int, epoll_epermcnt)
  93. VARx(int, epoll_epermmax)
  94. #endif
  95. #if EV_USE_LINUXAIO || EV_GENWRAP
  96. VARx(aio_context_t, linuxaio_ctx)
  97. VARx(int, linuxaio_iteration)
  98. VARx(struct aniocb **, linuxaio_iocbps)
  99. VARx(int, linuxaio_iocbpmax)
  100. VARx(struct iocb **, linuxaio_submits)
  101. VARx(int, linuxaio_submitcnt)
  102. VARx(int, linuxaio_submitmax)
  103. VARx(ev_io, linuxaio_epoll_w)
  104. #endif
  105. #if EV_USE_IOURING || EV_GENWRAP
  106. VARx(int, iouring_fd)
  107. VARx(unsigned, iouring_to_submit);
  108. VARx(int, iouring_entries)
  109. VARx(int, iouring_max_entries)
  110. VARx(void *, iouring_sq_ring)
  111. VARx(void *, iouring_cq_ring)
  112. VARx(void *, iouring_sqes)
  113. VARx(uint32_t, iouring_sq_ring_size)
  114. VARx(uint32_t, iouring_cq_ring_size)
  115. VARx(uint32_t, iouring_sqes_size)
  116. VARx(uint32_t, iouring_sq_head)
  117. VARx(uint32_t, iouring_sq_tail)
  118. VARx(uint32_t, iouring_sq_ring_mask)
  119. VARx(uint32_t, iouring_sq_ring_entries)
  120. VARx(uint32_t, iouring_sq_flags)
  121. VARx(uint32_t, iouring_sq_dropped)
  122. VARx(uint32_t, iouring_sq_array)
  123. VARx(uint32_t, iouring_cq_head)
  124. VARx(uint32_t, iouring_cq_tail)
  125. VARx(uint32_t, iouring_cq_ring_mask)
  126. VARx(uint32_t, iouring_cq_ring_entries)
  127. VARx(uint32_t, iouring_cq_overflow)
  128. VARx(uint32_t, iouring_cq_cqes)
  129. VARx(ev_tstamp, iouring_tfd_to)
  130. VARx(int, iouring_tfd)
  131. VARx(ev_io, iouring_tfd_w)
  132. #endif
  133. #if EV_USE_KQUEUE || EV_GENWRAP
  134. VARx(pid_t, kqueue_fd_pid)
  135. VARx(struct kevent *, kqueue_changes)
  136. VARx(int, kqueue_changemax)
  137. VARx(int, kqueue_changecnt)
  138. VARx(struct kevent *, kqueue_events)
  139. VARx(int, kqueue_eventmax)
  140. #endif
  141. #if EV_USE_PORT || EV_GENWRAP
  142. VARx(struct port_event *, port_events)
  143. VARx(int, port_eventmax)
  144. #endif
  145. #if EV_USE_IOCP || EV_GENWRAP
  146. VARx(HANDLE, iocp)
  147. #endif
  148. VARx(int *, fdchanges)
  149. VARx(int, fdchangemax)
  150. VARx(int, fdchangecnt)
  151. VARx(ANHE *, timers)
  152. VARx(int, timermax)
  153. VARx(int, timercnt)
  154. #if EV_PERIODIC_ENABLE || EV_GENWRAP
  155. VARx(ANHE *, periodics)
  156. VARx(int, periodicmax)
  157. VARx(int, periodiccnt)
  158. #endif
  159. #if EV_IDLE_ENABLE || EV_GENWRAP
  160. VAR (idles, ev_idle **idles [NUMPRI])
  161. VAR (idlemax, int idlemax [NUMPRI])
  162. VAR (idlecnt, int idlecnt [NUMPRI])
  163. #endif
  164. VARx(int, idleall) /* total number */
  165. VARx(struct ev_prepare **, prepares)
  166. VARx(int, preparemax)
  167. VARx(int, preparecnt)
  168. VARx(struct ev_check **, checks)
  169. VARx(int, checkmax)
  170. VARx(int, checkcnt)
  171. #if EV_FORK_ENABLE || EV_GENWRAP
  172. VARx(struct ev_fork **, forks)
  173. VARx(int, forkmax)
  174. VARx(int, forkcnt)
  175. #endif
  176. #if EV_CLEANUP_ENABLE || EV_GENWRAP
  177. VARx(struct ev_cleanup **, cleanups)
  178. VARx(int, cleanupmax)
  179. VARx(int, cleanupcnt)
  180. #endif
  181. #if EV_ASYNC_ENABLE || EV_GENWRAP
  182. VARx(EV_ATOMIC_T, async_pending)
  183. VARx(struct ev_async **, asyncs)
  184. VARx(int, asyncmax)
  185. VARx(int, asynccnt)
  186. #endif
  187. #if EV_USE_INOTIFY || EV_GENWRAP
  188. VARx(int, fs_fd)
  189. VARx(ev_io, fs_w)
  190. VARx(char, fs_2625) /* whether we are running in linux 2.6.25 or newer */
  191. VAR (fs_hash, ANFS fs_hash [EV_INOTIFY_HASHSIZE])
  192. #endif
  193. VARx(EV_ATOMIC_T, sig_pending)
  194. #if EV_USE_SIGNALFD || EV_GENWRAP
  195. VARx(int, sigfd)
  196. VARx(ev_io, sigfd_w)
  197. VARx(sigset_t, sigfd_set)
  198. #endif
  199. #if EV_USE_TIMERFD || EV_GENWRAP
  200. VARx(int, timerfd) /* timerfd for time jump detection */
  201. VARx(ev_io, timerfd_w)
  202. #endif
  203. VARx(unsigned int, origflags) /* original loop flags */
  204. #if EV_FEATURE_API || EV_GENWRAP
  205. VARx(unsigned int, loop_count) /* total number of loop iterations/blocks */
  206. VARx(unsigned int, loop_depth) /* #ev_run enters - #ev_run leaves */
  207. VARx(void *, userdata)
  208. /* C++ doesn't support the ev_loop_callback typedef here. stinks. */
  209. VAR (release_cb, void (*release_cb)(EV_P) EV_NOEXCEPT)
  210. VAR (acquire_cb, void (*acquire_cb)(EV_P) EV_NOEXCEPT)
  211. VAR (invoke_cb , ev_loop_callback invoke_cb)
  212. #endif
  213. #undef VARx