asyncengine 0.0.1.testing

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. data/README.markdown +0 -0
  2. data/asyncengine.gemspec +26 -0
  3. data/ext/asyncengine_ext/asyncengine_ruby.c +82 -0
  4. data/ext/asyncengine_ext/extconf.rb +47 -0
  5. data/ext/asyncengine_ext/libuv/AUTHORS +45 -0
  6. data/ext/asyncengine_ext/libuv/LICENSE +42 -0
  7. data/ext/asyncengine_ext/libuv/Makefile +119 -0
  8. data/ext/asyncengine_ext/libuv/README.md +88 -0
  9. data/ext/asyncengine_ext/libuv/build/gcc_version.py +20 -0
  10. data/ext/asyncengine_ext/libuv/common.gypi +176 -0
  11. data/ext/asyncengine_ext/libuv/config-mingw.mk +61 -0
  12. data/ext/asyncengine_ext/libuv/config-unix.mk +173 -0
  13. data/ext/asyncengine_ext/libuv/gyp_uv +60 -0
  14. data/ext/asyncengine_ext/libuv/include/ares.h +591 -0
  15. data/ext/asyncengine_ext/libuv/include/ares_version.h +24 -0
  16. data/ext/asyncengine_ext/libuv/include/uv-private/eio.h +403 -0
  17. data/ext/asyncengine_ext/libuv/include/uv-private/ev.h +838 -0
  18. data/ext/asyncengine_ext/libuv/include/uv-private/ngx-queue.h +106 -0
  19. data/ext/asyncengine_ext/libuv/include/uv-private/tree.h +768 -0
  20. data/ext/asyncengine_ext/libuv/include/uv-private/uv-unix.h +256 -0
  21. data/ext/asyncengine_ext/libuv/include/uv-private/uv-win.h +458 -0
  22. data/ext/asyncengine_ext/libuv/include/uv.h +1556 -0
  23. data/ext/asyncengine_ext/libuv/src/ares/AUTHORS +37 -0
  24. data/ext/asyncengine_ext/libuv/src/ares/CHANGES +1218 -0
  25. data/ext/asyncengine_ext/libuv/src/ares/CMakeLists.txt +22 -0
  26. data/ext/asyncengine_ext/libuv/src/ares/NEWS +21 -0
  27. data/ext/asyncengine_ext/libuv/src/ares/README +60 -0
  28. data/ext/asyncengine_ext/libuv/src/ares/README.cares +13 -0
  29. data/ext/asyncengine_ext/libuv/src/ares/README.msvc +142 -0
  30. data/ext/asyncengine_ext/libuv/src/ares/README.node +21 -0
  31. data/ext/asyncengine_ext/libuv/src/ares/RELEASE-NOTES +26 -0
  32. data/ext/asyncengine_ext/libuv/src/ares/TODO +23 -0
  33. data/ext/asyncengine_ext/libuv/src/ares/ares__close_sockets.c +66 -0
  34. data/ext/asyncengine_ext/libuv/src/ares/ares__get_hostent.c +263 -0
  35. data/ext/asyncengine_ext/libuv/src/ares/ares__read_line.c +71 -0
  36. data/ext/asyncengine_ext/libuv/src/ares/ares__timeval.c +111 -0
  37. data/ext/asyncengine_ext/libuv/src/ares/ares_cancel.c +63 -0
  38. data/ext/asyncengine_ext/libuv/src/ares/ares_data.c +190 -0
  39. data/ext/asyncengine_ext/libuv/src/ares/ares_data.h +65 -0
  40. data/ext/asyncengine_ext/libuv/src/ares/ares_destroy.c +105 -0
  41. data/ext/asyncengine_ext/libuv/src/ares/ares_dns.h +90 -0
  42. data/ext/asyncengine_ext/libuv/src/ares/ares_expand_name.c +200 -0
  43. data/ext/asyncengine_ext/libuv/src/ares/ares_expand_string.c +75 -0
  44. data/ext/asyncengine_ext/libuv/src/ares/ares_fds.c +63 -0
  45. data/ext/asyncengine_ext/libuv/src/ares/ares_free_hostent.c +42 -0
  46. data/ext/asyncengine_ext/libuv/src/ares/ares_free_string.c +25 -0
  47. data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.c +30 -0
  48. data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.h +26 -0
  49. data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyaddr.c +301 -0
  50. data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyname.c +523 -0
  51. data/ext/asyncengine_ext/libuv/src/ares/ares_getnameinfo.c +427 -0
  52. data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.c +122 -0
  53. data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.h +53 -0
  54. data/ext/asyncengine_ext/libuv/src/ares/ares_getsock.c +72 -0
  55. data/ext/asyncengine_ext/libuv/src/ares/ares_init.c +1809 -0
  56. data/ext/asyncengine_ext/libuv/src/ares/ares_iphlpapi.h +221 -0
  57. data/ext/asyncengine_ext/libuv/src/ares/ares_ipv6.h +78 -0
  58. data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.c +142 -0
  59. data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.h +42 -0
  60. data/ext/asyncengine_ext/libuv/src/ares/ares_llist.c +86 -0
  61. data/ext/asyncengine_ext/libuv/src/ares/ares_llist.h +42 -0
  62. data/ext/asyncengine_ext/libuv/src/ares/ares_mkquery.c +195 -0
  63. data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.c +181 -0
  64. data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.h +55 -0
  65. data/ext/asyncengine_ext/libuv/src/ares/ares_options.c +248 -0
  66. data/ext/asyncengine_ext/libuv/src/ares/ares_parse_a_reply.c +263 -0
  67. data/ext/asyncengine_ext/libuv/src/ares/ares_parse_aaaa_reply.c +259 -0
  68. data/ext/asyncengine_ext/libuv/src/ares/ares_parse_mx_reply.c +170 -0
  69. data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ns_reply.c +182 -0
  70. data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ptr_reply.c +217 -0
  71. data/ext/asyncengine_ext/libuv/src/ares/ares_parse_srv_reply.c +179 -0
  72. data/ext/asyncengine_ext/libuv/src/ares/ares_parse_txt_reply.c +201 -0
  73. data/ext/asyncengine_ext/libuv/src/ares/ares_platform.c +11035 -0
  74. data/ext/asyncengine_ext/libuv/src/ares/ares_platform.h +43 -0
  75. data/ext/asyncengine_ext/libuv/src/ares/ares_private.h +355 -0
  76. data/ext/asyncengine_ext/libuv/src/ares/ares_process.c +1295 -0
  77. data/ext/asyncengine_ext/libuv/src/ares/ares_query.c +183 -0
  78. data/ext/asyncengine_ext/libuv/src/ares/ares_rules.h +144 -0
  79. data/ext/asyncengine_ext/libuv/src/ares/ares_search.c +321 -0
  80. data/ext/asyncengine_ext/libuv/src/ares/ares_send.c +134 -0
  81. data/ext/asyncengine_ext/libuv/src/ares/ares_setup.h +199 -0
  82. data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.c +66 -0
  83. data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.h +30 -0
  84. data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.c +42 -0
  85. data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.h +26 -0
  86. data/ext/asyncengine_ext/libuv/src/ares/ares_strerror.c +56 -0
  87. data/ext/asyncengine_ext/libuv/src/ares/ares_timeout.c +80 -0
  88. data/ext/asyncengine_ext/libuv/src/ares/ares_version.c +11 -0
  89. data/ext/asyncengine_ext/libuv/src/ares/ares_writev.c +79 -0
  90. data/ext/asyncengine_ext/libuv/src/ares/ares_writev.h +36 -0
  91. data/ext/asyncengine_ext/libuv/src/ares/bitncmp.c +59 -0
  92. data/ext/asyncengine_ext/libuv/src/ares/bitncmp.h +26 -0
  93. data/ext/asyncengine_ext/libuv/src/ares/config_cygwin/ares_config.h +512 -0
  94. data/ext/asyncengine_ext/libuv/src/ares/config_darwin/ares_config.h +512 -0
  95. data/ext/asyncengine_ext/libuv/src/ares/config_freebsd/ares_config.h +512 -0
  96. data/ext/asyncengine_ext/libuv/src/ares/config_linux/ares_config.h +512 -0
  97. data/ext/asyncengine_ext/libuv/src/ares/config_netbsd/ares_config.h +512 -0
  98. data/ext/asyncengine_ext/libuv/src/ares/config_openbsd/ares_config.h +512 -0
  99. data/ext/asyncengine_ext/libuv/src/ares/config_sunos/ares_config.h +512 -0
  100. data/ext/asyncengine_ext/libuv/src/ares/config_win32/ares_config.h +369 -0
  101. data/ext/asyncengine_ext/libuv/src/ares/get_ver.awk +35 -0
  102. data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.c +451 -0
  103. data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.h +31 -0
  104. data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.c +208 -0
  105. data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.h +26 -0
  106. data/ext/asyncengine_ext/libuv/src/ares/nameser.h +203 -0
  107. data/ext/asyncengine_ext/libuv/src/ares/setup_once.h +504 -0
  108. data/ext/asyncengine_ext/libuv/src/ares/windows_port.c +22 -0
  109. data/ext/asyncengine_ext/libuv/src/unix/async.c +58 -0
  110. data/ext/asyncengine_ext/libuv/src/unix/cares.c +194 -0
  111. data/ext/asyncengine_ext/libuv/src/unix/check.c +80 -0
  112. data/ext/asyncengine_ext/libuv/src/unix/core.c +588 -0
  113. data/ext/asyncengine_ext/libuv/src/unix/cygwin.c +84 -0
  114. data/ext/asyncengine_ext/libuv/src/unix/darwin.c +341 -0
  115. data/ext/asyncengine_ext/libuv/src/unix/dl.c +91 -0
  116. data/ext/asyncengine_ext/libuv/src/unix/eio/Changes +63 -0
  117. data/ext/asyncengine_ext/libuv/src/unix/eio/LICENSE +36 -0
  118. data/ext/asyncengine_ext/libuv/src/unix/eio/Makefile.am +15 -0
  119. data/ext/asyncengine_ext/libuv/src/unix/eio/aclocal.m4 +8957 -0
  120. data/ext/asyncengine_ext/libuv/src/unix/eio/autogen.sh +3 -0
  121. data/ext/asyncengine_ext/libuv/src/unix/eio/config.h.in +86 -0
  122. data/ext/asyncengine_ext/libuv/src/unix/eio/config_cygwin.h +80 -0
  123. data/ext/asyncengine_ext/libuv/src/unix/eio/config_darwin.h +141 -0
  124. data/ext/asyncengine_ext/libuv/src/unix/eio/config_freebsd.h +81 -0
  125. data/ext/asyncengine_ext/libuv/src/unix/eio/config_linux.h +94 -0
  126. data/ext/asyncengine_ext/libuv/src/unix/eio/config_netbsd.h +81 -0
  127. data/ext/asyncengine_ext/libuv/src/unix/eio/config_openbsd.h +137 -0
  128. data/ext/asyncengine_ext/libuv/src/unix/eio/config_sunos.h +84 -0
  129. data/ext/asyncengine_ext/libuv/src/unix/eio/configure.ac +22 -0
  130. data/ext/asyncengine_ext/libuv/src/unix/eio/demo.c +194 -0
  131. data/ext/asyncengine_ext/libuv/src/unix/eio/ecb.h +370 -0
  132. data/ext/asyncengine_ext/libuv/src/unix/eio/eio.3 +3428 -0
  133. data/ext/asyncengine_ext/libuv/src/unix/eio/eio.c +2593 -0
  134. data/ext/asyncengine_ext/libuv/src/unix/eio/eio.pod +969 -0
  135. data/ext/asyncengine_ext/libuv/src/unix/eio/libeio.m4 +195 -0
  136. data/ext/asyncengine_ext/libuv/src/unix/eio/xthread.h +164 -0
  137. data/ext/asyncengine_ext/libuv/src/unix/error.c +98 -0
  138. data/ext/asyncengine_ext/libuv/src/unix/ev/Changes +388 -0
  139. data/ext/asyncengine_ext/libuv/src/unix/ev/LICENSE +36 -0
  140. data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.am +18 -0
  141. data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.in +771 -0
  142. data/ext/asyncengine_ext/libuv/src/unix/ev/README +58 -0
  143. data/ext/asyncengine_ext/libuv/src/unix/ev/aclocal.m4 +8957 -0
  144. data/ext/asyncengine_ext/libuv/src/unix/ev/autogen.sh +6 -0
  145. data/ext/asyncengine_ext/libuv/src/unix/ev/config.guess +1526 -0
  146. data/ext/asyncengine_ext/libuv/src/unix/ev/config.h.in +125 -0
  147. data/ext/asyncengine_ext/libuv/src/unix/ev/config.sub +1658 -0
  148. data/ext/asyncengine_ext/libuv/src/unix/ev/config_cygwin.h +123 -0
  149. data/ext/asyncengine_ext/libuv/src/unix/ev/config_darwin.h +122 -0
  150. data/ext/asyncengine_ext/libuv/src/unix/ev/config_freebsd.h +120 -0
  151. data/ext/asyncengine_ext/libuv/src/unix/ev/config_linux.h +141 -0
  152. data/ext/asyncengine_ext/libuv/src/unix/ev/config_netbsd.h +120 -0
  153. data/ext/asyncengine_ext/libuv/src/unix/ev/config_openbsd.h +126 -0
  154. data/ext/asyncengine_ext/libuv/src/unix/ev/config_sunos.h +122 -0
  155. data/ext/asyncengine_ext/libuv/src/unix/ev/configure +13037 -0
  156. data/ext/asyncengine_ext/libuv/src/unix/ev/configure.ac +18 -0
  157. data/ext/asyncengine_ext/libuv/src/unix/ev/depcomp +630 -0
  158. data/ext/asyncengine_ext/libuv/src/unix/ev/ev++.h +816 -0
  159. data/ext/asyncengine_ext/libuv/src/unix/ev/ev.3 +5311 -0
  160. data/ext/asyncengine_ext/libuv/src/unix/ev/ev.c +3921 -0
  161. data/ext/asyncengine_ext/libuv/src/unix/ev/ev.pod +5243 -0
  162. data/ext/asyncengine_ext/libuv/src/unix/ev/ev_epoll.c +266 -0
  163. data/ext/asyncengine_ext/libuv/src/unix/ev/ev_kqueue.c +235 -0
  164. data/ext/asyncengine_ext/libuv/src/unix/ev/ev_poll.c +148 -0
  165. data/ext/asyncengine_ext/libuv/src/unix/ev/ev_port.c +179 -0
  166. data/ext/asyncengine_ext/libuv/src/unix/ev/ev_select.c +310 -0
  167. data/ext/asyncengine_ext/libuv/src/unix/ev/ev_vars.h +203 -0
  168. data/ext/asyncengine_ext/libuv/src/unix/ev/ev_win32.c +153 -0
  169. data/ext/asyncengine_ext/libuv/src/unix/ev/ev_wrap.h +196 -0
  170. data/ext/asyncengine_ext/libuv/src/unix/ev/event.c +402 -0
  171. data/ext/asyncengine_ext/libuv/src/unix/ev/event.h +170 -0
  172. data/ext/asyncengine_ext/libuv/src/unix/ev/install-sh +294 -0
  173. data/ext/asyncengine_ext/libuv/src/unix/ev/libev.m4 +39 -0
  174. data/ext/asyncengine_ext/libuv/src/unix/ev/ltmain.sh +8413 -0
  175. data/ext/asyncengine_ext/libuv/src/unix/ev/missing +336 -0
  176. data/ext/asyncengine_ext/libuv/src/unix/ev/mkinstalldirs +111 -0
  177. data/ext/asyncengine_ext/libuv/src/unix/freebsd.c +312 -0
  178. data/ext/asyncengine_ext/libuv/src/unix/fs.c +707 -0
  179. data/ext/asyncengine_ext/libuv/src/unix/idle.c +79 -0
  180. data/ext/asyncengine_ext/libuv/src/unix/internal.h +161 -0
  181. data/ext/asyncengine_ext/libuv/src/unix/kqueue.c +127 -0
  182. data/ext/asyncengine_ext/libuv/src/unix/linux/core.c +474 -0
  183. data/ext/asyncengine_ext/libuv/src/unix/linux/inotify.c +211 -0
  184. data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.c +230 -0
  185. data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.h +87 -0
  186. data/ext/asyncengine_ext/libuv/src/unix/loop.c +58 -0
  187. data/ext/asyncengine_ext/libuv/src/unix/netbsd.c +108 -0
  188. data/ext/asyncengine_ext/libuv/src/unix/openbsd.c +295 -0
  189. data/ext/asyncengine_ext/libuv/src/unix/pipe.c +266 -0
  190. data/ext/asyncengine_ext/libuv/src/unix/prepare.c +79 -0
  191. data/ext/asyncengine_ext/libuv/src/unix/process.c +369 -0
  192. data/ext/asyncengine_ext/libuv/src/unix/stream.c +1033 -0
  193. data/ext/asyncengine_ext/libuv/src/unix/sunos.c +466 -0
  194. data/ext/asyncengine_ext/libuv/src/unix/tcp.c +327 -0
  195. data/ext/asyncengine_ext/libuv/src/unix/thread.c +154 -0
  196. data/ext/asyncengine_ext/libuv/src/unix/timer.c +127 -0
  197. data/ext/asyncengine_ext/libuv/src/unix/tty.c +146 -0
  198. data/ext/asyncengine_ext/libuv/src/unix/udp.c +670 -0
  199. data/ext/asyncengine_ext/libuv/src/unix/uv-eio.c +124 -0
  200. data/ext/asyncengine_ext/libuv/src/unix/uv-eio.h +13 -0
  201. data/ext/asyncengine_ext/libuv/src/uv-common.c +354 -0
  202. data/ext/asyncengine_ext/libuv/src/uv-common.h +87 -0
  203. data/ext/asyncengine_ext/libuv/src/win/async.c +127 -0
  204. data/ext/asyncengine_ext/libuv/src/win/cares.c +290 -0
  205. data/ext/asyncengine_ext/libuv/src/win/core.c +270 -0
  206. data/ext/asyncengine_ext/libuv/src/win/dl.c +82 -0
  207. data/ext/asyncengine_ext/libuv/src/win/error.c +132 -0
  208. data/ext/asyncengine_ext/libuv/src/win/fs-event.c +514 -0
  209. data/ext/asyncengine_ext/libuv/src/win/fs.c +1576 -0
  210. data/ext/asyncengine_ext/libuv/src/win/getaddrinfo.c +372 -0
  211. data/ext/asyncengine_ext/libuv/src/win/handle.c +225 -0
  212. data/ext/asyncengine_ext/libuv/src/win/internal.h +352 -0
  213. data/ext/asyncengine_ext/libuv/src/win/loop-watcher.c +131 -0
  214. data/ext/asyncengine_ext/libuv/src/win/pipe.c +1661 -0
  215. data/ext/asyncengine_ext/libuv/src/win/process.c +1140 -0
  216. data/ext/asyncengine_ext/libuv/src/win/req.c +174 -0
  217. data/ext/asyncengine_ext/libuv/src/win/stream.c +201 -0
  218. data/ext/asyncengine_ext/libuv/src/win/tcp.c +1282 -0
  219. data/ext/asyncengine_ext/libuv/src/win/thread.c +332 -0
  220. data/ext/asyncengine_ext/libuv/src/win/threadpool.c +73 -0
  221. data/ext/asyncengine_ext/libuv/src/win/timer.c +276 -0
  222. data/ext/asyncengine_ext/libuv/src/win/tty.c +1795 -0
  223. data/ext/asyncengine_ext/libuv/src/win/udp.c +709 -0
  224. data/ext/asyncengine_ext/libuv/src/win/util.c +719 -0
  225. data/ext/asyncengine_ext/libuv/src/win/winapi.c +117 -0
  226. data/ext/asyncengine_ext/libuv/src/win/winapi.h +4419 -0
  227. data/ext/asyncengine_ext/libuv/src/win/winsock.c +470 -0
  228. data/ext/asyncengine_ext/libuv/src/win/winsock.h +138 -0
  229. data/ext/asyncengine_ext/libuv/test/benchmark-ares.c +118 -0
  230. data/ext/asyncengine_ext/libuv/test/benchmark-getaddrinfo.c +94 -0
  231. data/ext/asyncengine_ext/libuv/test/benchmark-list.h +105 -0
  232. data/ext/asyncengine_ext/libuv/test/benchmark-ping-pongs.c +213 -0
  233. data/ext/asyncengine_ext/libuv/test/benchmark-pound.c +324 -0
  234. data/ext/asyncengine_ext/libuv/test/benchmark-pump.c +462 -0
  235. data/ext/asyncengine_ext/libuv/test/benchmark-sizes.c +40 -0
  236. data/ext/asyncengine_ext/libuv/test/benchmark-spawn.c +156 -0
  237. data/ext/asyncengine_ext/libuv/test/benchmark-tcp-write-batch.c +140 -0
  238. data/ext/asyncengine_ext/libuv/test/benchmark-thread.c +64 -0
  239. data/ext/asyncengine_ext/libuv/test/benchmark-udp-packet-storm.c +247 -0
  240. data/ext/asyncengine_ext/libuv/test/blackhole-server.c +118 -0
  241. data/ext/asyncengine_ext/libuv/test/dns-server.c +321 -0
  242. data/ext/asyncengine_ext/libuv/test/echo-server.c +370 -0
  243. data/ext/asyncengine_ext/libuv/test/fixtures/empty_file +0 -0
  244. data/ext/asyncengine_ext/libuv/test/fixtures/load_error.node +1 -0
  245. data/ext/asyncengine_ext/libuv/test/run-benchmarks.c +64 -0
  246. data/ext/asyncengine_ext/libuv/test/run-tests.c +108 -0
  247. data/ext/asyncengine_ext/libuv/test/runner-unix.c +315 -0
  248. data/ext/asyncengine_ext/libuv/test/runner-unix.h +36 -0
  249. data/ext/asyncengine_ext/libuv/test/runner-win.c +343 -0
  250. data/ext/asyncengine_ext/libuv/test/runner-win.h +42 -0
  251. data/ext/asyncengine_ext/libuv/test/runner.c +317 -0
  252. data/ext/asyncengine_ext/libuv/test/runner.h +159 -0
  253. data/ext/asyncengine_ext/libuv/test/task.h +117 -0
  254. data/ext/asyncengine_ext/libuv/test/test-async.c +216 -0
  255. data/ext/asyncengine_ext/libuv/test/test-callback-stack.c +203 -0
  256. data/ext/asyncengine_ext/libuv/test/test-connection-fail.c +148 -0
  257. data/ext/asyncengine_ext/libuv/test/test-counters-init.c +216 -0
  258. data/ext/asyncengine_ext/libuv/test/test-cwd-and-chdir.c +64 -0
  259. data/ext/asyncengine_ext/libuv/test/test-delayed-accept.c +197 -0
  260. data/ext/asyncengine_ext/libuv/test/test-dlerror.c +49 -0
  261. data/ext/asyncengine_ext/libuv/test/test-eio-overflow.c +90 -0
  262. data/ext/asyncengine_ext/libuv/test/test-error.c +59 -0
  263. data/ext/asyncengine_ext/libuv/test/test-fail-always.c +29 -0
  264. data/ext/asyncengine_ext/libuv/test/test-fs-event.c +442 -0
  265. data/ext/asyncengine_ext/libuv/test/test-fs.c +1731 -0
  266. data/ext/asyncengine_ext/libuv/test/test-get-currentexe.c +63 -0
  267. data/ext/asyncengine_ext/libuv/test/test-get-loadavg.c +36 -0
  268. data/ext/asyncengine_ext/libuv/test/test-get-memory.c +38 -0
  269. data/ext/asyncengine_ext/libuv/test/test-getaddrinfo.c +122 -0
  270. data/ext/asyncengine_ext/libuv/test/test-gethostbyname.c +189 -0
  271. data/ext/asyncengine_ext/libuv/test/test-getsockname.c +342 -0
  272. data/ext/asyncengine_ext/libuv/test/test-hrtime.c +51 -0
  273. data/ext/asyncengine_ext/libuv/test/test-idle.c +81 -0
  274. data/ext/asyncengine_ext/libuv/test/test-ipc-send-recv.c +209 -0
  275. data/ext/asyncengine_ext/libuv/test/test-ipc.c +614 -0
  276. data/ext/asyncengine_ext/libuv/test/test-list.h +371 -0
  277. data/ext/asyncengine_ext/libuv/test/test-loop-handles.c +359 -0
  278. data/ext/asyncengine_ext/libuv/test/test-multiple-listen.c +102 -0
  279. data/ext/asyncengine_ext/libuv/test/test-mutexes.c +63 -0
  280. data/ext/asyncengine_ext/libuv/test/test-pass-always.c +28 -0
  281. data/ext/asyncengine_ext/libuv/test/test-ping-pong.c +253 -0
  282. data/ext/asyncengine_ext/libuv/test/test-pipe-bind-error.c +140 -0
  283. data/ext/asyncengine_ext/libuv/test/test-pipe-connect-error.c +96 -0
  284. data/ext/asyncengine_ext/libuv/test/test-platform-output.c +87 -0
  285. data/ext/asyncengine_ext/libuv/test/test-process-title.c +42 -0
  286. data/ext/asyncengine_ext/libuv/test/test-ref.c +322 -0
  287. data/ext/asyncengine_ext/libuv/test/test-run-once.c +44 -0
  288. data/ext/asyncengine_ext/libuv/test/test-shutdown-close.c +103 -0
  289. data/ext/asyncengine_ext/libuv/test/test-shutdown-eof.c +183 -0
  290. data/ext/asyncengine_ext/libuv/test/test-spawn.c +499 -0
  291. data/ext/asyncengine_ext/libuv/test/test-stdio-over-pipes.c +256 -0
  292. data/ext/asyncengine_ext/libuv/test/test-tcp-bind-error.c +191 -0
  293. data/ext/asyncengine_ext/libuv/test/test-tcp-bind6-error.c +154 -0
  294. data/ext/asyncengine_ext/libuv/test/test-tcp-close.c +129 -0
  295. data/ext/asyncengine_ext/libuv/test/test-tcp-connect-error.c +70 -0
  296. data/ext/asyncengine_ext/libuv/test/test-tcp-connect6-error.c +68 -0
  297. data/ext/asyncengine_ext/libuv/test/test-tcp-flags.c +51 -0
  298. data/ext/asyncengine_ext/libuv/test/test-tcp-write-error.c +168 -0
  299. data/ext/asyncengine_ext/libuv/test/test-tcp-write-to-half-open-connection.c +135 -0
  300. data/ext/asyncengine_ext/libuv/test/test-tcp-writealot.c +195 -0
  301. data/ext/asyncengine_ext/libuv/test/test-thread.c +183 -0
  302. data/ext/asyncengine_ext/libuv/test/test-threadpool.c +57 -0
  303. data/ext/asyncengine_ext/libuv/test/test-timer-again.c +141 -0
  304. data/ext/asyncengine_ext/libuv/test/test-timer.c +130 -0
  305. data/ext/asyncengine_ext/libuv/test/test-tty.c +110 -0
  306. data/ext/asyncengine_ext/libuv/test/test-udp-dgram-too-big.c +86 -0
  307. data/ext/asyncengine_ext/libuv/test/test-udp-ipv6.c +156 -0
  308. data/ext/asyncengine_ext/libuv/test/test-udp-multicast-join.c +139 -0
  309. data/ext/asyncengine_ext/libuv/test/test-udp-multicast-ttl.c +86 -0
  310. data/ext/asyncengine_ext/libuv/test/test-udp-options.c +86 -0
  311. data/ext/asyncengine_ext/libuv/test/test-udp-send-and-recv.c +208 -0
  312. data/ext/asyncengine_ext/libuv/test/test-util.c +97 -0
  313. data/ext/asyncengine_ext/libuv/uv.gyp +435 -0
  314. data/ext/asyncengine_ext/libuv/vcbuild.bat +105 -0
  315. data/lib/asyncengine/version.rb +3 -0
  316. data/lib/asyncengine.rb +41 -0
  317. metadata +384 -0
