asyncengine 0.0.1.testing
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.
- data/README.markdown +0 -0
- data/asyncengine.gemspec +26 -0
- data/ext/asyncengine_ext/asyncengine_ruby.c +82 -0
- data/ext/asyncengine_ext/extconf.rb +47 -0
- data/ext/asyncengine_ext/libuv/AUTHORS +45 -0
- data/ext/asyncengine_ext/libuv/LICENSE +42 -0
- data/ext/asyncengine_ext/libuv/Makefile +119 -0
- data/ext/asyncengine_ext/libuv/README.md +88 -0
- data/ext/asyncengine_ext/libuv/build/gcc_version.py +20 -0
- data/ext/asyncengine_ext/libuv/common.gypi +176 -0
- data/ext/asyncengine_ext/libuv/config-mingw.mk +61 -0
- data/ext/asyncengine_ext/libuv/config-unix.mk +173 -0
- data/ext/asyncengine_ext/libuv/gyp_uv +60 -0
- data/ext/asyncengine_ext/libuv/include/ares.h +591 -0
- data/ext/asyncengine_ext/libuv/include/ares_version.h +24 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/eio.h +403 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/ev.h +838 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/ngx-queue.h +106 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/tree.h +768 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/uv-unix.h +256 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/uv-win.h +458 -0
- data/ext/asyncengine_ext/libuv/include/uv.h +1556 -0
- data/ext/asyncengine_ext/libuv/src/ares/AUTHORS +37 -0
- data/ext/asyncengine_ext/libuv/src/ares/CHANGES +1218 -0
- data/ext/asyncengine_ext/libuv/src/ares/CMakeLists.txt +22 -0
- data/ext/asyncengine_ext/libuv/src/ares/NEWS +21 -0
- data/ext/asyncengine_ext/libuv/src/ares/README +60 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.cares +13 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.msvc +142 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.node +21 -0
- data/ext/asyncengine_ext/libuv/src/ares/RELEASE-NOTES +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/TODO +23 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__close_sockets.c +66 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__get_hostent.c +263 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__read_line.c +71 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__timeval.c +111 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_cancel.c +63 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_data.c +190 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_data.h +65 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_destroy.c +105 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_dns.h +90 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_expand_name.c +200 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_expand_string.c +75 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_fds.c +63 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_free_hostent.c +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_free_string.c +25 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.c +30 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyaddr.c +301 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyname.c +523 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getnameinfo.c +427 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.c +122 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.h +53 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getsock.c +72 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_init.c +1809 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_iphlpapi.h +221 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_ipv6.h +78 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.c +142 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.h +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_llist.c +86 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_llist.h +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_mkquery.c +195 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.c +181 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.h +55 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_options.c +248 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_a_reply.c +263 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_aaaa_reply.c +259 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_mx_reply.c +170 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ns_reply.c +182 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ptr_reply.c +217 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_srv_reply.c +179 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_txt_reply.c +201 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_platform.c +11035 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_platform.h +43 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_private.h +355 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_process.c +1295 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_query.c +183 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_rules.h +144 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_search.c +321 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_send.c +134 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_setup.h +199 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.c +66 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.h +30 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.c +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strerror.c +56 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_timeout.c +80 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_version.c +11 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_writev.c +79 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_writev.h +36 -0
- data/ext/asyncengine_ext/libuv/src/ares/bitncmp.c +59 -0
- data/ext/asyncengine_ext/libuv/src/ares/bitncmp.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_cygwin/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_darwin/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_freebsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_linux/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_netbsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_openbsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_sunos/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_win32/ares_config.h +369 -0
- data/ext/asyncengine_ext/libuv/src/ares/get_ver.awk +35 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.c +451 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.h +31 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.c +208 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/nameser.h +203 -0
- data/ext/asyncengine_ext/libuv/src/ares/setup_once.h +504 -0
- data/ext/asyncengine_ext/libuv/src/ares/windows_port.c +22 -0
- data/ext/asyncengine_ext/libuv/src/unix/async.c +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/cares.c +194 -0
- data/ext/asyncengine_ext/libuv/src/unix/check.c +80 -0
- data/ext/asyncengine_ext/libuv/src/unix/core.c +588 -0
- data/ext/asyncengine_ext/libuv/src/unix/cygwin.c +84 -0
- data/ext/asyncengine_ext/libuv/src/unix/darwin.c +341 -0
- data/ext/asyncengine_ext/libuv/src/unix/dl.c +91 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/Changes +63 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/LICENSE +36 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/Makefile.am +15 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/aclocal.m4 +8957 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/autogen.sh +3 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config.h.in +86 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_cygwin.h +80 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_darwin.h +141 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_freebsd.h +81 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_linux.h +94 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_netbsd.h +81 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_openbsd.h +137 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_sunos.h +84 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/configure.ac +22 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/demo.c +194 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/ecb.h +370 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.3 +3428 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.c +2593 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.pod +969 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/libeio.m4 +195 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/xthread.h +164 -0
- data/ext/asyncengine_ext/libuv/src/unix/error.c +98 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Changes +388 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/LICENSE +36 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.am +18 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.in +771 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/README +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/aclocal.m4 +8957 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/autogen.sh +6 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.guess +1526 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.h.in +125 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.sub +1658 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_cygwin.h +123 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_darwin.h +122 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_freebsd.h +120 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_linux.h +141 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_netbsd.h +120 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_openbsd.h +126 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_sunos.h +122 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/configure +13037 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/configure.ac +18 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/depcomp +630 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev++.h +816 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.3 +5311 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.c +3921 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.pod +5243 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_epoll.c +266 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_kqueue.c +235 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_poll.c +148 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_port.c +179 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_select.c +310 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_vars.h +203 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_win32.c +153 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_wrap.h +196 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/event.c +402 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/event.h +170 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/install-sh +294 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/libev.m4 +39 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ltmain.sh +8413 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/missing +336 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/mkinstalldirs +111 -0
- data/ext/asyncengine_ext/libuv/src/unix/freebsd.c +312 -0
- data/ext/asyncengine_ext/libuv/src/unix/fs.c +707 -0
- data/ext/asyncengine_ext/libuv/src/unix/idle.c +79 -0
- data/ext/asyncengine_ext/libuv/src/unix/internal.h +161 -0
- data/ext/asyncengine_ext/libuv/src/unix/kqueue.c +127 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/core.c +474 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/inotify.c +211 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.c +230 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.h +87 -0
- data/ext/asyncengine_ext/libuv/src/unix/loop.c +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/netbsd.c +108 -0
- data/ext/asyncengine_ext/libuv/src/unix/openbsd.c +295 -0
- data/ext/asyncengine_ext/libuv/src/unix/pipe.c +266 -0
- data/ext/asyncengine_ext/libuv/src/unix/prepare.c +79 -0
- data/ext/asyncengine_ext/libuv/src/unix/process.c +369 -0
- data/ext/asyncengine_ext/libuv/src/unix/stream.c +1033 -0
- data/ext/asyncengine_ext/libuv/src/unix/sunos.c +466 -0
- data/ext/asyncengine_ext/libuv/src/unix/tcp.c +327 -0
- data/ext/asyncengine_ext/libuv/src/unix/thread.c +154 -0
- data/ext/asyncengine_ext/libuv/src/unix/timer.c +127 -0
- data/ext/asyncengine_ext/libuv/src/unix/tty.c +146 -0
- data/ext/asyncengine_ext/libuv/src/unix/udp.c +670 -0
- data/ext/asyncengine_ext/libuv/src/unix/uv-eio.c +124 -0
- data/ext/asyncengine_ext/libuv/src/unix/uv-eio.h +13 -0
- data/ext/asyncengine_ext/libuv/src/uv-common.c +354 -0
- data/ext/asyncengine_ext/libuv/src/uv-common.h +87 -0
- data/ext/asyncengine_ext/libuv/src/win/async.c +127 -0
- data/ext/asyncengine_ext/libuv/src/win/cares.c +290 -0
- data/ext/asyncengine_ext/libuv/src/win/core.c +270 -0
- data/ext/asyncengine_ext/libuv/src/win/dl.c +82 -0
- data/ext/asyncengine_ext/libuv/src/win/error.c +132 -0
- data/ext/asyncengine_ext/libuv/src/win/fs-event.c +514 -0
- data/ext/asyncengine_ext/libuv/src/win/fs.c +1576 -0
- data/ext/asyncengine_ext/libuv/src/win/getaddrinfo.c +372 -0
- data/ext/asyncengine_ext/libuv/src/win/handle.c +225 -0
- data/ext/asyncengine_ext/libuv/src/win/internal.h +352 -0
- data/ext/asyncengine_ext/libuv/src/win/loop-watcher.c +131 -0
- data/ext/asyncengine_ext/libuv/src/win/pipe.c +1661 -0
- data/ext/asyncengine_ext/libuv/src/win/process.c +1140 -0
- data/ext/asyncengine_ext/libuv/src/win/req.c +174 -0
- data/ext/asyncengine_ext/libuv/src/win/stream.c +201 -0
- data/ext/asyncengine_ext/libuv/src/win/tcp.c +1282 -0
- data/ext/asyncengine_ext/libuv/src/win/thread.c +332 -0
- data/ext/asyncengine_ext/libuv/src/win/threadpool.c +73 -0
- data/ext/asyncengine_ext/libuv/src/win/timer.c +276 -0
- data/ext/asyncengine_ext/libuv/src/win/tty.c +1795 -0
- data/ext/asyncengine_ext/libuv/src/win/udp.c +709 -0
- data/ext/asyncengine_ext/libuv/src/win/util.c +719 -0
- data/ext/asyncengine_ext/libuv/src/win/winapi.c +117 -0
- data/ext/asyncengine_ext/libuv/src/win/winapi.h +4419 -0
- data/ext/asyncengine_ext/libuv/src/win/winsock.c +470 -0
- data/ext/asyncengine_ext/libuv/src/win/winsock.h +138 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-ares.c +118 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-getaddrinfo.c +94 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-list.h +105 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-ping-pongs.c +213 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-pound.c +324 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-pump.c +462 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-sizes.c +40 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-spawn.c +156 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-tcp-write-batch.c +140 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-thread.c +64 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-udp-packet-storm.c +247 -0
- data/ext/asyncengine_ext/libuv/test/blackhole-server.c +118 -0
- data/ext/asyncengine_ext/libuv/test/dns-server.c +321 -0
- data/ext/asyncengine_ext/libuv/test/echo-server.c +370 -0
- data/ext/asyncengine_ext/libuv/test/fixtures/empty_file +0 -0
- data/ext/asyncengine_ext/libuv/test/fixtures/load_error.node +1 -0
- data/ext/asyncengine_ext/libuv/test/run-benchmarks.c +64 -0
- data/ext/asyncengine_ext/libuv/test/run-tests.c +108 -0
- data/ext/asyncengine_ext/libuv/test/runner-unix.c +315 -0
- data/ext/asyncengine_ext/libuv/test/runner-unix.h +36 -0
- data/ext/asyncengine_ext/libuv/test/runner-win.c +343 -0
- data/ext/asyncengine_ext/libuv/test/runner-win.h +42 -0
- data/ext/asyncengine_ext/libuv/test/runner.c +317 -0
- data/ext/asyncengine_ext/libuv/test/runner.h +159 -0
- data/ext/asyncengine_ext/libuv/test/task.h +117 -0
- data/ext/asyncengine_ext/libuv/test/test-async.c +216 -0
- data/ext/asyncengine_ext/libuv/test/test-callback-stack.c +203 -0
- data/ext/asyncengine_ext/libuv/test/test-connection-fail.c +148 -0
- data/ext/asyncengine_ext/libuv/test/test-counters-init.c +216 -0
- data/ext/asyncengine_ext/libuv/test/test-cwd-and-chdir.c +64 -0
- data/ext/asyncengine_ext/libuv/test/test-delayed-accept.c +197 -0
- data/ext/asyncengine_ext/libuv/test/test-dlerror.c +49 -0
- data/ext/asyncengine_ext/libuv/test/test-eio-overflow.c +90 -0
- data/ext/asyncengine_ext/libuv/test/test-error.c +59 -0
- data/ext/asyncengine_ext/libuv/test/test-fail-always.c +29 -0
- data/ext/asyncengine_ext/libuv/test/test-fs-event.c +442 -0
- data/ext/asyncengine_ext/libuv/test/test-fs.c +1731 -0
- data/ext/asyncengine_ext/libuv/test/test-get-currentexe.c +63 -0
- data/ext/asyncengine_ext/libuv/test/test-get-loadavg.c +36 -0
- data/ext/asyncengine_ext/libuv/test/test-get-memory.c +38 -0
- data/ext/asyncengine_ext/libuv/test/test-getaddrinfo.c +122 -0
- data/ext/asyncengine_ext/libuv/test/test-gethostbyname.c +189 -0
- data/ext/asyncengine_ext/libuv/test/test-getsockname.c +342 -0
- data/ext/asyncengine_ext/libuv/test/test-hrtime.c +51 -0
- data/ext/asyncengine_ext/libuv/test/test-idle.c +81 -0
- data/ext/asyncengine_ext/libuv/test/test-ipc-send-recv.c +209 -0
- data/ext/asyncengine_ext/libuv/test/test-ipc.c +614 -0
- data/ext/asyncengine_ext/libuv/test/test-list.h +371 -0
- data/ext/asyncengine_ext/libuv/test/test-loop-handles.c +359 -0
- data/ext/asyncengine_ext/libuv/test/test-multiple-listen.c +102 -0
- data/ext/asyncengine_ext/libuv/test/test-mutexes.c +63 -0
- data/ext/asyncengine_ext/libuv/test/test-pass-always.c +28 -0
- data/ext/asyncengine_ext/libuv/test/test-ping-pong.c +253 -0
- data/ext/asyncengine_ext/libuv/test/test-pipe-bind-error.c +140 -0
- data/ext/asyncengine_ext/libuv/test/test-pipe-connect-error.c +96 -0
- data/ext/asyncengine_ext/libuv/test/test-platform-output.c +87 -0
- data/ext/asyncengine_ext/libuv/test/test-process-title.c +42 -0
- data/ext/asyncengine_ext/libuv/test/test-ref.c +322 -0
- data/ext/asyncengine_ext/libuv/test/test-run-once.c +44 -0
- data/ext/asyncengine_ext/libuv/test/test-shutdown-close.c +103 -0
- data/ext/asyncengine_ext/libuv/test/test-shutdown-eof.c +183 -0
- data/ext/asyncengine_ext/libuv/test/test-spawn.c +499 -0
- data/ext/asyncengine_ext/libuv/test/test-stdio-over-pipes.c +256 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-bind-error.c +191 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-bind6-error.c +154 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-close.c +129 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-connect-error.c +70 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-connect6-error.c +68 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-flags.c +51 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-write-error.c +168 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-write-to-half-open-connection.c +135 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-writealot.c +195 -0
- data/ext/asyncengine_ext/libuv/test/test-thread.c +183 -0
- data/ext/asyncengine_ext/libuv/test/test-threadpool.c +57 -0
- data/ext/asyncengine_ext/libuv/test/test-timer-again.c +141 -0
- data/ext/asyncengine_ext/libuv/test/test-timer.c +130 -0
- data/ext/asyncengine_ext/libuv/test/test-tty.c +110 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-dgram-too-big.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-ipv6.c +156 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-multicast-join.c +139 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-multicast-ttl.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-options.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-send-and-recv.c +208 -0
- data/ext/asyncengine_ext/libuv/test/test-util.c +97 -0
- data/ext/asyncengine_ext/libuv/uv.gyp +435 -0
- data/ext/asyncengine_ext/libuv/vcbuild.bat +105 -0
- data/lib/asyncengine/version.rb +3 -0
- data/lib/asyncengine.rb +41 -0
- metadata +384 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
/* config.h. Generated from config.h.in by configure. */
|
2
|
+
/* config.h.in. Generated from configure.ac by autoheader. */
|
3
|
+
|
4
|
+
/* Define to 1 if you have the <dlfcn.h> header file. */
|
5
|
+
#define HAVE_DLFCN_H 1
|
6
|
+
|
7
|
+
/* fdatasync(2) is available */
|
8
|
+
#define HAVE_FDATASYNC 1
|
9
|
+
|
10
|
+
/* utimes(2) is available */
|
11
|
+
#define HAVE_UTIMES 1
|
12
|
+
|
13
|
+
/* futimes(2) is available */
|
14
|
+
#define HAVE_FUTIMES 1
|
15
|
+
|
16
|
+
/* Define to 1 if you have the <inttypes.h> header file. */
|
17
|
+
#define HAVE_INTTYPES_H 1
|
18
|
+
|
19
|
+
/* Define to 1 if you have the <memory.h> header file. */
|
20
|
+
#define HAVE_MEMORY_H 1
|
21
|
+
|
22
|
+
/* pread(2) and pwrite(2) are available */
|
23
|
+
#define HAVE_PREADWRITE 1
|
24
|
+
|
25
|
+
/* readahead(2) is available (linux) */
|
26
|
+
/* #undef HAVE_READAHEAD */
|
27
|
+
|
28
|
+
/* sendfile(2) is available and supported */
|
29
|
+
/* #undef HAVE_SENDFILE */
|
30
|
+
|
31
|
+
/* Define to 1 if you have the <stdint.h> header file. */
|
32
|
+
#define HAVE_STDINT_H 1
|
33
|
+
|
34
|
+
/* Define to 1 if you have the <stdlib.h> header file. */
|
35
|
+
#define HAVE_STDLIB_H 1
|
36
|
+
|
37
|
+
/* Define to 1 if you have the <strings.h> header file. */
|
38
|
+
#define HAVE_STRINGS_H 1
|
39
|
+
|
40
|
+
/* Define to 1 if you have the <string.h> header file. */
|
41
|
+
#define HAVE_STRING_H 1
|
42
|
+
|
43
|
+
/* sync_file_range(2) is available */
|
44
|
+
/* #undef HAVE_SYNC_FILE_RANGE */
|
45
|
+
|
46
|
+
/* Define to 1 if you have the <sys/stat.h> header file. */
|
47
|
+
#define HAVE_SYS_STAT_H 1
|
48
|
+
|
49
|
+
/* Define to 1 if you have the <sys/types.h> header file. */
|
50
|
+
#define HAVE_SYS_TYPES_H 1
|
51
|
+
|
52
|
+
/* Define to 1 if you have the <unistd.h> header file. */
|
53
|
+
#define HAVE_UNISTD_H 1
|
54
|
+
|
55
|
+
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
56
|
+
*/
|
57
|
+
#define LT_OBJDIR ".libs/"
|
58
|
+
|
59
|
+
/* Name of package */
|
60
|
+
#define PACKAGE "libeio"
|
61
|
+
|
62
|
+
/* Define to the address where bug reports for this package should be sent. */
|
63
|
+
#define PACKAGE_BUGREPORT ""
|
64
|
+
|
65
|
+
/* Define to the full name of this package. */
|
66
|
+
#define PACKAGE_NAME ""
|
67
|
+
|
68
|
+
/* Define to the full name and version of this package. */
|
69
|
+
#define PACKAGE_STRING ""
|
70
|
+
|
71
|
+
/* Define to the one symbol short name of this package. */
|
72
|
+
#define PACKAGE_TARNAME ""
|
73
|
+
|
74
|
+
/* Define to the home page for this package. */
|
75
|
+
#define PACKAGE_URL ""
|
76
|
+
|
77
|
+
/* Define to the version of this package. */
|
78
|
+
#define PACKAGE_VERSION ""
|
79
|
+
|
80
|
+
/* Define to 1 if you have the ANSI C header files. */
|
81
|
+
#define STDC_HEADERS 1
|
82
|
+
|
83
|
+
/* Version number of package */
|
84
|
+
#define VERSION "1.0"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
AC_PREREQ(2.59)
|
2
|
+
AC_INIT
|
3
|
+
AC_CONFIG_SRCDIR([eio.h])
|
4
|
+
AC_CONFIG_HEADERS([config.h])
|
5
|
+
|
6
|
+
AM_INIT_AUTOMAKE(libeio,1.0)
|
7
|
+
AM_MAINTAINER_MODE
|
8
|
+
|
9
|
+
AC_GNU_SOURCE
|
10
|
+
|
11
|
+
AC_PROG_LIBTOOL
|
12
|
+
|
13
|
+
AC_PROG_CC
|
14
|
+
|
15
|
+
if test "x$GCC" = xyes ; then
|
16
|
+
CFLAGS="-O3 $CFLAGS"
|
17
|
+
fi
|
18
|
+
|
19
|
+
m4_include([libeio.m4])
|
20
|
+
|
21
|
+
AC_CONFIG_FILES([Makefile])
|
22
|
+
AC_OUTPUT
|
@@ -0,0 +1,194 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <stdlib.h>
|
3
|
+
#include <unistd.h>
|
4
|
+
#include <poll.h>
|
5
|
+
#include <string.h>
|
6
|
+
#include <assert.h>
|
7
|
+
#include <fcntl.h>
|
8
|
+
#include <sys/types.h>
|
9
|
+
#include <sys/stat.h>
|
10
|
+
|
11
|
+
#include "eio.h"
|
12
|
+
|
13
|
+
int respipe [2];
|
14
|
+
|
15
|
+
void
|
16
|
+
want_poll (void)
|
17
|
+
{
|
18
|
+
char dummy;
|
19
|
+
printf ("want_poll ()\n");
|
20
|
+
write (respipe [1], &dummy, 1);
|
21
|
+
}
|
22
|
+
|
23
|
+
void
|
24
|
+
done_poll (void)
|
25
|
+
{
|
26
|
+
char dummy;
|
27
|
+
printf ("done_poll ()\n");
|
28
|
+
read (respipe [0], &dummy, 1);
|
29
|
+
}
|
30
|
+
|
31
|
+
void
|
32
|
+
event_loop (void)
|
33
|
+
{
|
34
|
+
// an event loop. yeah.
|
35
|
+
struct pollfd pfd;
|
36
|
+
pfd.fd = respipe [0];
|
37
|
+
pfd.events = POLLIN;
|
38
|
+
|
39
|
+
printf ("\nentering event loop\n");
|
40
|
+
while (eio_nreqs ())
|
41
|
+
{
|
42
|
+
poll (&pfd, 1, -1);
|
43
|
+
printf ("eio_poll () = %d\n", eio_poll ());
|
44
|
+
}
|
45
|
+
printf ("leaving event loop\n");
|
46
|
+
}
|
47
|
+
|
48
|
+
int
|
49
|
+
res_cb (eio_req *req)
|
50
|
+
{
|
51
|
+
printf ("res_cb(%d|%s) = %d\n", req->type, req->data ? req->data : "?", EIO_RESULT (req));
|
52
|
+
|
53
|
+
if (req->result < 0)
|
54
|
+
abort ();
|
55
|
+
|
56
|
+
return 0;
|
57
|
+
}
|
58
|
+
|
59
|
+
int
|
60
|
+
readdir_cb (eio_req *req)
|
61
|
+
{
|
62
|
+
char *buf = (char *)EIO_BUF (req);
|
63
|
+
|
64
|
+
printf ("readdir_cb = %d\n", EIO_RESULT (req));
|
65
|
+
|
66
|
+
if (EIO_RESULT (req) < 0)
|
67
|
+
return 0;
|
68
|
+
|
69
|
+
while (EIO_RESULT (req)--)
|
70
|
+
{
|
71
|
+
printf ("readdir = <%s>\n", buf);
|
72
|
+
buf += strlen (buf) + 1;
|
73
|
+
}
|
74
|
+
|
75
|
+
return 0;
|
76
|
+
}
|
77
|
+
|
78
|
+
int
|
79
|
+
stat_cb (eio_req *req)
|
80
|
+
{
|
81
|
+
struct stat *buf = EIO_STAT_BUF (req);
|
82
|
+
|
83
|
+
if (req->type == EIO_FSTAT)
|
84
|
+
printf ("fstat_cb = %d\n", EIO_RESULT (req));
|
85
|
+
else
|
86
|
+
printf ("stat_cb(%s) = %d\n", EIO_PATH (req), EIO_RESULT (req));
|
87
|
+
|
88
|
+
if (!EIO_RESULT (req))
|
89
|
+
printf ("stat size %d perm 0%o\n", buf->st_size, buf->st_mode & 0777);
|
90
|
+
|
91
|
+
return 0;
|
92
|
+
}
|
93
|
+
|
94
|
+
int
|
95
|
+
read_cb (eio_req *req)
|
96
|
+
{
|
97
|
+
unsigned char *buf = (unsigned char *)EIO_BUF (req);
|
98
|
+
|
99
|
+
printf ("read_cb = %d (%02x%02x%02x%02x %02x%02x%02x%02x)\n",
|
100
|
+
EIO_RESULT (req),
|
101
|
+
buf [0], buf [1], buf [2], buf [3],
|
102
|
+
buf [4], buf [5], buf [6], buf [7]);
|
103
|
+
|
104
|
+
return 0;
|
105
|
+
}
|
106
|
+
|
107
|
+
int last_fd;
|
108
|
+
|
109
|
+
int
|
110
|
+
open_cb (eio_req *req)
|
111
|
+
{
|
112
|
+
printf ("open_cb = %d\n", EIO_RESULT (req));
|
113
|
+
|
114
|
+
last_fd = EIO_RESULT (req);
|
115
|
+
|
116
|
+
return 0;
|
117
|
+
}
|
118
|
+
|
119
|
+
int
|
120
|
+
main (void)
|
121
|
+
{
|
122
|
+
printf ("pipe ()\n");
|
123
|
+
if (pipe (respipe)) abort ();
|
124
|
+
|
125
|
+
printf ("eio_init ()\n");
|
126
|
+
if (eio_init (want_poll, done_poll)) abort ();
|
127
|
+
|
128
|
+
do
|
129
|
+
{
|
130
|
+
/* avoid relative paths yourself(!) */
|
131
|
+
eio_mkdir ("eio-test-dir", 0777, 0, res_cb, "mkdir");
|
132
|
+
eio_nop (0, res_cb, "nop");
|
133
|
+
event_loop ();
|
134
|
+
|
135
|
+
eio_stat ("eio-test-dir", 0, stat_cb, "stat");
|
136
|
+
eio_lstat ("eio-test-dir", 0, stat_cb, "stat");
|
137
|
+
eio_open ("eio-test-dir/eio-test-file", O_RDWR | O_CREAT, 0777, 0, open_cb, "open");
|
138
|
+
eio_symlink ("test", "eio-test-dir/eio-symlink", 0, res_cb, "symlink");
|
139
|
+
eio_mknod ("eio-test-dir/eio-fifo", S_IFIFO, 0, 0, res_cb, "mknod");
|
140
|
+
event_loop ();
|
141
|
+
|
142
|
+
eio_utime ("eio-test-dir", 12345.678, 23456.789, 0, res_cb, "utime");
|
143
|
+
eio_futime (last_fd, 92345.678, 93456.789, 0, res_cb, "futime");
|
144
|
+
eio_chown ("eio-test-dir", getuid (), getgid (), 0, res_cb, "chown");
|
145
|
+
eio_fchown (last_fd, getuid (), getgid (), 0, res_cb, "fchown");
|
146
|
+
eio_fchmod (last_fd, 0723, 0, res_cb, "fchmod");
|
147
|
+
eio_readdir ("eio-test-dir", 0, 0, readdir_cb, "readdir");
|
148
|
+
eio_readdir ("/nonexistant", 0, 0, readdir_cb, "readdir");
|
149
|
+
eio_fstat (last_fd, 0, stat_cb, "stat");
|
150
|
+
eio_write (last_fd, "test\nfail\n", 10, 4, 0, res_cb, "write");
|
151
|
+
event_loop ();
|
152
|
+
|
153
|
+
eio_read (last_fd, 0, 8, 0, EIO_PRI_DEFAULT, read_cb, "read");
|
154
|
+
eio_readlink ("eio-test-dir/eio-symlink", 0, res_cb, "readlink");
|
155
|
+
event_loop ();
|
156
|
+
|
157
|
+
eio_dup2 (1, 2, EIO_PRI_DEFAULT, res_cb, "dup"); // dup stdout to stderr
|
158
|
+
eio_chmod ("eio-test-dir", 0765, 0, res_cb, "chmod");
|
159
|
+
eio_ftruncate (last_fd, 9, 0, res_cb, "ftruncate");
|
160
|
+
eio_fdatasync (last_fd, 0, res_cb, "fdatasync");
|
161
|
+
eio_fsync (last_fd, 0, res_cb, "fsync");
|
162
|
+
eio_sync (0, res_cb, "sync");
|
163
|
+
eio_busy (0.5, 0, res_cb, "busy");
|
164
|
+
event_loop ();
|
165
|
+
|
166
|
+
eio_sendfile (1, last_fd, 4, 5, 0, res_cb, "sendfile"); // write "test\n" to stdout
|
167
|
+
eio_fstat (last_fd, 0, stat_cb, "stat");
|
168
|
+
event_loop ();
|
169
|
+
|
170
|
+
eio_truncate ("eio-test-dir/eio-test-file", 6, 0, res_cb, "truncate");
|
171
|
+
eio_readahead (last_fd, 0, 64, 0, res_cb, "readahead");
|
172
|
+
event_loop ();
|
173
|
+
|
174
|
+
eio_close (last_fd, 0, res_cb, "close");
|
175
|
+
eio_link ("eio-test-dir/eio-test-file", "eio-test-dir/eio-test-file-2", 0, res_cb, "link");
|
176
|
+
event_loop ();
|
177
|
+
|
178
|
+
eio_rename ("eio-test-dir/eio-test-file", "eio-test-dir/eio-test-file-renamed", 0, res_cb, "rename");
|
179
|
+
event_loop ();
|
180
|
+
|
181
|
+
eio_unlink ("eio-test-dir/eio-fifo", 0, res_cb, "unlink");
|
182
|
+
eio_unlink ("eio-test-dir/eio-symlink", 0, res_cb, "unlink");
|
183
|
+
eio_unlink ("eio-test-dir/eio-test-file-2", 0, res_cb, "unlink");
|
184
|
+
eio_unlink ("eio-test-dir/eio-test-file-renamed", 0, res_cb, "unlink");
|
185
|
+
event_loop ();
|
186
|
+
|
187
|
+
eio_rmdir ("eio-test-dir", 0, res_cb, "rmdir");
|
188
|
+
event_loop ();
|
189
|
+
}
|
190
|
+
while (0);
|
191
|
+
|
192
|
+
return 0;
|
193
|
+
}
|
194
|
+
|
@@ -0,0 +1,370 @@
|
|
1
|
+
/*
|
2
|
+
* libecb - http://software.schmorp.de/pkg/libecb
|
3
|
+
*
|
4
|
+
* Copyright (©) 2009-2011 Marc Alexander Lehmann <libecb@schmorp.de>
|
5
|
+
* Copyright (©) 2011 Emanuele Giaquinta
|
6
|
+
* All rights reserved.
|
7
|
+
*
|
8
|
+
* Redistribution and use in source and binary forms, with or without modifica-
|
9
|
+
* tion, are permitted provided that the following conditions are met:
|
10
|
+
*
|
11
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
12
|
+
* this list of conditions and the following disclaimer.
|
13
|
+
*
|
14
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
* notice, this list of conditions and the following disclaimer in the
|
16
|
+
* documentation and/or other materials provided with the distribution.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
19
|
+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
|
20
|
+
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
21
|
+
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
|
22
|
+
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
23
|
+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
24
|
+
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
25
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
|
26
|
+
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
27
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
*/
|
29
|
+
|
30
|
+
#ifndef ECB_H
|
31
|
+
#define ECB_H
|
32
|
+
|
33
|
+
#ifdef _WIN32
|
34
|
+
typedef signed char int8_t;
|
35
|
+
typedef unsigned char uint8_t;
|
36
|
+
typedef signed short int16_t;
|
37
|
+
typedef unsigned short uint16_t;
|
38
|
+
typedef signed int int32_t;
|
39
|
+
typedef unsigned int uint32_t;
|
40
|
+
#if __GNUC__
|
41
|
+
typedef signed long long int64_t;
|
42
|
+
typedef unsigned long long uint64_t;
|
43
|
+
#else /* _MSC_VER || __BORLANDC__ */
|
44
|
+
typedef signed __int64 int64_t;
|
45
|
+
typedef unsigned __int64 uint64_t;
|
46
|
+
#endif
|
47
|
+
#else
|
48
|
+
#include <inttypes.h>
|
49
|
+
#endif
|
50
|
+
|
51
|
+
/* many compilers define _GNUC_ to some versions but then only implement
|
52
|
+
* what their idiot authors think are the "more important" extensions,
|
53
|
+
* causing enourmous grief in return for some better fake benchmark numbers.
|
54
|
+
* or so.
|
55
|
+
* we try to detect these and simply assume they are not gcc - if they have
|
56
|
+
* an issue with that they should have done it right in the first place.
|
57
|
+
*/
|
58
|
+
#ifndef ECB_GCC_VERSION
|
59
|
+
#if !defined(__GNUC_MINOR__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__llvm__) || defined(__clang__)
|
60
|
+
#define ECB_GCC_VERSION(major,minor) 0
|
61
|
+
#else
|
62
|
+
#define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
|
63
|
+
#endif
|
64
|
+
#endif
|
65
|
+
|
66
|
+
/*****************************************************************************/
|
67
|
+
|
68
|
+
#ifndef ECB_MEMORY_FENCE
|
69
|
+
#if ECB_GCC_VERSION(2,5)
|
70
|
+
#if defined(__x86) || defined(__i386)
|
71
|
+
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
|
72
|
+
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE /* non-lock xchg might be enough */
|
73
|
+
#define ECB_MEMORY_FENCE_RELEASE do { } while (0) /* unlikely to change in future cpus */
|
74
|
+
#elif __amd64
|
75
|
+
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory")
|
76
|
+
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("lfence" : : : "memory")
|
77
|
+
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("sfence") /* play safe - not needed in any current cpu */
|
78
|
+
#endif
|
79
|
+
#endif
|
80
|
+
#endif
|
81
|
+
|
82
|
+
#ifndef ECB_MEMORY_FENCE
|
83
|
+
#if ECB_GCC_VERSION(4,4)
|
84
|
+
#define ECB_MEMORY_FENCE __sync_synchronize ()
|
85
|
+
#define ECB_MEMORY_FENCE_ACQUIRE ({ char dummy = 0; __sync_lock_test_and_set (&dummy, 1); })
|
86
|
+
#define ECB_MEMORY_FENCE_RELEASE ({ char dummy = 1; __sync_lock_release (&dummy ); })
|
87
|
+
#elif _MSC_VER >= 1400 /* VC++ 2005 */
|
88
|
+
#pragma intrinsic(_ReadBarrier,_WriteBarrier,_ReadWriteBarrier)
|
89
|
+
#define ECB_MEMORY_FENCE _ReadWriteBarrier ()
|
90
|
+
#define ECB_MEMORY_FENCE_ACQUIRE _ReadWriteBarrier () /* according to msdn, _ReadBarrier is not a load fence */
|
91
|
+
#define ECB_MEMORY_FENCE_RELEASE _WriteBarrier ()
|
92
|
+
#elif defined(_WIN32)
|
93
|
+
#include <WinNT.h>
|
94
|
+
#define ECB_MEMORY_FENCE MemoryBarrier () /* actually just xchg on x86... scary */
|
95
|
+
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE
|
96
|
+
#define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE
|
97
|
+
#endif
|
98
|
+
#endif
|
99
|
+
|
100
|
+
#ifndef ECB_MEMORY_FENCE
|
101
|
+
/*
|
102
|
+
* if you get undefined symbol references to pthread_mutex_lock,
|
103
|
+
* or failure to find pthread.h, then you should implement
|
104
|
+
* the ECB_MEMORY_FENCE operations for your cpu/compiler
|
105
|
+
* OR proide pthread.h and link against the posix thread library
|
106
|
+
* of your system.
|
107
|
+
*/
|
108
|
+
#include <pthread.h>
|
109
|
+
|
110
|
+
static pthread_mutex_t ecb_mf_lock = PTHREAD_MUTEX_INITIALIZER;
|
111
|
+
#define ECB_MEMORY_FENCE do { pthread_mutex_lock (&ecb_mf_lock); pthread_mutex_unlock (&ecb_mf_lock); } while (0)
|
112
|
+
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE
|
113
|
+
#define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE
|
114
|
+
#endif
|
115
|
+
|
116
|
+
/*****************************************************************************/
|
117
|
+
|
118
|
+
#define ECB_C99 (__STDC_VERSION__ >= 199901L)
|
119
|
+
|
120
|
+
#if __cplusplus
|
121
|
+
#define ecb_inline static inline
|
122
|
+
#elif ECB_GCC_VERSION(2,5)
|
123
|
+
#define ecb_inline static __inline__
|
124
|
+
#elif ECB_C99
|
125
|
+
#define ecb_inline static inline
|
126
|
+
#else
|
127
|
+
#define ecb_inline static
|
128
|
+
#endif
|
129
|
+
|
130
|
+
#if ECB_GCC_VERSION(3,3)
|
131
|
+
#define ecb_restrict __restrict__
|
132
|
+
#elif ECB_C99
|
133
|
+
#define ecb_restrict restrict
|
134
|
+
#else
|
135
|
+
#define ecb_restrict
|
136
|
+
#endif
|
137
|
+
|
138
|
+
typedef int ecb_bool;
|
139
|
+
|
140
|
+
#define ECB_CONCAT_(a, b) a ## b
|
141
|
+
#define ECB_CONCAT(a, b) ECB_CONCAT_(a, b)
|
142
|
+
#define ECB_STRINGIFY_(a) # a
|
143
|
+
#define ECB_STRINGIFY(a) ECB_STRINGIFY_(a)
|
144
|
+
|
145
|
+
#define ecb_function_ ecb_inline
|
146
|
+
|
147
|
+
#if ECB_GCC_VERSION(3,1)
|
148
|
+
#define ecb_attribute(attrlist) __attribute__(attrlist)
|
149
|
+
#define ecb_is_constant(expr) __builtin_constant_p (expr)
|
150
|
+
#define ecb_expect(expr,value) __builtin_expect ((expr),(value))
|
151
|
+
#define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality)
|
152
|
+
#else
|
153
|
+
#define ecb_attribute(attrlist)
|
154
|
+
#define ecb_is_constant(expr) 0
|
155
|
+
#define ecb_expect(expr,value) (expr)
|
156
|
+
#define ecb_prefetch(addr,rw,locality)
|
157
|
+
#endif
|
158
|
+
|
159
|
+
/* no emulation for ecb_decltype */
|
160
|
+
#if ECB_GCC_VERSION(4,5)
|
161
|
+
#define ecb_decltype(x) __decltype(x)
|
162
|
+
#elif ECB_GCC_VERSION(3,0)
|
163
|
+
#define ecb_decltype(x) __typeof(x)
|
164
|
+
#endif
|
165
|
+
|
166
|
+
#define ecb_noinline ecb_attribute ((__noinline__))
|
167
|
+
#define ecb_noreturn ecb_attribute ((__noreturn__))
|
168
|
+
#define ecb_unused ecb_attribute ((__unused__))
|
169
|
+
#define ecb_const ecb_attribute ((__const__))
|
170
|
+
#define ecb_pure ecb_attribute ((__pure__))
|
171
|
+
|
172
|
+
#if ECB_GCC_VERSION(4,3)
|
173
|
+
#define ecb_artificial ecb_attribute ((__artificial__))
|
174
|
+
#define ecb_hot ecb_attribute ((__hot__))
|
175
|
+
#define ecb_cold ecb_attribute ((__cold__))
|
176
|
+
#else
|
177
|
+
#define ecb_artificial
|
178
|
+
#define ecb_hot
|
179
|
+
#define ecb_cold
|
180
|
+
#endif
|
181
|
+
|
182
|
+
/* put around conditional expressions if you are very sure that the */
|
183
|
+
/* expression is mostly true or mostly false. note that these return */
|
184
|
+
/* booleans, not the expression. */
|
185
|
+
#define ecb_expect_false(expr) ecb_expect (!!(expr), 0)
|
186
|
+
#define ecb_expect_true(expr) ecb_expect (!!(expr), 1)
|
187
|
+
/* for compatibility to the rest of the world */
|
188
|
+
#define ecb_likely(expr) ecb_expect_true (expr)
|
189
|
+
#define ecb_unlikely(expr) ecb_expect_false (expr)
|
190
|
+
|
191
|
+
/* count trailing zero bits and count # of one bits */
|
192
|
+
#if ECB_GCC_VERSION(3,4)
|
193
|
+
/* we assume int == 32 bit, long == 32 or 64 bit and long long == 64 bit */
|
194
|
+
#define ecb_ld32(x) (__builtin_clz (x) ^ 31)
|
195
|
+
#define ecb_ld64(x) (__builtin_clzll (x) ^ 63)
|
196
|
+
#define ecb_ctz32(x) __builtin_ctz (x)
|
197
|
+
#define ecb_ctz64(x) __builtin_ctzll (x)
|
198
|
+
#define ecb_popcount32(x) __builtin_popcount (x)
|
199
|
+
/* no popcountll */
|
200
|
+
#else
|
201
|
+
ecb_function_ int ecb_ctz32 (uint32_t x) ecb_const;
|
202
|
+
ecb_function_ int
|
203
|
+
ecb_ctz32 (uint32_t x)
|
204
|
+
{
|
205
|
+
int r = 0;
|
206
|
+
|
207
|
+
x &= ~x + 1; /* this isolates the lowest bit */
|
208
|
+
|
209
|
+
#if ECB_branchless_on_i386
|
210
|
+
r += !!(x & 0xaaaaaaaa) << 0;
|
211
|
+
r += !!(x & 0xcccccccc) << 1;
|
212
|
+
r += !!(x & 0xf0f0f0f0) << 2;
|
213
|
+
r += !!(x & 0xff00ff00) << 3;
|
214
|
+
r += !!(x & 0xffff0000) << 4;
|
215
|
+
#else
|
216
|
+
if (x & 0xaaaaaaaa) r += 1;
|
217
|
+
if (x & 0xcccccccc) r += 2;
|
218
|
+
if (x & 0xf0f0f0f0) r += 4;
|
219
|
+
if (x & 0xff00ff00) r += 8;
|
220
|
+
if (x & 0xffff0000) r += 16;
|
221
|
+
#endif
|
222
|
+
|
223
|
+
return r;
|
224
|
+
}
|
225
|
+
|
226
|
+
ecb_function_ int ecb_ctz64 (uint64_t x) ecb_const;
|
227
|
+
ecb_function_ int
|
228
|
+
ecb_ctz64 (uint64_t x)
|
229
|
+
{
|
230
|
+
int shift = x & 0xffffffffU ? 0 : 32;
|
231
|
+
return ecb_ctz32 (x >> shift) + shift;
|
232
|
+
}
|
233
|
+
|
234
|
+
ecb_function_ int ecb_popcount32 (uint32_t x) ecb_const;
|
235
|
+
ecb_function_ int
|
236
|
+
ecb_popcount32 (uint32_t x)
|
237
|
+
{
|
238
|
+
x -= (x >> 1) & 0x55555555;
|
239
|
+
x = ((x >> 2) & 0x33333333) + (x & 0x33333333);
|
240
|
+
x = ((x >> 4) + x) & 0x0f0f0f0f;
|
241
|
+
x *= 0x01010101;
|
242
|
+
|
243
|
+
return x >> 24;
|
244
|
+
}
|
245
|
+
|
246
|
+
/* you have the choice beetween something with a table lookup, */
|
247
|
+
/* something using lots of bit arithmetic and a simple loop */
|
248
|
+
/* we went for the loop */
|
249
|
+
ecb_function_ int ecb_ld32 (uint32_t x) ecb_const;
|
250
|
+
ecb_function_ int ecb_ld32 (uint32_t x)
|
251
|
+
{
|
252
|
+
int r = 0;
|
253
|
+
|
254
|
+
if (x >> 16) { x >>= 16; r += 16; }
|
255
|
+
if (x >> 8) { x >>= 8; r += 8; }
|
256
|
+
if (x >> 4) { x >>= 4; r += 4; }
|
257
|
+
if (x >> 2) { x >>= 2; r += 2; }
|
258
|
+
if (x >> 1) { r += 1; }
|
259
|
+
|
260
|
+
return r;
|
261
|
+
}
|
262
|
+
|
263
|
+
ecb_function_ int ecb_ld64 (uint64_t x) ecb_const;
|
264
|
+
ecb_function_ int ecb_ld64 (uint64_t x)
|
265
|
+
{
|
266
|
+
int r = 0;
|
267
|
+
|
268
|
+
if (x >> 32) { x >>= 32; r += 32; }
|
269
|
+
|
270
|
+
return r + ecb_ld32 (x);
|
271
|
+
}
|
272
|
+
#endif
|
273
|
+
|
274
|
+
/* popcount64 is only available on 64 bit cpus as gcc builtin */
|
275
|
+
/* so for this version we are lazy */
|
276
|
+
ecb_function_ int ecb_popcount64 (uint64_t x) ecb_const;
|
277
|
+
ecb_function_ int
|
278
|
+
ecb_popcount64 (uint64_t x)
|
279
|
+
{
|
280
|
+
return ecb_popcount32 (x) + ecb_popcount32 (x >> 32);
|
281
|
+
}
|
282
|
+
|
283
|
+
ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) ecb_const;
|
284
|
+
ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) ecb_const;
|
285
|
+
ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) ecb_const;
|
286
|
+
ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) ecb_const;
|
287
|
+
ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) ecb_const;
|
288
|
+
ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) ecb_const;
|
289
|
+
ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) ecb_const;
|
290
|
+
ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) ecb_const;
|
291
|
+
|
292
|
+
ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); }
|
293
|
+
ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); }
|
294
|
+
ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); }
|
295
|
+
ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); }
|
296
|
+
ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); }
|
297
|
+
ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); }
|
298
|
+
ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); }
|
299
|
+
ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); }
|
300
|
+
|
301
|
+
#if ECB_GCC_VERSION(4,3)
|
302
|
+
#define ecb_bswap16(x) (__builtin_bswap32 (x) >> 16)
|
303
|
+
#define ecb_bswap32(x) __builtin_bswap32 (x)
|
304
|
+
#define ecb_bswap64(x) __builtin_bswap64 (x)
|
305
|
+
#else
|
306
|
+
ecb_function_ uint16_t ecb_bswap16 (uint16_t x) ecb_const;
|
307
|
+
ecb_function_ uint16_t
|
308
|
+
ecb_bswap16 (uint16_t x)
|
309
|
+
{
|
310
|
+
return ecb_rotl16 (x, 8);
|
311
|
+
}
|
312
|
+
|
313
|
+
ecb_function_ uint32_t ecb_bswap32 (uint32_t x) ecb_const;
|
314
|
+
ecb_function_ uint32_t
|
315
|
+
ecb_bswap32 (uint32_t x)
|
316
|
+
{
|
317
|
+
return (((uint32_t)ecb_bswap16 (x)) << 16) | ecb_bswap16 (x >> 16);
|
318
|
+
}
|
319
|
+
|
320
|
+
ecb_function_ uint64_t ecb_bswap64 (uint64_t x) ecb_const;
|
321
|
+
ecb_function_ uint64_t
|
322
|
+
ecb_bswap64 (uint64_t x)
|
323
|
+
{
|
324
|
+
return (((uint64_t)ecb_bswap32 (x)) << 32) | ecb_bswap32 (x >> 32);
|
325
|
+
}
|
326
|
+
#endif
|
327
|
+
|
328
|
+
#if ECB_GCC_VERSION(4,5)
|
329
|
+
#define ecb_unreachable() __builtin_unreachable ()
|
330
|
+
#else
|
331
|
+
/* this seems to work fine, but gcc always emits a warning for it :/ */
|
332
|
+
ecb_function_ void ecb_unreachable (void) ecb_noreturn;
|
333
|
+
ecb_function_ void ecb_unreachable (void) { }
|
334
|
+
#endif
|
335
|
+
|
336
|
+
/* try to tell the compiler that some condition is definitely true */
|
337
|
+
#define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0)
|
338
|
+
|
339
|
+
ecb_function_ unsigned char ecb_byteorder_helper (void) ecb_const;
|
340
|
+
ecb_function_ unsigned char
|
341
|
+
ecb_byteorder_helper (void)
|
342
|
+
{
|
343
|
+
const uint32_t u = 0x11223344;
|
344
|
+
return *(unsigned char *)&u;
|
345
|
+
}
|
346
|
+
|
347
|
+
ecb_function_ ecb_bool ecb_big_endian (void) ecb_const;
|
348
|
+
ecb_function_ ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; }
|
349
|
+
ecb_function_ ecb_bool ecb_little_endian (void) ecb_const;
|
350
|
+
ecb_function_ ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; }
|
351
|
+
|
352
|
+
#if ECB_GCC_VERSION(3,0) || ECB_C99
|
353
|
+
#define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0))
|
354
|
+
#else
|
355
|
+
#define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n)))
|
356
|
+
#endif
|
357
|
+
|
358
|
+
#if ecb_cplusplus_does_not_suck
|
359
|
+
/* does not work for local types (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm) */
|
360
|
+
template<typename T, int N>
|
361
|
+
static inline int ecb_array_length (const T (&arr)[N])
|
362
|
+
{
|
363
|
+
return N;
|
364
|
+
}
|
365
|
+
#else
|
366
|
+
#define ecb_array_length(name) (sizeof (name) / sizeof (name [0]))
|
367
|
+
#endif
|
368
|
+
|
369
|
+
#endif
|
370
|
+
|