evdispatch 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. data/History.txt +3 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +96 -0
  4. data/README.txt +73 -0
  5. data/Rakefile +4 -0
  6. data/config/hoe.rb +70 -0
  7. data/config/requirements.rb +15 -0
  8. data/ext/revdispatch/extconf.rb +31 -0
  9. data/ext/revdispatch/libevdispatch/Changelog +0 -0
  10. data/ext/revdispatch/libevdispatch/LICENSE +0 -0
  11. data/ext/revdispatch/libevdispatch/Makefile.am +10 -0
  12. data/ext/revdispatch/libevdispatch/Makefile.in +637 -0
  13. data/ext/revdispatch/libevdispatch/README +3 -0
  14. data/ext/revdispatch/libevdispatch/TODO +5 -0
  15. data/ext/revdispatch/libevdispatch/aclocal.m4 +7459 -0
  16. data/ext/revdispatch/libevdispatch/autogen.sh +11 -0
  17. data/ext/revdispatch/libevdispatch/confdefs.h +32 -0
  18. data/ext/revdispatch/libevdispatch/config.guess +1516 -0
  19. data/ext/revdispatch/libevdispatch/config.h.in +112 -0
  20. data/ext/revdispatch/libevdispatch/config.sub +1626 -0
  21. data/ext/revdispatch/libevdispatch/configure +21949 -0
  22. data/ext/revdispatch/libevdispatch/configure.ac +40 -0
  23. data/ext/revdispatch/libevdispatch/depcomp +584 -0
  24. data/ext/revdispatch/libevdispatch/install-sh +507 -0
  25. data/ext/revdispatch/libevdispatch/libev/Changes +54 -0
  26. data/ext/revdispatch/libevdispatch/libev/LICENSE +25 -0
  27. data/ext/revdispatch/libevdispatch/libev/Makefile.am +18 -0
  28. data/ext/revdispatch/libevdispatch/libev/Makefile.in +677 -0
  29. data/ext/revdispatch/libevdispatch/libev/README +130 -0
  30. data/ext/revdispatch/libevdispatch/libev/aclocal.m4 +7430 -0
  31. data/ext/revdispatch/libevdispatch/libev/autogen.sh +7 -0
  32. data/ext/revdispatch/libevdispatch/libev/config.guess +1516 -0
  33. data/ext/revdispatch/libevdispatch/libev/config.h.in +106 -0
  34. data/ext/revdispatch/libevdispatch/libev/config.sub +1626 -0
  35. data/ext/revdispatch/libevdispatch/libev/configure +21636 -0
  36. data/ext/revdispatch/libevdispatch/libev/configure.ac +18 -0
  37. data/ext/revdispatch/libevdispatch/libev/ev++.h +779 -0
  38. data/ext/revdispatch/libevdispatch/libev/ev.3 +3276 -0
  39. data/ext/revdispatch/libevdispatch/libev/ev.c +2547 -0
  40. data/ext/revdispatch/libevdispatch/libev/ev.h +608 -0
  41. data/ext/revdispatch/libevdispatch/libev/ev.pod +3192 -0
  42. data/ext/revdispatch/libevdispatch/libev/ev_epoll.c +182 -0
  43. data/ext/revdispatch/libevdispatch/libev/ev_kqueue.c +194 -0
  44. data/ext/revdispatch/libevdispatch/libev/ev_poll.c +135 -0
  45. data/ext/revdispatch/libevdispatch/libev/ev_port.c +163 -0
  46. data/ext/revdispatch/libevdispatch/libev/ev_select.c +244 -0
  47. data/ext/revdispatch/libevdispatch/libev/ev_vars.h +157 -0
  48. data/ext/revdispatch/libevdispatch/libev/ev_win32.c +125 -0
  49. data/ext/revdispatch/libevdispatch/libev/ev_wrap.h +144 -0
  50. data/ext/revdispatch/libevdispatch/libev/event.c +404 -0
  51. data/ext/revdispatch/libevdispatch/libev/event.h +152 -0
  52. data/ext/revdispatch/libevdispatch/libev/install-sh +294 -0
  53. data/ext/revdispatch/libevdispatch/libev/libev.m4 +28 -0
  54. data/ext/revdispatch/libevdispatch/libev/ltmain.sh +6930 -0
  55. data/ext/revdispatch/libevdispatch/libev/missing +336 -0
  56. data/ext/revdispatch/libevdispatch/libev/mkinstalldirs +111 -0
  57. data/ext/revdispatch/libevdispatch/ltmain.sh +6930 -0
  58. data/ext/revdispatch/libevdispatch/missing +367 -0
  59. data/ext/revdispatch/libevdispatch/src/Makefile.am +11 -0
  60. data/ext/revdispatch/libevdispatch/src/Makefile.in +486 -0
  61. data/ext/revdispatch/libevdispatch/src/ev_dispatch.cc +264 -0
  62. data/ext/revdispatch/libevdispatch/src/ev_dispatch.h +300 -0
  63. data/ext/revdispatch/libevdispatch/src/ev_http.cc +238 -0
  64. data/ext/revdispatch/libevdispatch/src/ev_http.h +65 -0
  65. data/ext/revdispatch/libevdispatch/test/Makefile.am +16 -0
  66. data/ext/revdispatch/libevdispatch/test/Makefile.in +513 -0
  67. data/ext/revdispatch/libevdispatch/test/helper.rb +94 -0
  68. data/ext/revdispatch/libevdispatch/test/key_test.cc +52 -0
  69. data/ext/revdispatch/libevdispatch/test/next_test.cc +86 -0
  70. data/ext/revdispatch/libevdispatch/test/next_test.rb +8 -0
  71. data/ext/revdispatch/libevdispatch/test/server.rb +9 -0
  72. data/ext/revdispatch/revdispatch.cc +151 -0
  73. data/ext/revdispatch/server.rb +60 -0
  74. data/ext/revdispatch/test.rb +100 -0
  75. data/lib/evdispatch/loop.rb +16 -0
  76. data/lib/evdispatch/version.rb +9 -0
  77. data/lib/evdispatch.rb +8 -0
  78. data/log/debug.log +0 -0
  79. data/script/console +10 -0
  80. data/script/destroy +14 -0
  81. data/script/generate +14 -0
  82. data/script/txt2html +74 -0
  83. data/setup.rb +1585 -0
  84. data/tasks/deployment.rake +34 -0
  85. data/tasks/environment.rake +7 -0
  86. data/tasks/extconf/revdispatch.rake +43 -0
  87. data/tasks/extconf.rake +13 -0
  88. data/tasks/website.rake +17 -0
  89. data/test/test_evdispatch.rb +11 -0
  90. data/test/test_helper.rb +3 -0
  91. data/test/test_revdispatch_extn.rb +14 -0
  92. data/website/index.html +128 -0
  93. data/website/index.txt +55 -0
  94. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  95. data/website/stylesheets/screen.css +138 -0
  96. data/website/template.html.erb +49 -0
  97. metadata +157 -0
