asyncengine 0.0.1.testing
Sign up to get free protection for your applications and to get access to all the features.
- 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,707 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "uv.h"
|
23
|
+
#include "internal.h"
|
24
|
+
#include "eio.h"
|
25
|
+
|
26
|
+
#include <stdio.h>
|
27
|
+
#include <stdlib.h>
|
28
|
+
#include <string.h>
|
29
|
+
#include <dirent.h>
|
30
|
+
#include <assert.h>
|
31
|
+
#include <errno.h>
|
32
|
+
#include <fcntl.h>
|
33
|
+
#include <unistd.h>
|
34
|
+
#include <utime.h>
|
35
|
+
#include <sys/time.h>
|
36
|
+
|
37
|
+
|
38
|
+
#define ARGS1(a) (a)
|
39
|
+
#define ARGS2(a,b) (a), (b)
|
40
|
+
#define ARGS3(a,b,c) (a), (b), (c)
|
41
|
+
#define ARGS4(a,b,c,d) (a), (b), (c), (d)
|
42
|
+
|
43
|
+
#define WRAP_EIO(type, eiofunc, func, args) \
|
44
|
+
uv_fs_req_init(loop, req, type, path, cb); \
|
45
|
+
if (cb) { \
|
46
|
+
/* async */ \
|
47
|
+
req->eio = eiofunc(args, EIO_PRI_DEFAULT, uv__fs_after, req, &loop->uv_eio_channel); \
|
48
|
+
if (!req->eio) { \
|
49
|
+
uv__set_sys_error(loop, ENOMEM); \
|
50
|
+
return -1; \
|
51
|
+
} \
|
52
|
+
uv_ref(loop); \
|
53
|
+
} else { \
|
54
|
+
/* sync */ \
|
55
|
+
req->result = func(args); \
|
56
|
+
if (req->result) { \
|
57
|
+
uv__set_sys_error(loop, errno); \
|
58
|
+
} \
|
59
|
+
return req->result; \
|
60
|
+
} \
|
61
|
+
return 0;
|
62
|
+
|
63
|
+
|
64
|
+
static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req, uv_fs_type fs_type,
|
65
|
+
const char* path, uv_fs_cb cb) {
|
66
|
+
/* Make sure the thread pool is initialized. */
|
67
|
+
uv_eio_init(loop);
|
68
|
+
|
69
|
+
uv__req_init(loop, (uv_req_t*)req);
|
70
|
+
req->type = UV_FS;
|
71
|
+
req->loop = loop;
|
72
|
+
req->fs_type = fs_type;
|
73
|
+
req->cb = cb;
|
74
|
+
req->result = 0;
|
75
|
+
req->ptr = NULL;
|
76
|
+
req->path = path ? strdup(path) : NULL;
|
77
|
+
req->errorno = 0;
|
78
|
+
req->eio = NULL;
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
void uv_fs_req_cleanup(uv_fs_t* req) {
|
83
|
+
free(req->path);
|
84
|
+
req->path = NULL;
|
85
|
+
|
86
|
+
switch (req->fs_type) {
|
87
|
+
case UV_FS_READDIR:
|
88
|
+
assert(req->result > 0 ? (req->ptr != NULL) : (req->ptr == NULL));
|
89
|
+
free(req->ptr);
|
90
|
+
req->ptr = NULL;
|
91
|
+
break;
|
92
|
+
|
93
|
+
case UV_FS_STAT:
|
94
|
+
case UV_FS_LSTAT:
|
95
|
+
req->ptr = NULL;
|
96
|
+
break;
|
97
|
+
|
98
|
+
default:
|
99
|
+
break;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
static int uv__fs_after(eio_req* eio) {
|
105
|
+
char* name;
|
106
|
+
int namelen;
|
107
|
+
int buflen = 0;
|
108
|
+
uv_fs_t* req = eio->data;
|
109
|
+
int i;
|
110
|
+
|
111
|
+
assert(req->cb);
|
112
|
+
|
113
|
+
req->result = req->eio->result;
|
114
|
+
req->errorno = uv_translate_sys_error(req->eio->errorno);
|
115
|
+
|
116
|
+
switch (req->fs_type) {
|
117
|
+
case UV_FS_READDIR:
|
118
|
+
/*
|
119
|
+
* XXX This is pretty bad.
|
120
|
+
* We alloc and copy the large null terminated string list from libeio.
|
121
|
+
* This is done because libeio is going to free eio->ptr2 after this
|
122
|
+
* callback. We must keep it until uv_fs_req_cleanup. If we get rid of
|
123
|
+
* libeio this can be avoided.
|
124
|
+
*/
|
125
|
+
buflen = 0;
|
126
|
+
name = req->eio->ptr2;
|
127
|
+
|
128
|
+
for (i = 0; i < req->result; i++) {
|
129
|
+
namelen = strlen(name);
|
130
|
+
buflen += namelen + 1;
|
131
|
+
name += namelen;
|
132
|
+
assert(*name == '\0');
|
133
|
+
name++;
|
134
|
+
}
|
135
|
+
|
136
|
+
if (buflen) {
|
137
|
+
if ((req->ptr = malloc(buflen)))
|
138
|
+
memcpy(req->ptr, req->eio->ptr2, buflen);
|
139
|
+
else
|
140
|
+
uv__set_sys_error(req->loop, ENOMEM);
|
141
|
+
}
|
142
|
+
break;
|
143
|
+
|
144
|
+
case UV_FS_STAT:
|
145
|
+
case UV_FS_LSTAT:
|
146
|
+
case UV_FS_FSTAT:
|
147
|
+
req->ptr = req->eio->ptr2;
|
148
|
+
break;
|
149
|
+
|
150
|
+
case UV_FS_READLINK:
|
151
|
+
if (req->result == -1) {
|
152
|
+
req->ptr = NULL;
|
153
|
+
break;
|
154
|
+
}
|
155
|
+
assert(req->result > 0);
|
156
|
+
|
157
|
+
/* Make zero-terminated copy of req->eio->ptr2 */
|
158
|
+
if ((req->ptr = name = malloc(req->result + 1))) {
|
159
|
+
memcpy(name, req->eio->ptr2, req->result);
|
160
|
+
name[req->result] = '\0';
|
161
|
+
req->result = 0;
|
162
|
+
}
|
163
|
+
else {
|
164
|
+
req->errorno = ENOMEM;
|
165
|
+
req->result = -1;
|
166
|
+
}
|
167
|
+
break;
|
168
|
+
|
169
|
+
default:
|
170
|
+
break;
|
171
|
+
}
|
172
|
+
|
173
|
+
uv_unref(req->loop);
|
174
|
+
req->eio = NULL; /* Freed by libeio */
|
175
|
+
|
176
|
+
req->cb(req);
|
177
|
+
return 0;
|
178
|
+
}
|
179
|
+
|
180
|
+
|
181
|
+
int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
|
182
|
+
char* path = NULL;
|
183
|
+
WRAP_EIO(UV_FS_CLOSE, eio_close, close, ARGS1(file));
|
184
|
+
}
|
185
|
+
|
186
|
+
|
187
|
+
int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
|
188
|
+
int mode, uv_fs_cb cb) {
|
189
|
+
uv_fs_req_init(loop, req, UV_FS_OPEN, path, cb);
|
190
|
+
|
191
|
+
if (cb) {
|
192
|
+
/* async */
|
193
|
+
uv_ref(loop);
|
194
|
+
req->eio = eio_open(path, flags, mode, EIO_PRI_DEFAULT, uv__fs_after, req, &loop->uv_eio_channel);
|
195
|
+
if (!req->eio) {
|
196
|
+
uv__set_sys_error(loop, ENOMEM);
|
197
|
+
return -1;
|
198
|
+
}
|
199
|
+
|
200
|
+
} else {
|
201
|
+
/* sync */
|
202
|
+
req->result = open(path, flags, mode);
|
203
|
+
if (req->result < 0) {
|
204
|
+
uv__set_sys_error(loop, errno);
|
205
|
+
return -1;
|
206
|
+
}
|
207
|
+
|
208
|
+
uv__cloexec(req->result, 1);
|
209
|
+
|
210
|
+
return req->result;
|
211
|
+
}
|
212
|
+
|
213
|
+
return 0;
|
214
|
+
}
|
215
|
+
|
216
|
+
|
217
|
+
int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf,
|
218
|
+
size_t length, off_t offset, uv_fs_cb cb) {
|
219
|
+
uv_fs_req_init(loop, req, UV_FS_READ, NULL, cb);
|
220
|
+
|
221
|
+
if (cb) {
|
222
|
+
/* async */
|
223
|
+
uv_ref(loop);
|
224
|
+
req->eio = eio_read(fd, buf, length, offset, EIO_PRI_DEFAULT,
|
225
|
+
uv__fs_after, req, &loop->uv_eio_channel);
|
226
|
+
|
227
|
+
if (!req->eio) {
|
228
|
+
uv__set_sys_error(loop, ENOMEM);
|
229
|
+
return -1;
|
230
|
+
}
|
231
|
+
|
232
|
+
} else {
|
233
|
+
/* sync */
|
234
|
+
req->result = offset < 0 ?
|
235
|
+
read(fd, buf, length) :
|
236
|
+
pread(fd, buf, length, offset);
|
237
|
+
|
238
|
+
if (req->result < 0) {
|
239
|
+
uv__set_sys_error(loop, errno);
|
240
|
+
return -1;
|
241
|
+
}
|
242
|
+
|
243
|
+
return req->result;
|
244
|
+
}
|
245
|
+
|
246
|
+
return 0;
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
251
|
+
WRAP_EIO(UV_FS_UNLINK, eio_unlink, unlink, ARGS1(path))
|
252
|
+
}
|
253
|
+
|
254
|
+
|
255
|
+
int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
|
256
|
+
size_t length, off_t offset, uv_fs_cb cb) {
|
257
|
+
uv_fs_req_init(loop, req, UV_FS_WRITE, NULL, cb);
|
258
|
+
|
259
|
+
if (cb) {
|
260
|
+
/* async */
|
261
|
+
uv_ref(loop);
|
262
|
+
req->eio = eio_write(file, buf, length, offset, EIO_PRI_DEFAULT,
|
263
|
+
uv__fs_after, req, &loop->uv_eio_channel);
|
264
|
+
if (!req->eio) {
|
265
|
+
uv__set_sys_error(loop, ENOMEM);
|
266
|
+
return -1;
|
267
|
+
}
|
268
|
+
|
269
|
+
} else {
|
270
|
+
/* sync */
|
271
|
+
req->result = offset < 0 ?
|
272
|
+
write(file, buf, length) :
|
273
|
+
pwrite(file, buf, length, offset);
|
274
|
+
|
275
|
+
if (req->result < 0) {
|
276
|
+
uv__set_sys_error(loop, errno);
|
277
|
+
return -1;
|
278
|
+
}
|
279
|
+
|
280
|
+
return req->result;
|
281
|
+
}
|
282
|
+
|
283
|
+
return 0;
|
284
|
+
}
|
285
|
+
|
286
|
+
|
287
|
+
int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
|
288
|
+
uv_fs_cb cb) {
|
289
|
+
WRAP_EIO(UV_FS_MKDIR, eio_mkdir, mkdir, ARGS2(path, mode))
|
290
|
+
}
|
291
|
+
|
292
|
+
|
293
|
+
int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
294
|
+
WRAP_EIO(UV_FS_RMDIR, eio_rmdir, rmdir, ARGS1(path))
|
295
|
+
}
|
296
|
+
|
297
|
+
|
298
|
+
int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
|
299
|
+
uv_fs_cb cb) {
|
300
|
+
int r;
|
301
|
+
struct dirent* entry;
|
302
|
+
size_t size = 0;
|
303
|
+
size_t d_namlen = 0;
|
304
|
+
|
305
|
+
uv_fs_req_init(loop, req, UV_FS_READDIR, path, cb);
|
306
|
+
|
307
|
+
if (cb) {
|
308
|
+
/* async */
|
309
|
+
uv_ref(loop);
|
310
|
+
req->eio = eio_readdir(path, flags, EIO_PRI_DEFAULT, uv__fs_after, req, &loop->uv_eio_channel);
|
311
|
+
if (!req->eio) {
|
312
|
+
uv__set_sys_error(loop, ENOMEM);
|
313
|
+
return -1;
|
314
|
+
}
|
315
|
+
|
316
|
+
} else {
|
317
|
+
/* sync */
|
318
|
+
DIR* dir = opendir(path);
|
319
|
+
if (!dir) {
|
320
|
+
uv__set_sys_error(loop, errno);
|
321
|
+
req->result = -1;
|
322
|
+
return -1;
|
323
|
+
}
|
324
|
+
|
325
|
+
/* req->result stores number of entries */
|
326
|
+
req->result = 0;
|
327
|
+
|
328
|
+
while ((entry = readdir(dir))) {
|
329
|
+
d_namlen = strlen(entry->d_name);
|
330
|
+
|
331
|
+
/* Skip . and .. */
|
332
|
+
if ((d_namlen == 1 && entry->d_name[0] == '.') ||
|
333
|
+
(d_namlen == 2 && entry->d_name[0] == '.' &&
|
334
|
+
entry->d_name[1] == '.')) {
|
335
|
+
continue;
|
336
|
+
}
|
337
|
+
|
338
|
+
req->ptr = realloc(req->ptr, size + d_namlen + 1);
|
339
|
+
/* TODO check ENOMEM */
|
340
|
+
memcpy((char*)req->ptr + size, entry->d_name, d_namlen);
|
341
|
+
size += d_namlen;
|
342
|
+
((char*)req->ptr)[size] = '\0';
|
343
|
+
size++;
|
344
|
+
req->result++;
|
345
|
+
}
|
346
|
+
|
347
|
+
r = closedir(dir);
|
348
|
+
if (r) {
|
349
|
+
uv__set_sys_error(loop, errno);
|
350
|
+
req->result = -1;
|
351
|
+
return -1;
|
352
|
+
}
|
353
|
+
|
354
|
+
return req->result;
|
355
|
+
}
|
356
|
+
|
357
|
+
return 0;
|
358
|
+
}
|
359
|
+
|
360
|
+
|
361
|
+
int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
362
|
+
char* pathdup;
|
363
|
+
int pathlen;
|
364
|
+
|
365
|
+
uv_fs_req_init(loop, req, UV_FS_STAT, path, cb);
|
366
|
+
|
367
|
+
/* TODO do this without duplicating the string. */
|
368
|
+
/* TODO security */
|
369
|
+
pathdup = strdup(path);
|
370
|
+
pathlen = strlen(path);
|
371
|
+
|
372
|
+
if (pathlen > 0 && path[pathlen - 1] == '\\') {
|
373
|
+
/* TODO do not modify input string */
|
374
|
+
pathdup[pathlen - 1] = '\0';
|
375
|
+
}
|
376
|
+
|
377
|
+
if (cb) {
|
378
|
+
/* async */
|
379
|
+
uv_ref(loop);
|
380
|
+
req->eio = eio_stat(pathdup, EIO_PRI_DEFAULT, uv__fs_after, req, &loop->uv_eio_channel);
|
381
|
+
|
382
|
+
free(pathdup);
|
383
|
+
|
384
|
+
if (!req->eio) {
|
385
|
+
uv__set_sys_error(loop, ENOMEM);
|
386
|
+
return -1;
|
387
|
+
}
|
388
|
+
|
389
|
+
} else {
|
390
|
+
/* sync */
|
391
|
+
req->result = stat(pathdup, &req->statbuf);
|
392
|
+
|
393
|
+
free(pathdup);
|
394
|
+
|
395
|
+
if (req->result < 0) {
|
396
|
+
uv__set_sys_error(loop, errno);
|
397
|
+
return -1;
|
398
|
+
}
|
399
|
+
|
400
|
+
req->ptr = &req->statbuf;
|
401
|
+
return req->result;
|
402
|
+
}
|
403
|
+
|
404
|
+
return 0;
|
405
|
+
}
|
406
|
+
|
407
|
+
|
408
|
+
int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
|
409
|
+
uv_fs_req_init(loop, req, UV_FS_FSTAT, NULL, cb);
|
410
|
+
|
411
|
+
if (cb) {
|
412
|
+
/* async */
|
413
|
+
uv_ref(loop);
|
414
|
+
req->eio = eio_fstat(file, EIO_PRI_DEFAULT, uv__fs_after, req, &loop->uv_eio_channel);
|
415
|
+
|
416
|
+
if (!req->eio) {
|
417
|
+
uv__set_sys_error(loop, ENOMEM);
|
418
|
+
return -1;
|
419
|
+
}
|
420
|
+
|
421
|
+
} else {
|
422
|
+
/* sync */
|
423
|
+
req->result = fstat(file, &req->statbuf);
|
424
|
+
|
425
|
+
if (req->result < 0) {
|
426
|
+
uv__set_sys_error(loop, errno);
|
427
|
+
return -1;
|
428
|
+
}
|
429
|
+
|
430
|
+
req->ptr = &req->statbuf;
|
431
|
+
return req->result;
|
432
|
+
}
|
433
|
+
|
434
|
+
return 0;
|
435
|
+
}
|
436
|
+
|
437
|
+
|
438
|
+
int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path,
|
439
|
+
uv_fs_cb cb) {
|
440
|
+
WRAP_EIO(UV_FS_RENAME, eio_rename, rename, ARGS2(path, new_path))
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
|
445
|
+
char* path = NULL;
|
446
|
+
WRAP_EIO(UV_FS_FSYNC, eio_fsync, fsync, ARGS1(file))
|
447
|
+
}
|
448
|
+
|
449
|
+
|
450
|
+
int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
|
451
|
+
char* path = NULL;
|
452
|
+
#if defined(__FreeBSD__) \
|
453
|
+
|| (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060)
|
454
|
+
/* freebsd and pre-10.6 darwin don't have fdatasync,
|
455
|
+
* do a full fsync instead.
|
456
|
+
*/
|
457
|
+
WRAP_EIO(UV_FS_FDATASYNC, eio_fdatasync, fsync, ARGS1(file))
|
458
|
+
#else
|
459
|
+
WRAP_EIO(UV_FS_FDATASYNC, eio_fdatasync, fdatasync, ARGS1(file))
|
460
|
+
#endif
|
461
|
+
}
|
462
|
+
|
463
|
+
|
464
|
+
int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file, off_t offset,
|
465
|
+
uv_fs_cb cb) {
|
466
|
+
char* path = NULL;
|
467
|
+
WRAP_EIO(UV_FS_FTRUNCATE, eio_ftruncate, ftruncate, ARGS2(file, offset))
|
468
|
+
}
|
469
|
+
|
470
|
+
|
471
|
+
int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd,
|
472
|
+
off_t in_offset, size_t length, uv_fs_cb cb) {
|
473
|
+
char* path = NULL;
|
474
|
+
WRAP_EIO(UV_FS_SENDFILE, eio_sendfile, eio_sendfile_sync,
|
475
|
+
ARGS4(out_fd, in_fd, in_offset, length))
|
476
|
+
}
|
477
|
+
|
478
|
+
|
479
|
+
int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
|
480
|
+
uv_fs_cb cb) {
|
481
|
+
WRAP_EIO(UV_FS_CHMOD, eio_chmod, chmod, ARGS2(path, mode))
|
482
|
+
}
|
483
|
+
|
484
|
+
|
485
|
+
static int _utime(const char* path, double atime, double mtime) {
|
486
|
+
struct utimbuf buf;
|
487
|
+
buf.actime = atime;
|
488
|
+
buf.modtime = mtime;
|
489
|
+
return utime(path, &buf);
|
490
|
+
}
|
491
|
+
|
492
|
+
|
493
|
+
int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime,
|
494
|
+
double mtime, uv_fs_cb cb) {
|
495
|
+
WRAP_EIO(UV_FS_UTIME, eio_utime, _utime, ARGS3(path, atime, mtime))
|
496
|
+
}
|
497
|
+
|
498
|
+
|
499
|
+
#if HAVE_FUTIMES
|
500
|
+
static int _futime(const uv_file fd, double atime, double mtime) {
|
501
|
+
#if __linux__
|
502
|
+
/* utimesat() has nanosecond resolution but we stick to microseconds
|
503
|
+
* for the sake of consistency with other platforms.
|
504
|
+
*/
|
505
|
+
struct timespec ts[2];
|
506
|
+
ts[0].tv_sec = atime;
|
507
|
+
ts[0].tv_nsec = (unsigned long)(atime * 1000000) % 1000000 * 1000;
|
508
|
+
ts[1].tv_sec = mtime;
|
509
|
+
ts[1].tv_nsec = (unsigned long)(mtime * 1000000) % 1000000 * 1000;
|
510
|
+
return uv__utimesat(fd, NULL, ts, 0);
|
511
|
+
#else
|
512
|
+
struct timeval tv[2];
|
513
|
+
tv[0].tv_sec = atime;
|
514
|
+
tv[0].tv_usec = (unsigned long)(atime * 1000000) % 1000000;
|
515
|
+
tv[1].tv_sec = mtime;
|
516
|
+
tv[1].tv_usec = (unsigned long)(mtime * 1000000) % 1000000;
|
517
|
+
return futimes(fd, tv);
|
518
|
+
#endif /* __linux__ */
|
519
|
+
}
|
520
|
+
#endif /* HAVE_FUTIMES */
|
521
|
+
|
522
|
+
|
523
|
+
int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime,
|
524
|
+
double mtime, uv_fs_cb cb) {
|
525
|
+
const char* path = NULL;
|
526
|
+
|
527
|
+
uv_fs_req_init(loop, req, UV_FS_FUTIME, path, cb);
|
528
|
+
|
529
|
+
#if HAVE_FUTIMES
|
530
|
+
WRAP_EIO(UV_FS_FUTIME, eio_futime, _futime, ARGS3(file, atime, mtime))
|
531
|
+
#else
|
532
|
+
uv__set_sys_error(loop, ENOSYS);
|
533
|
+
return -1;
|
534
|
+
#endif
|
535
|
+
}
|
536
|
+
|
537
|
+
|
538
|
+
int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
539
|
+
char* pathdup;
|
540
|
+
int pathlen;
|
541
|
+
|
542
|
+
uv_fs_req_init(loop, req, UV_FS_LSTAT, path, cb);
|
543
|
+
|
544
|
+
/* TODO do this without duplicating the string. */
|
545
|
+
/* TODO security */
|
546
|
+
pathdup = strdup(path);
|
547
|
+
pathlen = strlen(path);
|
548
|
+
|
549
|
+
if (pathlen > 0 && path[pathlen - 1] == '\\') {
|
550
|
+
/* TODO do not modify input string */
|
551
|
+
pathdup[pathlen - 1] = '\0';
|
552
|
+
}
|
553
|
+
|
554
|
+
if (cb) {
|
555
|
+
/* async */
|
556
|
+
uv_ref(loop);
|
557
|
+
req->eio = eio_lstat(pathdup, EIO_PRI_DEFAULT, uv__fs_after, req, &loop->uv_eio_channel);
|
558
|
+
|
559
|
+
free(pathdup);
|
560
|
+
|
561
|
+
if (!req->eio) {
|
562
|
+
uv__set_sys_error(loop, ENOMEM);
|
563
|
+
return -1;
|
564
|
+
}
|
565
|
+
|
566
|
+
} else {
|
567
|
+
/* sync */
|
568
|
+
req->result = lstat(pathdup, &req->statbuf);
|
569
|
+
|
570
|
+
free(pathdup);
|
571
|
+
|
572
|
+
if (req->result < 0) {
|
573
|
+
uv__set_sys_error(loop, errno);
|
574
|
+
return -1;
|
575
|
+
}
|
576
|
+
|
577
|
+
req->ptr = &req->statbuf;
|
578
|
+
return req->result;
|
579
|
+
}
|
580
|
+
|
581
|
+
return 0;
|
582
|
+
}
|
583
|
+
|
584
|
+
|
585
|
+
int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
586
|
+
const char* new_path, uv_fs_cb cb) {
|
587
|
+
WRAP_EIO(UV_FS_LINK, eio_link, link, ARGS2(path, new_path))
|
588
|
+
}
|
589
|
+
|
590
|
+
|
591
|
+
int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
592
|
+
const char* new_path, int flags, uv_fs_cb cb) {
|
593
|
+
WRAP_EIO(UV_FS_SYMLINK, eio_symlink, symlink, ARGS2(path, new_path))
|
594
|
+
}
|
595
|
+
|
596
|
+
|
597
|
+
int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
598
|
+
uv_fs_cb cb) {
|
599
|
+
ssize_t size;
|
600
|
+
char* buf;
|
601
|
+
|
602
|
+
uv_fs_req_init(loop, req, UV_FS_READLINK, path, cb);
|
603
|
+
|
604
|
+
if (cb) {
|
605
|
+
if ((req->eio = eio_readlink(path, EIO_PRI_DEFAULT, uv__fs_after, req, &loop->uv_eio_channel))) {
|
606
|
+
uv_ref(loop);
|
607
|
+
return 0;
|
608
|
+
} else {
|
609
|
+
uv__set_sys_error(loop, ENOMEM);
|
610
|
+
return -1;
|
611
|
+
}
|
612
|
+
} else {
|
613
|
+
/* pathconf(_PC_PATH_MAX) may return -1 to signify that path
|
614
|
+
* lengths have no upper limit or aren't suitable for malloc'ing.
|
615
|
+
*/
|
616
|
+
if ((size = pathconf(path, _PC_PATH_MAX)) == -1) {
|
617
|
+
#if defined(PATH_MAX)
|
618
|
+
size = PATH_MAX;
|
619
|
+
#else
|
620
|
+
size = 4096;
|
621
|
+
#endif
|
622
|
+
}
|
623
|
+
|
624
|
+
if ((buf = malloc(size + 1)) == NULL) {
|
625
|
+
uv__set_sys_error(loop, ENOMEM);
|
626
|
+
return -1;
|
627
|
+
}
|
628
|
+
|
629
|
+
if ((size = readlink(path, buf, size)) == -1) {
|
630
|
+
req->errorno = errno;
|
631
|
+
req->result = -1;
|
632
|
+
free(buf);
|
633
|
+
} else {
|
634
|
+
/* Cannot conceivably fail since it shrinks the buffer. */
|
635
|
+
buf = realloc(buf, size + 1);
|
636
|
+
buf[size] = '\0';
|
637
|
+
req->result = 0;
|
638
|
+
req->ptr = buf;
|
639
|
+
}
|
640
|
+
|
641
|
+
return req->result;
|
642
|
+
}
|
643
|
+
|
644
|
+
assert(0 && "unreachable");
|
645
|
+
}
|
646
|
+
|
647
|
+
|
648
|
+
int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file, int mode,
|
649
|
+
uv_fs_cb cb) {
|
650
|
+
char* path = NULL;
|
651
|
+
WRAP_EIO(UV_FS_FCHMOD, eio_fchmod, fchmod, ARGS2(file, mode))
|
652
|
+
}
|
653
|
+
|
654
|
+
|
655
|
+
int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, int uid,
|
656
|
+
int gid, uv_fs_cb cb) {
|
657
|
+
WRAP_EIO(UV_FS_CHOWN, eio_chown, chown, ARGS3(path, uid, gid))
|
658
|
+
}
|
659
|
+
|
660
|
+
|
661
|
+
int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file, int uid, int gid,
|
662
|
+
uv_fs_cb cb) {
|
663
|
+
char* path = NULL;
|
664
|
+
WRAP_EIO(UV_FS_FCHOWN, eio_fchown, fchown, ARGS3(file, uid, gid))
|
665
|
+
}
|
666
|
+
|
667
|
+
|
668
|
+
static void uv__work(eio_req* eio) {
|
669
|
+
uv_work_t* req = eio->data;
|
670
|
+
if (req->work_cb) {
|
671
|
+
req->work_cb(req);
|
672
|
+
}
|
673
|
+
}
|
674
|
+
|
675
|
+
|
676
|
+
static int uv__after_work(eio_req *eio) {
|
677
|
+
uv_work_t* req = eio->data;
|
678
|
+
uv_unref(req->loop);
|
679
|
+
if (req->after_work_cb) {
|
680
|
+
req->after_work_cb(req);
|
681
|
+
}
|
682
|
+
return 0;
|
683
|
+
}
|
684
|
+
|
685
|
+
|
686
|
+
int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
|
687
|
+
uv_after_work_cb after_work_cb) {
|
688
|
+
void* data = req->data;
|
689
|
+
|
690
|
+
uv_eio_init(loop);
|
691
|
+
|
692
|
+
uv__req_init(loop, (uv_req_t*)req);
|
693
|
+
uv_ref(loop);
|
694
|
+
req->loop = loop;
|
695
|
+
req->data = data;
|
696
|
+
req->work_cb = work_cb;
|
697
|
+
req->after_work_cb = after_work_cb;
|
698
|
+
|
699
|
+
req->eio = eio_custom(uv__work, EIO_PRI_DEFAULT, uv__after_work, req, &loop->uv_eio_channel);
|
700
|
+
|
701
|
+
if (!req->eio) {
|
702
|
+
uv__set_sys_error(loop, ENOMEM);
|
703
|
+
return -1;
|
704
|
+
}
|
705
|
+
|
706
|
+
return 0;
|
707
|
+
}
|