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