@@ -0,0 +1,244 @@
1
+ /*
2
+ * libev select fd activity backend
3
+ *
4
+ * Copyright (c) 2007 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
+
40
+ #ifndef _WIN32
41
+ /* for unix systems */
42
+ # include <sys/select.h>
43
+ # include <inttypes.h>
44
+ #endif
45
+
46
+ #ifndef EV_SELECT_USE_FD_SET
47
+ # ifdef NFDBITS
48
+ # define EV_SELECT_USE_FD_SET 0
49
+ # else
50
+ # define EV_SELECT_USE_FD_SET 1
51
+ # endif
52
+ #endif
53
+
54
+ #if EV_SELECT_IS_WINSOCKET
55
+ # undef EV_SELECT_USE_FD_SET
56
+ # define EV_SELECT_USE_FD_SET 1
57
+ # undef EINTR
58
+ # define EINTR WSAEINTR
59
+ # undef EBADF
60
+ # define EBADF WSAENOTSOCK
61
+ # undef ENOMEM
62
+ # define ENOMEM (errno + 1)
63
+ #endif
64
+
65
+ #if !EV_SELECT_USE_FD_SET
66
+ # define NFDBYTES (NFDBITS / 8)
67
+ #endif
68
+
69
+ #include <string.h>
70
+
71
+ static void
72
+ select_modify (EV_P_ int fd, int oev, int nev)
73
+ {
74
+ if (oev == nev)
75
+ return;
76
+
77
+ {
78
+ #if EV_SELECT_USE_FD_SET
79
+
80
+ #if EV_SELECT_IS_WINSOCKET
81
+ SOCKET handle = anfds [fd].handle;
82
+ #else
83
+ int handle = fd;
84
+ #endif
85
+
86
+ if (nev & EV_READ)
87
+ FD_SET (handle, (fd_set *)vec_ri);
88
+ else
89
+ FD_CLR (handle, (fd_set *)vec_ri);
90
+
91
+ if (nev & EV_WRITE)
92
+ FD_SET (handle, (fd_set *)vec_wi);
93
+ else
94
+ FD_CLR (handle, (fd_set *)vec_wi);
95
+
96
+ #else
97
+
98
+ int word = fd / NFDBITS;
99
+ fd_mask mask = 1UL << (fd % NFDBITS);
100
+
101
+ if (expect_false (vec_max < word + 1))
102
+ {
103
+ int new_max = word + 1;
104
+
105
+ vec_ri = ev_realloc (vec_ri, new_max * NFDBYTES);
106
+ vec_ro = ev_realloc (vec_ro, new_max * NFDBYTES); /* could free/malloc */
107
+ vec_wi = ev_realloc (vec_wi, new_max * NFDBYTES);
108
+ vec_wo = ev_realloc (vec_wo, new_max * NFDBYTES); /* could free/malloc */
109
+
110
+ for (; vec_max < new_max; ++vec_max)
111
+ ((fd_mask *)vec_ri) [vec_max] =
112
+ ((fd_mask *)vec_wi) [vec_max] = 0;
113
+ }
114
+
115
+ ((fd_mask *)vec_ri) [word] |= mask;
116
+ if (!(nev & EV_READ))
117
+ ((fd_mask *)vec_ri) [word] &= ~mask;
118
+
119
+ ((fd_mask *)vec_wi) [word] |= mask;
120
+ if (!(nev & EV_WRITE))
121
+ ((fd_mask *)vec_wi) [word] &= ~mask;
122
+ #endif
123
+ }
124
+ }
125
+
126
+ static void
127
+ select_poll (EV_P_ ev_tstamp timeout)
128
+ {
129
+ struct timeval tv;
130
+ int res;
131
+
132
+ #if EV_SELECT_USE_FD_SET
133
+ memcpy (vec_ro, vec_ri, sizeof (fd_set));
134
+ memcpy (vec_wo, vec_wi, sizeof (fd_set));
135
+ #else
136
+ memcpy (vec_ro, vec_ri, vec_max * NFDBYTES);
137
+ memcpy (vec_wo, vec_wi, vec_max * NFDBYTES);
138
+ #endif
139
+
140
+ tv.tv_sec = (long)timeout;
141
+ tv.tv_usec = (long)((timeout - (ev_tstamp)tv.tv_sec) * 1e6);
142
+
143
+ res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv);
144
+
145
+ if (expect_false (res < 0))
146
+ {
147
+ #if EV_SELECT_IS_WINSOCKET
148
+ errno = WSAGetLastError ();
149
+ #endif
150
+
151
+ if (errno == EBADF)
152
+ fd_ebadf (EV_A);
153
+ else if (errno == ENOMEM && !syserr_cb)
154
+ fd_enomem (EV_A);
155
+ else if (errno != EINTR)
156
+ syserr ("(libev) select");
157
+
158
+ return;
159
+ }
160
+
161
+ #if EV_SELECT_USE_FD_SET
162
+
163
+ {
164
+ int fd;
165
+
166
+ for (fd = 0; fd < anfdmax; ++fd)
167
+ if (anfds [fd].events)
168
+ {
169
+ int events = 0;
170
+ #if EV_SELECT_IS_WINSOCKET
171
+ SOCKET handle = anfds [fd].handle;
172
+ #else
173
+ int handle = fd;
174
+ #endif
175
+
176
+ if (FD_ISSET (handle, (fd_set *)vec_ro)) events |= EV_READ;
177
+ if (FD_ISSET (handle, (fd_set *)vec_wo)) events |= EV_WRITE;
178
+
179
+ if (expect_true (events))
180
+ fd_event (EV_A_ fd, events);
181
+ }
182
+ }
183
+
184
+ #else
185
+
186
+ {
187
+ int word, bit;
188
+ for (word = vec_max; word--; )
189
+ {
190
+ fd_mask word_r = ((fd_mask *)vec_ro) [word];
191
+ fd_mask word_w = ((fd_mask *)vec_wo) [word];
192
+
193
+ if (word_r || word_w)
194
+ for (bit = NFDBITS; bit--; )
195
+ {
196
+ fd_mask mask = 1UL << bit;
197
+ int events = 0;
198
+
199
+ events |= word_r & mask ? EV_READ : 0;
200
+ events |= word_w & mask ? EV_WRITE : 0;
201
+
202
+ if (expect_true (events))
203
+ fd_event (EV_A_ word * NFDBITS + bit, events);
204
+ }
205
+ }
206
+ }
207
+
208
+ #endif
209
+ }
210
+
211
+ int inline_size
212
+ select_init (EV_P_ int flags)
213
+ {
214
+ backend_fudge = 0.; /* posix says this is zero */
215
+ backend_modify = select_modify;
216
+ backend_poll = select_poll;
217
+
218
+ #if EV_SELECT_USE_FD_SET
219
+ vec_max = FD_SETSIZE / 32;
220
+ vec_ri = ev_malloc (sizeof (fd_set)); FD_ZERO ((fd_set *)vec_ri);
221
+ vec_ro = ev_malloc (sizeof (fd_set));
222
+ vec_wi = ev_malloc (sizeof (fd_set)); FD_ZERO ((fd_set *)vec_wi);
223
+ vec_wo = ev_malloc (sizeof (fd_set));
224
+ #else
225
+ vec_max = 0;
226
+ vec_ri = 0;
227
+ vec_ri = 0;
228
+ vec_wo = 0;
229
+ vec_wo = 0;
230
+ #endif
231
+
232
+ return EVBACKEND_SELECT;
233
+ }
234
+
235
+ void inline_size
236
+ select_destroy (EV_P)
237
+ {
238
+ ev_free (vec_ri);
239
+ ev_free (vec_ro);
240
+ ev_free (vec_wi);
241
+ ev_free (vec_wo);
242
+ }
243
+
244
+
@@ -0,0 +1,157 @@
1
+ /*
2
+ * loop member variable declarations
3
+ *
4
+ * Copyright (c) 2007,2008 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
+
40
+ #define VARx(type,name) VAR(name, type name)
41
+
42
+ VARx(ev_tstamp, now_floor) /* last time we refreshed rt_time */
43
+ VARx(ev_tstamp, mn_now) /* monotonic clock "now" */
44
+ VARx(ev_tstamp, rtmn_diff) /* difference realtime - monotonic time */
45
+
46
+ VARx(ev_tstamp, io_blocktime)
47
+ VARx(ev_tstamp, timeout_blocktime)
48
+
49
+ VARx(int, backend)
50
+ VARx(int, activecnt) /* total number of active events ("refcount") */
51
+ VARx(unsigned int, loop_count) /* total number of loop iterations/blocks */
52
+
53
+ VARx(int, backend_fd)
54
+ VARx(ev_tstamp, backend_fudge) /* assumed typical timer resolution */
55
+ VAR (backend_modify, void (*backend_modify)(EV_P_ int fd, int oev, int nev))
56
+ VAR (backend_poll , void (*backend_poll)(EV_P_ ev_tstamp timeout))
57
+
58
+ VAR (evpipe, int evpipe [2])
59
+ VARx(ev_io, pipeev)
60
+
61
+ #if !defined(_WIN32) || EV_GENWRAP
62
+ VARx(pid_t, curpid)
63
+ #endif
64
+
65
+ VARx(int, postfork) /* true if we need to recreate kernel state after fork */
66
+
67
+ #if EV_USE_SELECT || EV_GENWRAP
68
+ VARx(void *, vec_ri)
69
+ VARx(void *, vec_ro)
70
+ VARx(void *, vec_wi)
71
+ VARx(void *, vec_wo)
72
+ VARx(int, vec_max)
73
+ #endif
74
+
75
+ #if EV_USE_POLL || EV_GENWRAP
76
+ VARx(struct pollfd *, polls)
77
+ VARx(int, pollmax)
78
+ VARx(int, pollcnt)
79
+ VARx(int *, pollidxs) /* maps fds into structure indices */
80
+ VARx(int, pollidxmax)
81
+ #endif
82
+
83
+ #if EV_USE_EPOLL || EV_GENWRAP
84
+ VARx(struct epoll_event *, epoll_events)
85
+ VARx(int, epoll_eventmax)
86
+ #endif
87
+
88
+ #if EV_USE_KQUEUE || EV_GENWRAP
89
+ VARx(struct kevent *, kqueue_changes)
90
+ VARx(int, kqueue_changemax)
91
+ VARx(int, kqueue_changecnt)
92
+ VARx(struct kevent *, kqueue_events)
93
+ VARx(int, kqueue_eventmax)
94
+ #endif
95
+
96
+ #if EV_USE_PORT || EV_GENWRAP
97
+ VARx(struct port_event *, port_events)
98
+ VARx(int, port_eventmax)
99
+ #endif
100
+
101
+ VARx(ANFD *, anfds)
102
+ VARx(int, anfdmax)
103
+
104
+ VAR (pendings, ANPENDING *pendings [NUMPRI])
105
+ VAR (pendingmax, int pendingmax [NUMPRI])
106
+ VAR (pendingcnt, int pendingcnt [NUMPRI])
107
+
108
+ VARx(int *, fdchanges)
109
+ VARx(int, fdchangemax)
110
+ VARx(int, fdchangecnt)
111
+
112
+ VARx(WT *, timers)
113
+ VARx(int, timermax)
114
+ VARx(int, timercnt)
115
+
116
+ #if EV_PERIODIC_ENABLE || EV_GENWRAP
117
+ VARx(WT *, periodics)
118
+ VARx(int, periodicmax)
119
+ VARx(int, periodiccnt)
120
+ #endif
121
+
122
+ #if EV_IDLE_ENABLE || EV_GENWRAP
123
+ VAR (idles, ev_idle **idles [NUMPRI])
124
+ VAR (idlemax, int idlemax [NUMPRI])
125
+ VAR (idlecnt, int idlecnt [NUMPRI])
126
+ #endif
127
+ VARx(int, idleall) /* total number */
128
+
129
+ VARx(struct ev_prepare **, prepares)
130
+ VARx(int, preparemax)
131
+ VARx(int, preparecnt)
132
+
133
+ VARx(struct ev_check **, checks)
134
+ VARx(int, checkmax)
135
+ VARx(int, checkcnt)
136
+
137
+ #if EV_FORK_ENABLE || EV_GENWRAP
138
+ VARx(struct ev_fork **, forks)
139
+ VARx(int, forkmax)
140
+ VARx(int, forkcnt)
141
+ #endif
142
+
143
+ VARx(EV_ATOMIC_T, gotasync)
144
+ #if EV_ASYNC_ENABLE || EV_GENWRAP
145
+ VARx(struct ev_async **, asyncs)
146
+ VARx(int, asyncmax)
147
+ VARx(int, asynccnt)
148
+ #endif
149
+
150
+ #if EV_USE_INOTIFY || EV_GENWRAP
151
+ VARx(int, fs_fd)
152
+ VARx(ev_io, fs_w)
153
+ VAR (fs_hash, ANFS fs_hash [EV_INOTIFY_HASHSIZE])
154
+ #endif
155
+
156
+ #undef VARx
157
+
@@ -0,0 +1,125 @@
1
+ /*
2
+ * libev win32 compatibility cruft (_not_ a backend)
3
+ *
4
+ * Copyright (c) 2007 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
+
40
+ #ifdef _WIN32
41
+
42
+ #include <sys/timeb.h>
43
+
44
+ /* note: the comment below could not be substantiated, but what would I care */
45
+ /* MSDN says this is required to handle SIGFPE */
46
+ volatile double SIGFPE_REQ = 0.0f;
47
+
48
+ /* oh, the humanity! */
49
+ static int
50
+ ev_pipe (int filedes [2])
51
+ {
52
+ struct sockaddr_in addr = { 0 };
53
+ int addr_size = sizeof (addr);
54
+ SOCKET listener;
55
+ SOCKET sock [2] = { -1, -1 };
56
+
57
+ if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
58
+ return -1;
59
+
60
+ addr.sin_family = AF_INET;
61
+ addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
62
+ addr.sin_port = 0;
63
+
64
+ if (bind (listener, (struct sockaddr *)&addr, addr_size))
65
+ goto fail;
66
+
67
+ if (getsockname(listener, (struct sockaddr *)&addr, &addr_size))
68
+ goto fail;
69
+
70
+ if (listen (listener, 1))
71
+ goto fail;
72
+
73
+ if ((sock [0] = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
74
+ goto fail;
75
+
76
+ if (connect (sock[0], (struct sockaddr *)&addr, addr_size))
77
+ goto fail;
78
+
79
+ if ((sock[1] = accept (listener, 0, 0)) < 0)
80
+ goto fail;
81
+
82
+ closesocket (listener);
83
+
84
+ #if EV_SELECT_IS_WINSOCKET
85
+ filedes [0] = _open_osfhandle (sock [0], 0);
86
+ filedes [1] = _open_osfhandle (sock [1], 0);
87
+ #else
88
+ /* when select isn't winsocket, we also expect socket, connect, accept etc.
89
+ * to work on fds */
90
+ filedes [0] = sock [0];
91
+ filedes [1] = sock [1];
92
+ #endif
93
+
94
+ return 0;
95
+
96
+ fail:
97
+ closesocket (listener);
98
+
99
+ if (sock [0] != INVALID_SOCKET) closesocket (sock [0]);
100
+ if (sock [1] != INVALID_SOCKET) closesocket (sock [1]);
101
+
102
+ return -1;
103
+ }
104
+
105
+ #undef pipe
106
+ #define pipe(filedes) ev_pipe (filedes)
107
+
108
+ static int
109
+ ev_gettimeofday (struct timeval *tv, struct timezone *tz)
110
+ {
111
+ struct _timeb tb;
112
+
113
+ _ftime (&tb);
114
+
115
+ tv->tv_sec = (long)tb.time;
116
+ tv->tv_usec = ((long)tb.millitm) * 1000;
117
+
118
+ return 0;
119
+ }
120
+
121
+ #undef gettimeofday
122
+ #define gettimeofday(tv,tz) ev_gettimeofday (tv, tz)
123
+
124
+ #endif
125
+
@@ -0,0 +1,144 @@
1
+ /* DO NOT EDIT, automatically generated by update_ev_wrap */
2
+ #ifndef EV_WRAP_H
3
+ #define EV_WRAP_H
4
+ #define now_floor ((loop)->now_floor)
5
+ #define mn_now ((loop)->mn_now)
6
+ #define rtmn_diff ((loop)->rtmn_diff)
7
+ #define io_blocktime ((loop)->io_blocktime)
8
+ #define timeout_blocktime ((loop)->timeout_blocktime)
9
+ #define backend ((loop)->backend)
10
+ #define activecnt ((loop)->activecnt)
11
+ #define loop_count ((loop)->loop_count)
12
+ #define backend_fd ((loop)->backend_fd)
13
+ #define backend_fudge ((loop)->backend_fudge)
14
+ #define backend_modify ((loop)->backend_modify)
15
+ #define backend_poll ((loop)->backend_poll)
16
+ #define evpipe ((loop)->evpipe)
17
+ #define pipeev ((loop)->pipeev)
18
+ #define curpid ((loop)->curpid)
19
+ #define postfork ((loop)->postfork)
20
+ #define vec_ri ((loop)->vec_ri)
21
+ #define vec_ro ((loop)->vec_ro)
22
+ #define vec_wi ((loop)->vec_wi)
23
+ #define vec_wo ((loop)->vec_wo)
24
+ #define vec_max ((loop)->vec_max)
25
+ #define polls ((loop)->polls)
26
+ #define pollmax ((loop)->pollmax)
27
+ #define pollcnt ((loop)->pollcnt)
28
+ #define pollidxs ((loop)->pollidxs)
29
+ #define pollidxmax ((loop)->pollidxmax)
30
+ #define epoll_events ((loop)->epoll_events)
31
+ #define epoll_eventmax ((loop)->epoll_eventmax)
32
+ #define kqueue_changes ((loop)->kqueue_changes)
33
+ #define kqueue_changemax ((loop)->kqueue_changemax)
34
+ #define kqueue_changecnt ((loop)->kqueue_changecnt)
35
+ #define kqueue_events ((loop)->kqueue_events)
36
+ #define kqueue_eventmax ((loop)->kqueue_eventmax)
37
+ #define port_events ((loop)->port_events)
38
+ #define port_eventmax ((loop)->port_eventmax)
39
+ #define anfds ((loop)->anfds)
40
+ #define anfdmax ((loop)->anfdmax)
41
+ #define pendings ((loop)->pendings)
42
+ #define pendingmax ((loop)->pendingmax)
43
+ #define pendingcnt ((loop)->pendingcnt)
44
+ #define fdchanges ((loop)->fdchanges)
45
+ #define fdchangemax ((loop)->fdchangemax)
46
+ #define fdchangecnt ((loop)->fdchangecnt)
47
+ #define timers ((loop)->timers)
48
+ #define timermax ((loop)->timermax)
49
+ #define timercnt ((loop)->timercnt)
50
+ #define periodics ((loop)->periodics)
51
+ #define periodicmax ((loop)->periodicmax)
52
+ #define periodiccnt ((loop)->periodiccnt)
53
+ #define idles ((loop)->idles)
54
+ #define idlemax ((loop)->idlemax)
55
+ #define idlecnt ((loop)->idlecnt)
56
+ #define idleall ((loop)->idleall)
57
+ #define prepares ((loop)->prepares)
58
+ #define preparemax ((loop)->preparemax)
59
+ #define preparecnt ((loop)->preparecnt)
60
+ #define checks ((loop)->checks)
61
+ #define checkmax ((loop)->checkmax)
62
+ #define checkcnt ((loop)->checkcnt)
63
+ #define forks ((loop)->forks)
64
+ #define forkmax ((loop)->forkmax)
65
+ #define forkcnt ((loop)->forkcnt)
66
+ #define gotasync ((loop)->gotasync)
67
+ #define asyncs ((loop)->asyncs)
68
+ #define asyncmax ((loop)->asyncmax)
69
+ #define asynccnt ((loop)->asynccnt)
70
+ #define fs_fd ((loop)->fs_fd)
71
+ #define fs_w ((loop)->fs_w)
72
+ #define fs_hash ((loop)->fs_hash)
73
+ #else
74
+ #undef EV_WRAP_H
75
+ #undef now_floor
76
+ #undef mn_now
77
+ #undef rtmn_diff
78
+ #undef io_blocktime
79
+ #undef timeout_blocktime
80
+ #undef backend
81
+ #undef activecnt
82
+ #undef loop_count
83
+ #undef backend_fd
84
+ #undef backend_fudge
85
+ #undef backend_modify
86
+ #undef backend_poll
87
+ #undef evpipe
88
+ #undef pipeev
89
+ #undef curpid
90
+ #undef postfork
91
+ #undef vec_ri
92
+ #undef vec_ro
93
+ #undef vec_wi
94
+ #undef vec_wo
95
+ #undef vec_max
96
+ #undef polls
97
+ #undef pollmax
98
+ #undef pollcnt
99
+ #undef pollidxs
100
+ #undef pollidxmax
101
+ #undef epoll_events
102
+ #undef epoll_eventmax
103
+ #undef kqueue_changes
104
+ #undef kqueue_changemax
105
+ #undef kqueue_changecnt
106
+ #undef kqueue_events
107
+ #undef kqueue_eventmax
108
+ #undef port_events
109
+ #undef port_eventmax
110
+ #undef anfds
111
+ #undef anfdmax
112
+ #undef pendings
113
+ #undef pendingmax
114
+ #undef pendingcnt
115
+ #undef fdchanges
116
+ #undef fdchangemax
117
+ #undef fdchangecnt
118
+ #undef timers
119
+ #undef timermax
120
+ #undef timercnt
121
+ #undef periodics
122
+ #undef periodicmax
123
+ #undef periodiccnt
124
+ #undef idles
125
+ #undef idlemax
126
+ #undef idlecnt
127
+ #undef idleall
128
+ #undef prepares
129
+ #undef preparemax
130
+ #undef preparecnt
131
+ #undef checks
132
+ #undef checkmax
133
+ #undef checkcnt
134
+ #undef forks
135
+ #undef forkmax
136
+ #undef forkcnt
137
+ #undef gotasync
138
+ #undef asyncs
139
+ #undef asyncmax
140
+ #undef asynccnt
141
+ #undef fs_fd
142
+ #undef fs_w
143
+ #undef fs_hash
144
+ #endif