@@ -0,0 +1,838 @@
1
+ /*
2
+ * libev native API header
3
+ *
4
+ * Copyright (c) 2007,2008,2009,2010,2011 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 EV_H_
41
+ #define EV_H_
42
+
43
+ #ifdef __cplusplus
44
+ # define EV_CPP(x) x
45
+ #else
46
+ # define EV_CPP(x)
47
+ #endif
48
+
49
+ EV_CPP(extern "C" {)
50
+
51
+ #ifdef __GNUC__
52
+ # define EV_MAYBE_UNUSED __attribute__ ((unused))
53
+ #else
54
+ # define EV_MAYBE_UNUSED
55
+ #endif
56
+
57
+ /*****************************************************************************/
58
+
59
+ /* pre-4.0 compatibility */
60
+ #ifndef EV_COMPAT3
61
+ # define EV_COMPAT3 1
62
+ #endif
63
+
64
+ #ifndef EV_FEATURES
65
+ # define EV_FEATURES 0x7f
66
+ #endif
67
+
68
+ #define EV_FEATURE_CODE ((EV_FEATURES) & 1)
69
+ #define EV_FEATURE_DATA ((EV_FEATURES) & 2)
70
+ #define EV_FEATURE_CONFIG ((EV_FEATURES) & 4)
71
+ #define EV_FEATURE_API ((EV_FEATURES) & 8)
72
+ #define EV_FEATURE_WATCHERS ((EV_FEATURES) & 16)
73
+ #define EV_FEATURE_BACKENDS ((EV_FEATURES) & 32)
74
+ #define EV_FEATURE_OS ((EV_FEATURES) & 64)
75
+
76
+ /* these priorities are inclusive, higher priorities will be invoked earlier */
77
+ #ifndef EV_MINPRI
78
+ # define EV_MINPRI (EV_FEATURE_CONFIG ? -2 : 0)
79
+ #endif
80
+ #ifndef EV_MAXPRI
81
+ # define EV_MAXPRI (EV_FEATURE_CONFIG ? +2 : 0)
82
+ #endif
83
+
84
+ #ifndef EV_MULTIPLICITY
85
+ # define EV_MULTIPLICITY EV_FEATURE_CONFIG
86
+ #endif
87
+
88
+ #ifndef EV_PERIODIC_ENABLE
89
+ # define EV_PERIODIC_ENABLE EV_FEATURE_WATCHERS
90
+ #endif
91
+
92
+ #ifndef EV_STAT_ENABLE
93
+ # define EV_STAT_ENABLE EV_FEATURE_WATCHERS
94
+ #endif
95
+
96
+ #ifndef EV_PREPARE_ENABLE
97
+ # define EV_PREPARE_ENABLE EV_FEATURE_WATCHERS
98
+ #endif
99
+
100
+ #ifndef EV_CHECK_ENABLE
101
+ # define EV_CHECK_ENABLE EV_FEATURE_WATCHERS
102
+ #endif
103
+
104
+ #ifndef EV_IDLE_ENABLE
105
+ # define EV_IDLE_ENABLE EV_FEATURE_WATCHERS
106
+ #endif
107
+
108
+ #ifndef EV_FORK_ENABLE
109
+ # define EV_FORK_ENABLE EV_FEATURE_WATCHERS
110
+ #endif
111
+
112
+ #ifndef EV_CLEANUP_ENABLE
113
+ # define EV_CLEANUP_ENABLE EV_FEATURE_WATCHERS
114
+ #endif
115
+
116
+ #ifndef EV_SIGNAL_ENABLE
117
+ # define EV_SIGNAL_ENABLE EV_FEATURE_WATCHERS
118
+ #endif
119
+
120
+ #ifndef EV_CHILD_ENABLE
121
+ # ifdef _WIN32
122
+ # define EV_CHILD_ENABLE 0
123
+ # else
124
+ # define EV_CHILD_ENABLE EV_FEATURE_WATCHERS
125
+ #endif
126
+ #endif
127
+
128
+ #ifndef EV_ASYNC_ENABLE
129
+ # define EV_ASYNC_ENABLE EV_FEATURE_WATCHERS
130
+ #endif
131
+
132
+ #ifndef EV_EMBED_ENABLE
133
+ # define EV_EMBED_ENABLE EV_FEATURE_WATCHERS
134
+ #endif
135
+
136
+ #ifndef EV_WALK_ENABLE
137
+ # define EV_WALK_ENABLE 0 /* not yet */
138
+ #endif
139
+
140
+ /*****************************************************************************/
141
+
142
+ #if EV_CHILD_ENABLE && !EV_SIGNAL_ENABLE
143
+ # undef EV_SIGNAL_ENABLE
144
+ # define EV_SIGNAL_ENABLE 1
145
+ #endif
146
+
147
+ /*****************************************************************************/
148
+
149
+ typedef double ev_tstamp;
150
+
151
+ #ifndef EV_ATOMIC_T
152
+ # include <signal.h>
153
+ # define EV_ATOMIC_T sig_atomic_t volatile
154
+ #endif
155
+
156
+ #if EV_STAT_ENABLE
157
+ # ifdef _WIN32
158
+ # include <time.h>
159
+ # include <sys/types.h>
160
+ # endif
161
+ # include <sys/stat.h>
162
+ #endif
163
+
164
+ /* support multiple event loops? */
165
+ #if EV_MULTIPLICITY
166
+ struct ev_loop;
167
+ # define EV_P struct ev_loop *loop /* a loop as sole parameter in a declaration */
168
+ # define EV_P_ EV_P, /* a loop as first of multiple parameters */
169
+ # define EV_A loop /* a loop as sole argument to a function call */
170
+ # define EV_A_ EV_A, /* a loop as first of multiple arguments */
171
+ # define EV_DEFAULT_UC ev_default_loop_uc_ () /* the default loop, if initialised, as sole arg */
172
+ # define EV_DEFAULT_UC_ EV_DEFAULT_UC, /* the default loop as first of multiple arguments */
173
+ # define EV_DEFAULT ev_default_loop (0) /* the default loop as sole arg */
174
+ # define EV_DEFAULT_ EV_DEFAULT, /* the default loop as first of multiple arguments */
175
+ #else
176
+ # define EV_P void
177
+ # define EV_P_
178
+ # define EV_A
179
+ # define EV_A_
180
+ # define EV_DEFAULT
181
+ # define EV_DEFAULT_
182
+ # define EV_DEFAULT_UC
183
+ # define EV_DEFAULT_UC_
184
+ # undef EV_EMBED_ENABLE
185
+ #endif
186
+
187
+ /* EV_INLINE is used for functions in header files */
188
+ #if __STDC_VERSION__ >= 199901L && __GNUC__ >= 3
189
+ # define EV_INLINE static inline
190
+ #else
191
+ # define EV_INLINE static
192
+ #endif
193
+
194
+ /* EV_PROTOTYPES can be used to switch of prototype declarations */
195
+ #ifndef EV_PROTOTYPES
196
+ # define EV_PROTOTYPES 1
197
+ #endif
198
+
199
+ /*****************************************************************************/
200
+
201
+ #define EV_VERSION_MAJOR 4
202
+ #define EV_VERSION_MINOR 4
203
+
204
+ /* eventmask, revents, events... */
205
+ enum {
206
+ EV_UNDEF = -1, /* guaranteed to be invalid */
207
+ EV_NONE = 0x00, /* no events */
208
+ EV_READ = 0x01, /* ev_io detected read will not block */
209
+ EV_WRITE = 0x02, /* ev_io detected write will not block */
210
+ EV_LIBUV_KQUEUE_HACK = 0x40,
211
+ EV__IOFDSET = 0x80, /* internal use only */
212
+ EV_IO = EV_READ, /* alias for type-detection */
213
+ EV_TIMER = 0x00000100, /* timer timed out */
214
+ #if EV_COMPAT3
215
+ EV_TIMEOUT = EV_TIMER, /* pre 4.0 API compatibility */
216
+ #endif
217
+ EV_PERIODIC = 0x00000200, /* periodic timer timed out */
218
+ EV_SIGNAL = 0x00000400, /* signal was received */
219
+ EV_CHILD = 0x00000800, /* child/pid had status change */
220
+ EV_STAT = 0x00001000, /* stat data changed */
221
+ EV_IDLE = 0x00002000, /* event loop is idling */
222
+ EV_PREPARE = 0x00004000, /* event loop about to poll */
223
+ EV_CHECK = 0x00008000, /* event loop finished poll */
224
+ EV_EMBED = 0x00010000, /* embedded event loop needs sweep */
225
+ EV_FORK = 0x00020000, /* event loop resumed in child */
226
+ EV_CLEANUP = 0x00040000, /* event loop resumed in child */
227
+ EV_ASYNC = 0x00080000, /* async intra-loop signal */
228
+ EV_CUSTOM = 0x01000000, /* for use by user code */
229
+ EV_ERROR = (-2147483647 - 1) /* sent when an error occurs */
230
+ };
231
+
232
+ /* can be used to add custom fields to all watchers, while losing binary compatibility */
233
+ #ifndef EV_COMMON
234
+ # define EV_COMMON void *data;
235
+ #endif
236
+
237
+ #ifndef EV_CB_DECLARE
238
+ # define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents);
239
+ #endif
240
+ #ifndef EV_CB_INVOKE
241
+ # define EV_CB_INVOKE(watcher,revents) (watcher)->cb (EV_A_ (watcher), (revents))
242
+ #endif
243
+
244
+ /* not official, do not use */
245
+ #define EV_CB(type,name) void name (EV_P_ struct ev_ ## type *w, int revents)
246
+
247
+ /*
248
+ * struct member types:
249
+ * private: you may look at them, but not change them,
250
+ * and they might not mean anything to you.
251
+ * ro: can be read anytime, but only changed when the watcher isn't active.
252
+ * rw: can be read and modified anytime, even when the watcher is active.
253
+ *
254
+ * some internal details that might be helpful for debugging:
255
+ *
256
+ * active is either 0, which means the watcher is not active,
257
+ * or the array index of the watcher (periodics, timers)
258
+ * or the array index + 1 (most other watchers)
259
+ * or simply 1 for watchers that aren't in some array.
260
+ * pending is either 0, in which case the watcher isn't,
261
+ * or the array index + 1 in the pendings array.
262
+ */
263
+
264
+ #if EV_MINPRI == EV_MAXPRI
265
+ # define EV_DECL_PRIORITY
266
+ #elif !defined (EV_DECL_PRIORITY)
267
+ # define EV_DECL_PRIORITY int priority;
268
+ #endif
269
+
270
+ /* shared by all watchers */
271
+ #define EV_WATCHER(type) \
272
+ int active; /* private */ \
273
+ int pending; /* private */ \
274
+ EV_DECL_PRIORITY /* private */ \
275
+ EV_COMMON /* rw */ \
276
+ EV_CB_DECLARE (type) /* private */
277
+
278
+ #define EV_WATCHER_LIST(type) \
279
+ EV_WATCHER (type) \
280
+ struct ev_watcher_list *next; /* private */
281
+
282
+ #define EV_WATCHER_TIME(type) \
283
+ EV_WATCHER (type) \
284
+ ev_tstamp at; /* private */
285
+
286
+ /* base class, nothing to see here unless you subclass */
287
+ typedef struct ev_watcher
288
+ {
289
+ EV_WATCHER (ev_watcher)
290
+ } ev_watcher;
291
+
292
+ /* base class, nothing to see here unless you subclass */
293
+ typedef struct ev_watcher_list
294
+ {
295
+ EV_WATCHER_LIST (ev_watcher_list)
296
+ } ev_watcher_list;
297
+
298
+ /* base class, nothing to see here unless you subclass */
299
+ typedef struct ev_watcher_time
300
+ {
301
+ EV_WATCHER_TIME (ev_watcher_time)
302
+ } ev_watcher_time;
303
+
304
+ /* invoked when fd is either EV_READable or EV_WRITEable */
305
+ /* revent EV_READ, EV_WRITE */
306
+ typedef struct ev_io
307
+ {
308
+ EV_WATCHER_LIST (ev_io)
309
+
310
+ int fd; /* ro */
311
+ int events; /* ro */
312
+ } ev_io;
313
+
314
+ /* invoked after a specific time, repeatable (based on monotonic clock) */
315
+ /* revent EV_TIMEOUT */
316
+ typedef struct ev_timer
317
+ {
318
+ EV_WATCHER_TIME (ev_timer)
319
+
320
+ ev_tstamp repeat; /* rw */
321
+ } ev_timer;
322
+
323
+ /* invoked at some specific time, possibly repeating at regular intervals (based on UTC) */
324
+ /* revent EV_PERIODIC */
325
+ typedef struct ev_periodic
326
+ {
327
+ EV_WATCHER_TIME (ev_periodic)
328
+
329
+ ev_tstamp offset; /* rw */
330
+ ev_tstamp interval; /* rw */
331
+ ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now); /* rw */
332
+ } ev_periodic;
333
+
334
+ /* invoked when the given signal has been received */
335
+ /* revent EV_SIGNAL */
336
+ typedef struct ev_signal
337
+ {
338
+ EV_WATCHER_LIST (ev_signal)
339
+
340
+ int signum; /* ro */
341
+ } ev_signal;
342
+
343
+ /* invoked when sigchld is received and waitpid indicates the given pid */
344
+ /* revent EV_CHILD */
345
+ /* does not support priorities */
346
+ typedef struct ev_child
347
+ {
348
+ EV_WATCHER_LIST (ev_child)
349
+
350
+ int flags; /* private */
351
+ int pid; /* ro */
352
+ int rpid; /* rw, holds the received pid */
353
+ int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */
354
+ } ev_child;
355
+
356
+ #if EV_STAT_ENABLE
357
+ /* st_nlink = 0 means missing file or other error */
358
+ # ifdef _WIN32
359
+ typedef struct _stati64 ev_statdata;
360
+ # else
361
+ typedef struct stat ev_statdata;
362
+ # endif
363
+
364
+ /* invoked each time the stat data changes for a given path */
365
+ /* revent EV_STAT */
366
+ typedef struct ev_stat
367
+ {
368
+ EV_WATCHER_LIST (ev_stat)
369
+
370
+ ev_timer timer; /* private */
371
+ ev_tstamp interval; /* ro */
372
+ const char *path; /* ro */
373
+ ev_statdata prev; /* ro */
374
+ ev_statdata attr; /* ro */
375
+
376
+ int wd; /* wd for inotify, fd for kqueue */
377
+ } ev_stat;
378
+ #endif
379
+
380
+ #if EV_IDLE_ENABLE
381
+ /* invoked when the nothing else needs to be done, keeps the process from blocking */
382
+ /* revent EV_IDLE */
383
+ typedef struct ev_idle
384
+ {
385
+ EV_WATCHER (ev_idle)
386
+ } ev_idle;
387
+ #endif
388
+
389
+ /* invoked for each run of the mainloop, just before the blocking call */
390
+ /* you can still change events in any way you like */
391
+ /* revent EV_PREPARE */
392
+ typedef struct ev_prepare
393
+ {
394
+ EV_WATCHER (ev_prepare)
395
+ } ev_prepare;
396
+
397
+ /* invoked for each run of the mainloop, just after the blocking call */
398
+ /* revent EV_CHECK */
399
+ typedef struct ev_check
400
+ {
401
+ EV_WATCHER (ev_check)
402
+ } ev_check;
403
+
404
+ #if EV_FORK_ENABLE
405
+ /* the callback gets invoked before check in the child process when a fork was detected */
406
+ /* revent EV_FORK */
407
+ typedef struct ev_fork
408
+ {
409
+ EV_WATCHER (ev_fork)
410
+ } ev_fork;
411
+ #endif
412
+
413
+ #if EV_CLEANUP_ENABLE
414
+ /* is invoked just before the loop gets destroyed */
415
+ /* revent EV_CLEANUP */
416
+ typedef struct ev_cleanup
417
+ {
418
+ EV_WATCHER (ev_cleanup)
419
+ } ev_cleanup;
420
+ #endif
421
+
422
+ #if EV_EMBED_ENABLE
423
+ /* used to embed an event loop inside another */
424
+ /* the callback gets invoked when the event loop has handled events, and can be 0 */
425
+ typedef struct ev_embed
426
+ {
427
+ EV_WATCHER (ev_embed)
428
+
429
+ struct ev_loop *other; /* ro */
430
+ ev_io io; /* private */
431
+ ev_prepare prepare; /* private */
432
+ ev_check check; /* unused */
433
+ ev_timer timer; /* unused */
434
+ ev_periodic periodic; /* unused */
435
+ ev_idle idle; /* unused */
436
+ ev_fork fork; /* private */
437
+ #if EV_CLEANUP_ENABLE
438
+ ev_cleanup cleanup; /* unused */
439
+ #endif
440
+ } ev_embed;
441
+ #endif
442
+
443
+ #if EV_ASYNC_ENABLE
444
+ /* invoked when somebody calls ev_async_send on the watcher */
445
+ /* revent EV_ASYNC */
446
+ typedef struct ev_async
447
+ {
448
+ EV_WATCHER (ev_async)
449
+
450
+ EV_ATOMIC_T sent; /* private */
451
+ } ev_async;
452
+
453
+ # define ev_async_pending(w) (+(w)->sent)
454
+ #endif
455
+
456
+ /* the presence of this union forces similar struct layout */
457
+ union ev_any_watcher
458
+ {
459
+ struct ev_watcher w;
460
+ struct ev_watcher_list wl;
461
+
462
+ struct ev_io io;
463
+ struct ev_timer timer;
464
+ struct ev_periodic periodic;
465
+ struct ev_signal signal;
466
+ struct ev_child child;
467
+ #if EV_STAT_ENABLE
468
+ struct ev_stat stat;
469
+ #endif
470
+ #if EV_IDLE_ENABLE
471
+ struct ev_idle idle;
472
+ #endif
473
+ struct ev_prepare prepare;
474
+ struct ev_check check;
475
+ #if EV_FORK_ENABLE
476
+ struct ev_fork fork;
477
+ #endif
478
+ #if EV_CLEANUP_ENABLE
479
+ struct ev_cleanup cleanup;
480
+ #endif
481
+ #if EV_EMBED_ENABLE
482
+ struct ev_embed embed;
483
+ #endif
484
+ #if EV_ASYNC_ENABLE
485
+ struct ev_async async;
486
+ #endif
487
+ };
488
+
489
+ /* flag bits for ev_default_loop and ev_loop_new */
490
+ enum {
491
+ /* the default */
492
+ EVFLAG_AUTO = 0x00000000U, /* not quite a mask */
493
+ /* flag bits */
494
+ EVFLAG_NOENV = 0x01000000U, /* do NOT consult environment */
495
+ EVFLAG_FORKCHECK = 0x02000000U, /* check for a fork in each iteration */
496
+ /* debugging/feature disable */
497
+ EVFLAG_NOINOTIFY = 0x00100000U, /* do not attempt to use inotify */
498
+ #if EV_COMPAT3
499
+ EVFLAG_NOSIGFD = 0, /* compatibility to pre-3.9 */
500
+ #endif
501
+ EVFLAG_SIGNALFD = 0x00200000U, /* attempt to use signalfd */
502
+ EVFLAG_NOSIGMASK = 0x00400000U /* avoid modifying the signal mask */
503
+ };
504
+
505
+ /* method bits to be ored together */
506
+ enum {
507
+ EVBACKEND_SELECT = 0x00000001U, /* about anywhere */
508
+ EVBACKEND_POLL = 0x00000002U, /* !win */
509
+ EVBACKEND_EPOLL = 0x00000004U, /* linux */
510
+ EVBACKEND_KQUEUE = 0x00000008U, /* bsd */
511
+ EVBACKEND_DEVPOLL = 0x00000010U, /* solaris 8 */ /* NYI */
512
+ EVBACKEND_PORT = 0x00000020U, /* solaris 10 */
513
+ EVBACKEND_ALL = 0x0000003FU, /* all known backends */
514
+ EVBACKEND_MASK = 0x0000FFFFU /* all future backends */
515
+ };
516
+
517
+ #if EV_PROTOTYPES
518
+ int ev_version_major (void);
519
+ int ev_version_minor (void);
520
+
521
+ unsigned int ev_supported_backends (void);
522
+ unsigned int ev_recommended_backends (void);
523
+ unsigned int ev_embeddable_backends (void);
524
+
525
+ ev_tstamp ev_time (void);
526
+ void ev_sleep (ev_tstamp delay); /* sleep for a while */
527
+
528
+ /* Sets the allocation function to use, works like realloc.
529
+ * It is used to allocate and free memory.
530
+ * If it returns zero when memory needs to be allocated, the library might abort
531
+ * or take some potentially destructive action.
532
+ * The default is your system realloc function.
533
+ */
534
+ void ev_set_allocator (void *(*cb)(void *ptr, long size));
535
+
536
+ /* set the callback function to call on a
537
+ * retryable syscall error
538
+ * (such as failed select, poll, epoll_wait)
539
+ */
540
+ void ev_set_syserr_cb (void (*cb)(const char *msg));
541
+
542
+ #if EV_MULTIPLICITY
543
+
544
+ /* the default loop is the only one that handles signals and child watchers */
545
+ /* you can call this as often as you like */
546
+ struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0));
547
+
548
+ EV_INLINE struct ev_loop *
549
+ EV_MAYBE_UNUSED ev_default_loop_uc_ (void)
550
+ {
551
+ extern struct ev_loop *ev_default_loop_ptr;
552
+
553
+ return ev_default_loop_ptr;
554
+ }
555
+
556
+ EV_INLINE int
557
+ EV_MAYBE_UNUSED ev_is_default_loop (EV_P)
558
+ {
559
+ return EV_A == EV_DEFAULT_UC;
560
+ }
561
+
562
+ /* create and destroy alternative loops that don't handle signals */
563
+ struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0));
564
+
565
+ int ev_loop_refcount (EV_P);
566
+
567
+ ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */
568
+
569
+ #else
570
+
571
+ int ev_default_loop (unsigned int flags EV_CPP (= 0)); /* returns true when successful */
572
+
573
+ EV_INLINE ev_tstamp
574
+ ev_now (void)
575
+ {
576
+ extern ev_tstamp ev_rt_now;
577
+
578
+ return ev_rt_now;
579
+ }
580
+
581
+ /* looks weird, but ev_is_default_loop (EV_A) still works if this exists */
582
+ EV_INLINE int
583
+ ev_is_default_loop (void)
584
+ {
585
+ return 1;
586
+ }
587
+
588
+ #endif /* multiplicity */
589
+
590
+ /* destroy event loops, also works for the default loop */
591
+ void ev_loop_destroy (EV_P);
592
+
593
+ /* this needs to be called after fork, to duplicate the loop */
594
+ /* when you want to re-use it in the child */
595
+ /* you can call it in either the parent or the child */
596
+ /* you can actually call it at any time, anywhere :) */
597
+ void ev_loop_fork (EV_P);
598
+
599
+ unsigned int ev_backend (EV_P); /* backend in use by loop */
600
+
601
+ void ev_now_update (EV_P); /* update event loop time */
602
+
603
+ #if EV_WALK_ENABLE
604
+ /* walk (almost) all watchers in the loop of a given type, invoking the */
605
+ /* callback on every such watcher. The callback might stop the watcher, */
606
+ /* but do nothing else with the loop */
607
+ void ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w));
608
+ #endif
609
+
610
+ #endif /* prototypes */
611
+
612
+ /* ev_run flags values */
613
+ enum {
614
+ EVRUN_NOWAIT = 1, /* do not block/wait */
615
+ EVRUN_ONCE = 2 /* block *once* only */
616
+ };
617
+
618
+ /* ev_break how values */
619
+ enum {
620
+ EVBREAK_CANCEL = 0, /* undo unloop */
621
+ EVBREAK_ONE = 1, /* unloop once */
622
+ EVBREAK_ALL = 2 /* unloop all loops */
623
+ };
624
+
625
+ #if EV_PROTOTYPES
626
+ void ev_run (EV_P_ int flags EV_CPP (= 0));
627
+ void ev_break (EV_P_ int how EV_CPP (= EVBREAK_ONE)); /* break out of the loop */
628
+
629
+ /*
630
+ * ref/unref can be used to add or remove a refcount on the mainloop. every watcher
631
+ * keeps one reference. if you have a long-running watcher you never unregister that
632
+ * should not keep ev_loop from running, unref() after starting, and ref() before stopping.
633
+ */
634
+ void ev_ref (EV_P);
635
+ void ev_unref (EV_P);
636
+
637
+ /*
638
+ * convenience function, wait for a single event, without registering an event watcher
639
+ * if timeout is < 0, do wait indefinitely
640
+ */
641
+ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg);
642
+
643
+ # if EV_FEATURE_API
644
+ unsigned int ev_iteration (EV_P); /* number of loop iterations */
645
+ unsigned int ev_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */
646
+ void ev_verify (EV_P); /* abort if loop data corrupted */
647
+
648
+ void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
649
+ void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
650
+
651
+ /* advanced stuff for threading etc. support, see docs */
652
+ void ev_set_userdata (EV_P_ void *data);
653
+ void *ev_userdata (EV_P);
654
+ void ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P));
655
+ void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P));
656
+
657
+ unsigned int ev_pending_count (EV_P); /* number of pending events, if any */
658
+ void ev_invoke_pending (EV_P); /* invoke all pending watchers */
659
+
660
+ /*
661
+ * stop/start the timer handling.
662
+ */
663
+ void ev_suspend (EV_P);
664
+ void ev_resume (EV_P);
665
+ #endif
666
+
667
+ #endif
668
+
669
+ /* these may evaluate ev multiple times, and the other arguments at most once */
670
+ /* either use ev_init + ev_TYPE_set, or the ev_TYPE_init macro, below, to first initialise a watcher */
671
+ #define ev_init(ev,cb_) do { \
672
+ ((ev_watcher *)(void *)(ev))->active = \
673
+ ((ev_watcher *)(void *)(ev))->pending = 0; \
674
+ ev_set_priority ((ev), 0); \
675
+ ev_set_cb ((ev), cb_); \
676
+ } while (0)
677
+
678
+ #define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_) | EV__IOFDSET; } while (0)
679
+ #define ev_timer_set(ev,after_,repeat_) do { ((ev_watcher_time *)(ev))->at = (after_); (ev)->repeat = (repeat_); } while (0)
680
+ #define ev_periodic_set(ev,ofs_,ival_,rcb_) do { (ev)->offset = (ofs_); (ev)->interval = (ival_); (ev)->reschedule_cb = (rcb_); } while (0)
681
+ #define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0)
682
+ #define ev_child_set(ev,pid_,trace_) do { (ev)->pid = (pid_); (ev)->flags = !!(trace_); } while (0)
683
+ #define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); (ev)->wd = -2; } while (0)
684
+ #define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */
685
+ #define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */
686
+ #define ev_check_set(ev) /* nop, yes, this is a serious in-joke */
687
+ #define ev_embed_set(ev,other_) do { (ev)->other = (other_); } while (0)
688
+ #define ev_fork_set(ev) /* nop, yes, this is a serious in-joke */
689
+ #define ev_cleanup_set(ev) /* nop, yes, this is a serious in-joke */
690
+ #define ev_async_set(ev) /* nop, yes, this is a serious in-joke */
691
+
692
+ #define ev_io_init(ev,cb,fd,events) do { ev_init ((ev), (cb)); ev_io_set ((ev),(fd),(events)); } while (0)
693
+ #define ev_timer_init(ev,cb,after,repeat) do { ev_init ((ev), (cb)); ev_timer_set ((ev),(after),(repeat)); } while (0)
694
+ #define ev_periodic_init(ev,cb,ofs,ival,rcb) do { ev_init ((ev), (cb)); ev_periodic_set ((ev),(ofs),(ival),(rcb)); } while (0)
695
+ #define ev_signal_init(ev,cb,signum) do { ev_init ((ev), (cb)); ev_signal_set ((ev), (signum)); } while (0)
696
+ #define ev_child_init(ev,cb,pid,trace) do { ev_init ((ev), (cb)); ev_child_set ((ev),(pid),(trace)); } while (0)
697
+ #define ev_stat_init(ev,cb,path,interval) do { ev_init ((ev), (cb)); ev_stat_set ((ev),(path),(interval)); } while (0)
698
+ #define ev_idle_init(ev,cb) do { ev_init ((ev), (cb)); ev_idle_set ((ev)); } while (0)
699
+ #define ev_prepare_init(ev,cb) do { ev_init ((ev), (cb)); ev_prepare_set ((ev)); } while (0)
700
+ #define ev_check_init(ev,cb) do { ev_init ((ev), (cb)); ev_check_set ((ev)); } while (0)
701
+ #define ev_embed_init(ev,cb,other) do { ev_init ((ev), (cb)); ev_embed_set ((ev),(other)); } while (0)
702
+ #define ev_fork_init(ev,cb) do { ev_init ((ev), (cb)); ev_fork_set ((ev)); } while (0)
703
+ #define ev_cleanup_init(ev,cb) do { ev_init ((ev), (cb)); ev_cleanup_set ((ev)); } while (0)
704
+ #define ev_async_init(ev,cb) do { ev_init ((ev), (cb)); ev_async_set ((ev)); } while (0)
705
+
706
+ #define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */
707
+ #define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */
708
+
709
+ #define ev_cb(ev) (ev)->cb /* rw */
710
+
711
+ #if EV_MINPRI == EV_MAXPRI
712
+ # define ev_priority(ev) ((ev), EV_MINPRI)
713
+ # define ev_set_priority(ev,pri) ((ev), (pri))
714
+ #else
715
+ # define ev_priority(ev) (+(((ev_watcher *)(void *)(ev))->priority))
716
+ # define ev_set_priority(ev,pri) ( (ev_watcher *)(void *)(ev))->priority = (pri)
717
+ #endif
718
+
719
+ #define ev_periodic_at(ev) (+((ev_watcher_time *)(ev))->at)
720
+
721
+ #ifndef ev_set_cb
722
+ # define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_)
723
+ #endif
724
+
725
+ /* stopping (enabling, adding) a watcher does nothing if it is already running */
726
+ /* stopping (disabling, deleting) a watcher does nothing unless its already running */
727
+ #if EV_PROTOTYPES
728
+
729
+ /* feeds an event into a watcher as if the event actually occured */
730
+ /* accepts any ev_watcher type */
731
+ void ev_feed_event (EV_P_ void *w, int revents);
732
+ void ev_feed_fd_event (EV_P_ int fd, int revents);
733
+ #if EV_SIGNAL_ENABLE
734
+ void ev_feed_signal (int signum);
735
+ void ev_feed_signal_event (EV_P_ int signum);
736
+ #endif
737
+ void ev_invoke (EV_P_ void *w, int revents);
738
+ int ev_clear_pending (EV_P_ void *w);
739
+
740
+ void ev_io_start (EV_P_ ev_io *w);
741
+ void ev_io_stop (EV_P_ ev_io *w);
742
+
743
+ void ev_timer_start (EV_P_ ev_timer *w);
744
+ void ev_timer_stop (EV_P_ ev_timer *w);
745
+ /* stops if active and no repeat, restarts if active and repeating, starts if inactive and repeating */
746
+ void ev_timer_again (EV_P_ ev_timer *w);
747
+ /* return remaining time */
748
+ ev_tstamp ev_timer_remaining (EV_P_ ev_timer *w);
749
+
750
+ #if EV_PERIODIC_ENABLE
751
+ void ev_periodic_start (EV_P_ ev_periodic *w);
752
+ void ev_periodic_stop (EV_P_ ev_periodic *w);
753
+ void ev_periodic_again (EV_P_ ev_periodic *w);
754
+ #endif
755
+
756
+ /* only supported in the default loop */
757
+ #if EV_SIGNAL_ENABLE
758
+ void ev_signal_start (EV_P_ ev_signal *w);
759
+ void ev_signal_stop (EV_P_ ev_signal *w);
760
+ #endif
761
+
762
+ /* only supported in the default loop */
763
+ # if EV_CHILD_ENABLE
764
+ void ev_child_start (EV_P_ ev_child *w);
765
+ void ev_child_stop (EV_P_ ev_child *w);
766
+ # endif
767
+
768
+ # if EV_STAT_ENABLE
769
+ void ev_stat_start (EV_P_ ev_stat *w);
770
+ void ev_stat_stop (EV_P_ ev_stat *w);
771
+ void ev_stat_stat (EV_P_ ev_stat *w);
772
+ # endif
773
+
774
+ # if EV_IDLE_ENABLE
775
+ void ev_idle_start (EV_P_ ev_idle *w);
776
+ void ev_idle_stop (EV_P_ ev_idle *w);
777
+ # endif
778
+
779
+ #if EV_PREPARE_ENABLE
780
+ void ev_prepare_start (EV_P_ ev_prepare *w);
781
+ void ev_prepare_stop (EV_P_ ev_prepare *w);
782
+ #endif
783
+
784
+ #if EV_CHECK_ENABLE
785
+ void ev_check_start (EV_P_ ev_check *w);
786
+ void ev_check_stop (EV_P_ ev_check *w);
787
+ #endif
788
+
789
+ # if EV_FORK_ENABLE
790
+ void ev_fork_start (EV_P_ ev_fork *w);
791
+ void ev_fork_stop (EV_P_ ev_fork *w);
792
+ # endif
793
+
794
+ # if EV_CLEANUP_ENABLE
795
+ void ev_cleanup_start (EV_P_ ev_cleanup *w);
796
+ void ev_cleanup_stop (EV_P_ ev_cleanup *w);
797
+ # endif
798
+
799
+ # if EV_EMBED_ENABLE
800
+ /* only supported when loop to be embedded is in fact embeddable */
801
+ void ev_embed_start (EV_P_ ev_embed *w);
802
+ void ev_embed_stop (EV_P_ ev_embed *w);
803
+ void ev_embed_sweep (EV_P_ ev_embed *w);
804
+ # endif
805
+
806
+ # if EV_ASYNC_ENABLE
807
+ void ev_async_start (EV_P_ ev_async *w);
808
+ void ev_async_stop (EV_P_ ev_async *w);
809
+ void ev_async_send (EV_P_ ev_async *w);
810
+ # endif
811
+
812
+ #if EV_COMPAT3
813
+ #define EVLOOP_NONBLOCK EVRUN_NOWAIT
814
+ #define EVLOOP_ONESHOT EVRUN_ONCE
815
+ #define EVUNLOOP_CANCEL EVBREAK_CANCEL
816
+ #define EVUNLOOP_ONE EVBREAK_ONE
817
+ #define EVUNLOOP_ALL EVBREAK_ALL
818
+ #if EV_PROTOTYPES
819
+ EV_INLINE void EV_MAYBE_UNUSED ev_loop (EV_P_ int flags) { ev_run (EV_A_ flags); }
820
+ EV_INLINE void EV_MAYBE_UNUSED ev_unloop (EV_P_ int how ) { ev_break (EV_A_ how ); }
821
+ EV_INLINE void EV_MAYBE_UNUSED ev_default_destroy (void) { ev_loop_destroy (EV_DEFAULT); }
822
+ EV_INLINE void EV_MAYBE_UNUSED ev_default_fork (void) { ev_loop_fork (EV_DEFAULT); }
823
+ #if EV_FEATURE_API
824
+ EV_INLINE unsigned int EV_MAYBE_UNUSED ev_loop_count (EV_P) { return ev_iteration (EV_A); }
825
+ EV_INLINE unsigned int EV_MAYBE_UNUSED ev_loop_depth (EV_P) { return ev_depth (EV_A); }
826
+ EV_INLINE void EV_MAYBE_UNUSED ev_loop_verify (EV_P) { ev_verify (EV_A); }
827
+ #endif
828
+ #endif
829
+ #else
830
+ typedef struct ev_loop ev_loop;
831
+ #endif
832
+
833
+ #endif
834
+
835
+ EV_CPP(})
836
+
837
+ #endif
838
+