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,1556 @@
|
|
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
|
+
/* See uv_loop_new for an introduction. */
|
23
|
+
|
24
|
+
#ifndef UV_H
|
25
|
+
#define UV_H
|
26
|
+
#ifdef __cplusplus
|
27
|
+
extern "C" {
|
28
|
+
#endif
|
29
|
+
|
30
|
+
#ifdef _WIN32
|
31
|
+
/* Windows - set up dll import/export decorators. */
|
32
|
+
# if defined(BUILDING_UV_SHARED)
|
33
|
+
/* Building shared library. Export everything from c-ares as well. */
|
34
|
+
# define UV_EXTERN __declspec(dllexport)
|
35
|
+
# define CARES_BUILDING_LIBRARY 1
|
36
|
+
# elif defined(USING_UV_SHARED)
|
37
|
+
/* Using shared library. Use shared c-ares as well. */
|
38
|
+
# define UV_EXTERN __declspec(dllimport)
|
39
|
+
# else
|
40
|
+
/* Building static library. Build c-ares statically as well. */
|
41
|
+
# define UV_EXTERN /* nothing */
|
42
|
+
# define CARES_STATICLIB 1
|
43
|
+
# endif
|
44
|
+
#elif __GNUC__ >= 4
|
45
|
+
# define UV_EXTERN __attribute__((visibility("default")))
|
46
|
+
#else
|
47
|
+
# define UV_EXTERN /* nothing */
|
48
|
+
#endif
|
49
|
+
|
50
|
+
|
51
|
+
#define UV_VERSION_MAJOR 0
|
52
|
+
#define UV_VERSION_MINOR 6
|
53
|
+
|
54
|
+
|
55
|
+
#include <stdint.h> /* int64_t */
|
56
|
+
#include <sys/types.h> /* size_t */
|
57
|
+
|
58
|
+
#include "ares.h"
|
59
|
+
|
60
|
+
#ifndef _SSIZE_T_
|
61
|
+
typedef intptr_t ssize_t;
|
62
|
+
#endif
|
63
|
+
|
64
|
+
#if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
|
65
|
+
# include "uv-private/uv-unix.h"
|
66
|
+
#else
|
67
|
+
# include "uv-private/uv-win.h"
|
68
|
+
#endif
|
69
|
+
|
70
|
+
/* Expand this list if necessary. */
|
71
|
+
#define UV_ERRNO_MAP(XX) \
|
72
|
+
XX( -1, UNKNOWN, "unknown error") \
|
73
|
+
XX( 0, OK, "success") \
|
74
|
+
XX( 1, EOF, "end of file") \
|
75
|
+
XX( 2, EADDRINFO, "getaddrinfo error") \
|
76
|
+
XX( 3, EACCES, "permission denied") \
|
77
|
+
XX( 4, EAGAIN, "no more processes") \
|
78
|
+
XX( 5, EADDRINUSE, "address already in use") \
|
79
|
+
XX( 6, EADDRNOTAVAIL, "") \
|
80
|
+
XX( 7, EAFNOSUPPORT, "") \
|
81
|
+
XX( 8, EALREADY, "") \
|
82
|
+
XX( 9, EBADF, "bad file descriptor") \
|
83
|
+
XX( 10, EBUSY, "resource busy or locked") \
|
84
|
+
XX( 11, ECONNABORTED, "software caused connection abort") \
|
85
|
+
XX( 12, ECONNREFUSED, "connection refused") \
|
86
|
+
XX( 13, ECONNRESET, "connection reset by peer") \
|
87
|
+
XX( 14, EDESTADDRREQ, "destination address required") \
|
88
|
+
XX( 15, EFAULT, "bad address in system call argument") \
|
89
|
+
XX( 16, EHOSTUNREACH, "host is unreachable") \
|
90
|
+
XX( 17, EINTR, "interrupted system call") \
|
91
|
+
XX( 18, EINVAL, "invalid argument") \
|
92
|
+
XX( 19, EISCONN, "socket is already connected") \
|
93
|
+
XX( 20, EMFILE, "too many open files") \
|
94
|
+
XX( 21, EMSGSIZE, "message too long") \
|
95
|
+
XX( 22, ENETDOWN, "network is down") \
|
96
|
+
XX( 23, ENETUNREACH, "network is unreachable") \
|
97
|
+
XX( 24, ENFILE, "file table overflow") \
|
98
|
+
XX( 25, ENOBUFS, "no buffer space available") \
|
99
|
+
XX( 26, ENOMEM, "not enough memory") \
|
100
|
+
XX( 27, ENOTDIR, "not a directory") \
|
101
|
+
XX( 28, EISDIR, "illegal operation on a directory") \
|
102
|
+
XX( 29, ENONET, "machine is not on the network") \
|
103
|
+
XX( 31, ENOTCONN, "socket is not connected") \
|
104
|
+
XX( 32, ENOTSOCK, "socket operation on non-socket") \
|
105
|
+
XX( 33, ENOTSUP, "operation not supported on socket") \
|
106
|
+
XX( 34, ENOENT, "no such file or directory") \
|
107
|
+
XX( 35, ENOSYS, "function not implemented") \
|
108
|
+
XX( 36, EPIPE, "broken pipe") \
|
109
|
+
XX( 37, EPROTO, "protocol error") \
|
110
|
+
XX( 38, EPROTONOSUPPORT, "protocol not supported") \
|
111
|
+
XX( 39, EPROTOTYPE, "protocol wrong type for socket") \
|
112
|
+
XX( 40, ETIMEDOUT, "connection timed out") \
|
113
|
+
XX( 41, ECHARSET, "") \
|
114
|
+
XX( 42, EAIFAMNOSUPPORT, "") \
|
115
|
+
XX( 44, EAISERVICE, "") \
|
116
|
+
XX( 45, EAISOCKTYPE, "") \
|
117
|
+
XX( 46, ESHUTDOWN, "") \
|
118
|
+
XX( 47, EEXIST, "file already exists") \
|
119
|
+
XX( 48, ESRCH, "no such process") \
|
120
|
+
XX( 49, ENAMETOOLONG, "name too long") \
|
121
|
+
XX( 50, EPERM, "operation not permitted") \
|
122
|
+
XX( 51, ELOOP, "too many symbolic links encountered") \
|
123
|
+
XX( 52, EXDEV, "cross-device link not permitted") \
|
124
|
+
XX( 53, ENOTEMPTY, "directory not empty") \
|
125
|
+
XX( 54, ENOSPC, "no space left on device") \
|
126
|
+
XX( 55, EIO, "i/o error")
|
127
|
+
|
128
|
+
|
129
|
+
#define UV_ERRNO_GEN(val, name, s) UV_##name = val,
|
130
|
+
typedef enum {
|
131
|
+
UV_ERRNO_MAP(UV_ERRNO_GEN)
|
132
|
+
UV_MAX_ERRORS
|
133
|
+
} uv_err_code;
|
134
|
+
#undef UV_ERRNO_GEN
|
135
|
+
|
136
|
+
#define UV_HANDLE_TYPE_MAP(XX) \
|
137
|
+
XX(ARES_TASK, ares_task) \
|
138
|
+
XX(ASYNC, async) \
|
139
|
+
XX(CHECK, check) \
|
140
|
+
XX(FS_EVENT, fs_event) \
|
141
|
+
XX(IDLE, idle) \
|
142
|
+
XX(NAMED_PIPE, pipe) \
|
143
|
+
XX(PREPARE, prepare) \
|
144
|
+
XX(PROCESS, process) \
|
145
|
+
XX(TCP, tcp) \
|
146
|
+
XX(TIMER, timer) \
|
147
|
+
XX(TTY, tty) \
|
148
|
+
XX(UDP, udp) \
|
149
|
+
|
150
|
+
#define UV_REQ_TYPE_MAP(XX) \
|
151
|
+
XX(CONNECT, connect) \
|
152
|
+
XX(WRITE, write) \
|
153
|
+
XX(SHUTDOWN, shutdown) \
|
154
|
+
XX(UDP_SEND, udp_send) \
|
155
|
+
XX(FS, fs) \
|
156
|
+
XX(WORK, work) \
|
157
|
+
XX(GETADDRINFO, getaddrinfo) \
|
158
|
+
|
159
|
+
typedef enum {
|
160
|
+
UV_UNKNOWN_HANDLE = 0,
|
161
|
+
#define XX(uc, lc) UV_##uc,
|
162
|
+
UV_HANDLE_TYPE_MAP(XX)
|
163
|
+
#undef XX
|
164
|
+
UV_FILE,
|
165
|
+
UV_HANDLE_TYPE_PRIVATE
|
166
|
+
UV_HANDLE_TYPE_MAX
|
167
|
+
} uv_handle_type;
|
168
|
+
|
169
|
+
typedef enum {
|
170
|
+
UV_UNKNOWN_REQ = 0,
|
171
|
+
#define XX(uc, lc) UV_##uc,
|
172
|
+
UV_REQ_TYPE_MAP(XX)
|
173
|
+
#undef XX
|
174
|
+
UV_REQ_TYPE_PRIVATE
|
175
|
+
UV_REQ_TYPE_MAX
|
176
|
+
} uv_req_type;
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
typedef struct uv_loop_s uv_loop_t;
|
181
|
+
typedef struct uv_ares_task_s uv_ares_task_t;
|
182
|
+
typedef struct uv_err_s uv_err_t;
|
183
|
+
typedef struct uv_handle_s uv_handle_t;
|
184
|
+
typedef struct uv_stream_s uv_stream_t;
|
185
|
+
typedef struct uv_tcp_s uv_tcp_t;
|
186
|
+
typedef struct uv_udp_s uv_udp_t;
|
187
|
+
typedef struct uv_pipe_s uv_pipe_t;
|
188
|
+
typedef struct uv_tty_s uv_tty_t;
|
189
|
+
typedef struct uv_timer_s uv_timer_t;
|
190
|
+
typedef struct uv_prepare_s uv_prepare_t;
|
191
|
+
typedef struct uv_check_s uv_check_t;
|
192
|
+
typedef struct uv_idle_s uv_idle_t;
|
193
|
+
typedef struct uv_async_s uv_async_t;
|
194
|
+
typedef struct uv_getaddrinfo_s uv_getaddrinfo_t;
|
195
|
+
typedef struct uv_process_s uv_process_t;
|
196
|
+
typedef struct uv_counters_s uv_counters_t;
|
197
|
+
typedef struct uv_cpu_info_s uv_cpu_info_t;
|
198
|
+
typedef struct uv_interface_address_s uv_interface_address_t;
|
199
|
+
/* Request types */
|
200
|
+
typedef struct uv_req_s uv_req_t;
|
201
|
+
typedef struct uv_shutdown_s uv_shutdown_t;
|
202
|
+
typedef struct uv_write_s uv_write_t;
|
203
|
+
typedef struct uv_connect_s uv_connect_t;
|
204
|
+
typedef struct uv_udp_send_s uv_udp_send_t;
|
205
|
+
typedef struct uv_fs_s uv_fs_t;
|
206
|
+
/* uv_fs_event_t is a subclass of uv_handle_t. */
|
207
|
+
typedef struct uv_fs_event_s uv_fs_event_t;
|
208
|
+
typedef struct uv_work_s uv_work_t;
|
209
|
+
|
210
|
+
|
211
|
+
/*
|
212
|
+
* This function must be called before any other functions in libuv.
|
213
|
+
*
|
214
|
+
* All functions besides uv_run() are non-blocking.
|
215
|
+
*
|
216
|
+
* All callbacks in libuv are made asynchronously. That is they are never
|
217
|
+
* made by the function that takes them as a parameter.
|
218
|
+
*/
|
219
|
+
UV_EXTERN uv_loop_t* uv_loop_new(void);
|
220
|
+
UV_EXTERN void uv_loop_delete(uv_loop_t*);
|
221
|
+
|
222
|
+
/* This is a debugging tool. It's NOT part of the official API. */
|
223
|
+
UV_EXTERN int uv_loop_refcount(const uv_loop_t*);
|
224
|
+
|
225
|
+
|
226
|
+
/*
|
227
|
+
* Returns the default loop.
|
228
|
+
*/
|
229
|
+
UV_EXTERN uv_loop_t* uv_default_loop(void);
|
230
|
+
|
231
|
+
/*
|
232
|
+
* This function starts the event loop. It blocks until the reference count
|
233
|
+
* of the loop drops to zero.
|
234
|
+
*/
|
235
|
+
UV_EXTERN int uv_run (uv_loop_t*);
|
236
|
+
|
237
|
+
/*
|
238
|
+
* This function polls for new events without blocking.
|
239
|
+
*/
|
240
|
+
UV_EXTERN int uv_run_once (uv_loop_t*);
|
241
|
+
|
242
|
+
/*
|
243
|
+
* Manually modify the event loop's reference count. Useful if the user wants
|
244
|
+
* to have a handle or timeout that doesn't keep the loop alive.
|
245
|
+
*/
|
246
|
+
UV_EXTERN void uv_ref(uv_loop_t*);
|
247
|
+
UV_EXTERN void uv_unref(uv_loop_t*);
|
248
|
+
|
249
|
+
UV_EXTERN void uv_update_time(uv_loop_t*);
|
250
|
+
UV_EXTERN int64_t uv_now(uv_loop_t*);
|
251
|
+
|
252
|
+
|
253
|
+
/*
|
254
|
+
* Should return a buffer that libuv can use to read data into.
|
255
|
+
*
|
256
|
+
* `suggested_size` is a hint. Returning a buffer that is smaller is perfectly
|
257
|
+
* okay as long as `buf.len > 0`.
|
258
|
+
*/
|
259
|
+
typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size);
|
260
|
+
|
261
|
+
/*
|
262
|
+
* `nread` is > 0 if there is data available, 0 if libuv is done reading for now
|
263
|
+
* or -1 on error.
|
264
|
+
*
|
265
|
+
* Error details can be obtained by calling uv_last_error(). UV_EOF indicates
|
266
|
+
* that the stream has been closed.
|
267
|
+
*
|
268
|
+
* The callee is responsible for closing the stream when an error happens.
|
269
|
+
* Trying to read from the stream again is undefined.
|
270
|
+
*
|
271
|
+
* The callee is responsible for freeing the buffer, libuv does not reuse it.
|
272
|
+
*/
|
273
|
+
typedef void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, uv_buf_t buf);
|
274
|
+
|
275
|
+
/*
|
276
|
+
* Just like the uv_read_cb except that if the pending parameter is true
|
277
|
+
* then you can use uv_accept() to pull the new handle into the process.
|
278
|
+
* If no handle is pending then pending will be UV_UNKNOWN_HANDLE.
|
279
|
+
*/
|
280
|
+
typedef void (*uv_read2_cb)(uv_pipe_t* pipe, ssize_t nread, uv_buf_t buf,
|
281
|
+
uv_handle_type pending);
|
282
|
+
|
283
|
+
typedef void (*uv_write_cb)(uv_write_t* req, int status);
|
284
|
+
typedef void (*uv_connect_cb)(uv_connect_t* req, int status);
|
285
|
+
typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status);
|
286
|
+
typedef void (*uv_connection_cb)(uv_stream_t* server, int status);
|
287
|
+
typedef void (*uv_close_cb)(uv_handle_t* handle);
|
288
|
+
typedef void (*uv_timer_cb)(uv_timer_t* handle, int status);
|
289
|
+
/* TODO: do these really need a status argument? */
|
290
|
+
typedef void (*uv_async_cb)(uv_async_t* handle, int status);
|
291
|
+
typedef void (*uv_prepare_cb)(uv_prepare_t* handle, int status);
|
292
|
+
typedef void (*uv_check_cb)(uv_check_t* handle, int status);
|
293
|
+
typedef void (*uv_idle_cb)(uv_idle_t* handle, int status);
|
294
|
+
typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* handle, int status,
|
295
|
+
struct addrinfo* res);
|
296
|
+
typedef void (*uv_exit_cb)(uv_process_t*, int exit_status, int term_signal);
|
297
|
+
typedef void (*uv_fs_cb)(uv_fs_t* req);
|
298
|
+
typedef void (*uv_work_cb)(uv_work_t* req);
|
299
|
+
typedef void (*uv_after_work_cb)(uv_work_t* req);
|
300
|
+
|
301
|
+
/*
|
302
|
+
* This will be called repeatedly after the uv_fs_event_t is initialized.
|
303
|
+
* If uv_fs_event_t was initialized with a directory the filename parameter
|
304
|
+
* will be a relative path to a file contained in the directory.
|
305
|
+
* The events parameter is an ORed mask of enum uv_fs_event elements.
|
306
|
+
*/
|
307
|
+
typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, const char* filename,
|
308
|
+
int events, int status);
|
309
|
+
|
310
|
+
typedef enum {
|
311
|
+
UV_LEAVE_GROUP = 0,
|
312
|
+
UV_JOIN_GROUP
|
313
|
+
} uv_membership;
|
314
|
+
|
315
|
+
|
316
|
+
struct uv_err_s {
|
317
|
+
/* read-only */
|
318
|
+
uv_err_code code;
|
319
|
+
/* private */
|
320
|
+
int sys_errno_;
|
321
|
+
};
|
322
|
+
|
323
|
+
|
324
|
+
/*
|
325
|
+
* Most functions return boolean: 0 for success and -1 for failure.
|
326
|
+
* On error the user should then call uv_last_error() to determine
|
327
|
+
* the error code.
|
328
|
+
*/
|
329
|
+
UV_EXTERN uv_err_t uv_last_error(uv_loop_t*);
|
330
|
+
UV_EXTERN const char* uv_strerror(uv_err_t err);
|
331
|
+
UV_EXTERN const char* uv_err_name(uv_err_t err);
|
332
|
+
|
333
|
+
|
334
|
+
#define UV_REQ_FIELDS \
|
335
|
+
/* read-only */ \
|
336
|
+
uv_req_type type; \
|
337
|
+
/* public */ \
|
338
|
+
void* data; \
|
339
|
+
/* private */ \
|
340
|
+
UV_REQ_PRIVATE_FIELDS
|
341
|
+
|
342
|
+
/* Abstract base class of all requests. */
|
343
|
+
struct uv_req_s {
|
344
|
+
UV_REQ_FIELDS
|
345
|
+
};
|
346
|
+
|
347
|
+
|
348
|
+
/* Platform-specific request types */
|
349
|
+
UV_PRIVATE_REQ_TYPES
|
350
|
+
|
351
|
+
|
352
|
+
/*
|
353
|
+
* uv_shutdown_t is a subclass of uv_req_t
|
354
|
+
*
|
355
|
+
* Shutdown the outgoing (write) side of a duplex stream. It waits for
|
356
|
+
* pending write requests to complete. The handle should refer to a
|
357
|
+
* initialized stream. req should be an uninitialized shutdown request
|
358
|
+
* struct. The cb is called after shutdown is complete.
|
359
|
+
*/
|
360
|
+
UV_EXTERN int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle,
|
361
|
+
uv_shutdown_cb cb);
|
362
|
+
|
363
|
+
struct uv_shutdown_s {
|
364
|
+
UV_REQ_FIELDS
|
365
|
+
uv_stream_t* handle;
|
366
|
+
uv_shutdown_cb cb;
|
367
|
+
UV_SHUTDOWN_PRIVATE_FIELDS
|
368
|
+
};
|
369
|
+
|
370
|
+
|
371
|
+
#define UV_HANDLE_FIELDS \
|
372
|
+
/* read-only */ \
|
373
|
+
uv_loop_t* loop; \
|
374
|
+
uv_handle_type type; \
|
375
|
+
/* public */ \
|
376
|
+
uv_close_cb close_cb; \
|
377
|
+
void* data; \
|
378
|
+
/* private */ \
|
379
|
+
UV_HANDLE_PRIVATE_FIELDS
|
380
|
+
|
381
|
+
/* The abstract base class of all handles. */
|
382
|
+
struct uv_handle_s {
|
383
|
+
UV_HANDLE_FIELDS
|
384
|
+
};
|
385
|
+
|
386
|
+
/*
|
387
|
+
* Returns size of various handle types, useful for FFI
|
388
|
+
* bindings to allocate correct memory without copying struct
|
389
|
+
* definitions
|
390
|
+
*/
|
391
|
+
UV_EXTERN size_t uv_handle_size(uv_handle_type type);
|
392
|
+
|
393
|
+
/*
|
394
|
+
* Returns size of request types, useful for dynamic lookup with FFI
|
395
|
+
*/
|
396
|
+
UV_EXTERN size_t uv_req_size(uv_req_type type);
|
397
|
+
|
398
|
+
/*
|
399
|
+
* Returns 1 if the prepare/check/idle/timer handle has been started, 0
|
400
|
+
* otherwise. For other handle types this always returns 1.
|
401
|
+
*/
|
402
|
+
UV_EXTERN int uv_is_active(uv_handle_t* handle);
|
403
|
+
|
404
|
+
/*
|
405
|
+
* Request handle to be closed. close_cb will be called asynchronously after
|
406
|
+
* this call. This MUST be called on each handle before memory is released.
|
407
|
+
*
|
408
|
+
* Note that handles that wrap file descriptors are closed immediately but
|
409
|
+
* close_cb will still be deferred to the next iteration of the event loop.
|
410
|
+
* It gives you a chance to free up any resources associated with the handle.
|
411
|
+
*/
|
412
|
+
UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
|
413
|
+
|
414
|
+
|
415
|
+
/*
|
416
|
+
* Constructor for uv_buf_t.
|
417
|
+
* Due to platform differences the user cannot rely on the ordering of the
|
418
|
+
* base and len members of the uv_buf_t struct. The user is responsible for
|
419
|
+
* freeing base after the uv_buf_t is done. Return struct passed by value.
|
420
|
+
*/
|
421
|
+
UV_EXTERN uv_buf_t uv_buf_init(char* base, size_t len);
|
422
|
+
|
423
|
+
|
424
|
+
/*
|
425
|
+
* Utility function. Copies up to `size` characters from `src` to `dst`
|
426
|
+
* and ensures that `dst` is properly NUL terminated unless `size` is zero.
|
427
|
+
*/
|
428
|
+
UV_EXTERN size_t uv_strlcpy(char* dst, const char* src, size_t size);
|
429
|
+
|
430
|
+
/*
|
431
|
+
* Utility function. Appends `src` to `dst` and ensures that `dst` is
|
432
|
+
* properly NUL terminated unless `size` is zero or `dst` does not
|
433
|
+
* contain a NUL byte. `size` is the total length of `dst` so at most
|
434
|
+
* `size - strlen(dst) - 1` characters will be copied from `src`.
|
435
|
+
*/
|
436
|
+
UV_EXTERN size_t uv_strlcat(char* dst, const char* src, size_t size);
|
437
|
+
|
438
|
+
|
439
|
+
#define UV_STREAM_FIELDS \
|
440
|
+
/* number of bytes queued for writing */ \
|
441
|
+
size_t write_queue_size; \
|
442
|
+
uv_alloc_cb alloc_cb; \
|
443
|
+
uv_read_cb read_cb; \
|
444
|
+
uv_read2_cb read2_cb; \
|
445
|
+
/* private */ \
|
446
|
+
UV_STREAM_PRIVATE_FIELDS
|
447
|
+
|
448
|
+
/*
|
449
|
+
* uv_stream_t is a subclass of uv_handle_t
|
450
|
+
*
|
451
|
+
* uv_stream is an abstract class.
|
452
|
+
*
|
453
|
+
* uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t, uv_tty_t, and
|
454
|
+
* soon uv_file_t.
|
455
|
+
*/
|
456
|
+
struct uv_stream_s {
|
457
|
+
UV_HANDLE_FIELDS
|
458
|
+
UV_STREAM_FIELDS
|
459
|
+
};
|
460
|
+
|
461
|
+
UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb);
|
462
|
+
|
463
|
+
/*
|
464
|
+
* This call is used in conjunction with uv_listen() to accept incoming
|
465
|
+
* connections. Call uv_accept after receiving a uv_connection_cb to accept
|
466
|
+
* the connection. Before calling uv_accept use uv_*_init() must be
|
467
|
+
* called on the client. Non-zero return value indicates an error.
|
468
|
+
*
|
469
|
+
* When the uv_connection_cb is called it is guaranteed that uv_accept will
|
470
|
+
* complete successfully the first time. If you attempt to use it more than
|
471
|
+
* once, it may fail. It is suggested to only call uv_accept once per
|
472
|
+
* uv_connection_cb call.
|
473
|
+
*/
|
474
|
+
UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client);
|
475
|
+
|
476
|
+
/*
|
477
|
+
* Read data from an incoming stream. The callback will be made several
|
478
|
+
* several times until there is no more data to read or uv_read_stop is
|
479
|
+
* called. When we've reached EOF nread will be set to -1 and the error is
|
480
|
+
* set to UV_EOF. When nread == -1 the buf parameter might not point to a
|
481
|
+
* valid buffer; in that case buf.len and buf.base are both set to 0.
|
482
|
+
* Note that nread might also be 0, which does *not* indicate an error or
|
483
|
+
* eof; it happens when libuv requested a buffer through the alloc callback
|
484
|
+
* but then decided that it didn't need that buffer.
|
485
|
+
*/
|
486
|
+
UV_EXTERN int uv_read_start(uv_stream_t*, uv_alloc_cb alloc_cb,
|
487
|
+
uv_read_cb read_cb);
|
488
|
+
|
489
|
+
UV_EXTERN int uv_read_stop(uv_stream_t*);
|
490
|
+
|
491
|
+
/*
|
492
|
+
* Extended read methods for receiving handles over a pipe. The pipe must be
|
493
|
+
* initialized with ipc == 1.
|
494
|
+
*/
|
495
|
+
UV_EXTERN int uv_read2_start(uv_stream_t*, uv_alloc_cb alloc_cb,
|
496
|
+
uv_read2_cb read_cb);
|
497
|
+
|
498
|
+
|
499
|
+
/*
|
500
|
+
* Write data to stream. Buffers are written in order. Example:
|
501
|
+
*
|
502
|
+
* uv_buf_t a[] = {
|
503
|
+
* { .base = "1", .len = 1 },
|
504
|
+
* { .base = "2", .len = 1 }
|
505
|
+
* };
|
506
|
+
*
|
507
|
+
* uv_buf_t b[] = {
|
508
|
+
* { .base = "3", .len = 1 },
|
509
|
+
* { .base = "4", .len = 1 }
|
510
|
+
* };
|
511
|
+
*
|
512
|
+
* // writes "1234"
|
513
|
+
* uv_write(req, stream, a, 2);
|
514
|
+
* uv_write(req, stream, b, 2);
|
515
|
+
*
|
516
|
+
*/
|
517
|
+
UV_EXTERN int uv_write(uv_write_t* req, uv_stream_t* handle,
|
518
|
+
uv_buf_t bufs[], int bufcnt, uv_write_cb cb);
|
519
|
+
|
520
|
+
/*
|
521
|
+
* Extended write function for sending handles over a pipe. The pipe must be
|
522
|
+
* initialized with ipc == 1.
|
523
|
+
* send_handle must be a TCP socket or pipe, which is a server or a connection
|
524
|
+
* (listening or connected state). Bound sockets or pipes will be assumed to
|
525
|
+
* be servers.
|
526
|
+
*/
|
527
|
+
UV_EXTERN int uv_write2(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[],
|
528
|
+
int bufcnt, uv_stream_t* send_handle, uv_write_cb cb);
|
529
|
+
|
530
|
+
/* uv_write_t is a subclass of uv_req_t */
|
531
|
+
struct uv_write_s {
|
532
|
+
UV_REQ_FIELDS
|
533
|
+
uv_write_cb cb;
|
534
|
+
uv_stream_t* send_handle;
|
535
|
+
uv_stream_t* handle;
|
536
|
+
UV_WRITE_PRIVATE_FIELDS
|
537
|
+
};
|
538
|
+
|
539
|
+
|
540
|
+
/*
|
541
|
+
* Used to determine whether a stream is readable or writable.
|
542
|
+
*/
|
543
|
+
UV_EXTERN int uv_is_readable(uv_stream_t* handle);
|
544
|
+
UV_EXTERN int uv_is_writable(uv_stream_t* handle);
|
545
|
+
|
546
|
+
|
547
|
+
/*
|
548
|
+
* Used to determine whether a stream is closing or closed.
|
549
|
+
*
|
550
|
+
* N.B. is only valid between the initialization of the handle
|
551
|
+
* and the arrival of the close callback, and cannot be used
|
552
|
+
* to validate the handle.
|
553
|
+
*/
|
554
|
+
UV_EXTERN int uv_is_closing(uv_handle_t* handle);
|
555
|
+
|
556
|
+
|
557
|
+
/*
|
558
|
+
* uv_tcp_t is a subclass of uv_stream_t
|
559
|
+
*
|
560
|
+
* Represents a TCP stream or TCP server.
|
561
|
+
*/
|
562
|
+
struct uv_tcp_s {
|
563
|
+
UV_HANDLE_FIELDS
|
564
|
+
UV_STREAM_FIELDS
|
565
|
+
UV_TCP_PRIVATE_FIELDS
|
566
|
+
};
|
567
|
+
|
568
|
+
UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle);
|
569
|
+
|
570
|
+
/* Enable/disable Nagle's algorithm. */
|
571
|
+
UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable);
|
572
|
+
|
573
|
+
/* Enable/disable TCP keep-alive.
|
574
|
+
*
|
575
|
+
* `ms` is the initial delay in seconds, ignored when `enable` is zero.
|
576
|
+
*/
|
577
|
+
UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, int enable,
|
578
|
+
unsigned int delay);
|
579
|
+
|
580
|
+
/*
|
581
|
+
* This setting applies to Windows only.
|
582
|
+
* Enable/disable simultaneous asynchronous accept requests that are
|
583
|
+
* queued by the operating system when listening for new tcp connections.
|
584
|
+
* This setting is used to tune a tcp server for the desired performance.
|
585
|
+
* Having simultaneous accepts can significantly improve the rate of
|
586
|
+
* accepting connections (which is why it is enabled by default).
|
587
|
+
*/
|
588
|
+
UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable);
|
589
|
+
|
590
|
+
UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, struct sockaddr_in);
|
591
|
+
UV_EXTERN int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6);
|
592
|
+
UV_EXTERN int uv_tcp_getsockname(uv_tcp_t* handle, struct sockaddr* name,
|
593
|
+
int* namelen);
|
594
|
+
UV_EXTERN int uv_tcp_getpeername(uv_tcp_t* handle, struct sockaddr* name,
|
595
|
+
int* namelen);
|
596
|
+
|
597
|
+
/*
|
598
|
+
* uv_tcp_connect, uv_tcp_connect6
|
599
|
+
* These functions establish IPv4 and IPv6 TCP connections. Provide an
|
600
|
+
* initialized TCP handle and an uninitialized uv_connect_t*. The callback
|
601
|
+
* will be made when the connection is established.
|
602
|
+
*/
|
603
|
+
UV_EXTERN int uv_tcp_connect(uv_connect_t* req, uv_tcp_t* handle,
|
604
|
+
struct sockaddr_in address, uv_connect_cb cb);
|
605
|
+
UV_EXTERN int uv_tcp_connect6(uv_connect_t* req, uv_tcp_t* handle,
|
606
|
+
struct sockaddr_in6 address, uv_connect_cb cb);
|
607
|
+
|
608
|
+
/* uv_connect_t is a subclass of uv_req_t */
|
609
|
+
struct uv_connect_s {
|
610
|
+
UV_REQ_FIELDS
|
611
|
+
uv_connect_cb cb;
|
612
|
+
uv_stream_t* handle;
|
613
|
+
UV_CONNECT_PRIVATE_FIELDS
|
614
|
+
};
|
615
|
+
|
616
|
+
|
617
|
+
/*
|
618
|
+
* UDP support.
|
619
|
+
*/
|
620
|
+
|
621
|
+
enum uv_udp_flags {
|
622
|
+
/* Disables dual stack mode. Used with uv_udp_bind6(). */
|
623
|
+
UV_UDP_IPV6ONLY = 1,
|
624
|
+
/*
|
625
|
+
* Indicates message was truncated because read buffer was too small. The
|
626
|
+
* remainder was discarded by the OS. Used in uv_udp_recv_cb.
|
627
|
+
*/
|
628
|
+
UV_UDP_PARTIAL = 2
|
629
|
+
};
|
630
|
+
|
631
|
+
/*
|
632
|
+
* Called after a uv_udp_send() or uv_udp_send6(). status 0 indicates
|
633
|
+
* success otherwise error.
|
634
|
+
*/
|
635
|
+
typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status);
|
636
|
+
|
637
|
+
/*
|
638
|
+
* Callback that is invoked when a new UDP datagram is received.
|
639
|
+
*
|
640
|
+
* handle UDP handle.
|
641
|
+
* nread Number of bytes that have been received.
|
642
|
+
* 0 if there is no more data to read. You may
|
643
|
+
* discard or repurpose the read buffer.
|
644
|
+
* -1 if a transmission error was detected.
|
645
|
+
* buf uv_buf_t with the received data.
|
646
|
+
* addr struct sockaddr_in or struct sockaddr_in6.
|
647
|
+
* Valid for the duration of the callback only.
|
648
|
+
* flags One or more OR'ed UV_UDP_* constants.
|
649
|
+
* Right now only UV_UDP_PARTIAL is used.
|
650
|
+
*/
|
651
|
+
typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, ssize_t nread, uv_buf_t buf,
|
652
|
+
struct sockaddr* addr, unsigned flags);
|
653
|
+
|
654
|
+
/* uv_udp_t is a subclass of uv_handle_t */
|
655
|
+
struct uv_udp_s {
|
656
|
+
UV_HANDLE_FIELDS
|
657
|
+
UV_UDP_PRIVATE_FIELDS
|
658
|
+
};
|
659
|
+
|
660
|
+
/* uv_udp_send_t is a subclass of uv_req_t */
|
661
|
+
struct uv_udp_send_s {
|
662
|
+
UV_REQ_FIELDS
|
663
|
+
uv_udp_t* handle;
|
664
|
+
uv_udp_send_cb cb;
|
665
|
+
UV_UDP_SEND_PRIVATE_FIELDS
|
666
|
+
};
|
667
|
+
|
668
|
+
/*
|
669
|
+
* Initialize a new UDP handle. The actual socket is created lazily.
|
670
|
+
* Returns 0 on success.
|
671
|
+
*/
|
672
|
+
UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
|
673
|
+
|
674
|
+
/*
|
675
|
+
* Bind to a IPv4 address and port.
|
676
|
+
*
|
677
|
+
* Arguments:
|
678
|
+
* handle UDP handle. Should have been initialized with `uv_udp_init`.
|
679
|
+
* addr struct sockaddr_in with the address and port to bind to.
|
680
|
+
* flags Unused.
|
681
|
+
*
|
682
|
+
* Returns:
|
683
|
+
* 0 on success, -1 on error.
|
684
|
+
*/
|
685
|
+
UV_EXTERN int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr,
|
686
|
+
unsigned flags);
|
687
|
+
|
688
|
+
/*
|
689
|
+
* Bind to a IPv6 address and port.
|
690
|
+
*
|
691
|
+
* Arguments:
|
692
|
+
* handle UDP handle. Should have been initialized with `uv_udp_init`.
|
693
|
+
* addr struct sockaddr_in with the address and port to bind to.
|
694
|
+
* flags Should be 0 or UV_UDP_IPV6ONLY.
|
695
|
+
*
|
696
|
+
* Returns:
|
697
|
+
* 0 on success, -1 on error.
|
698
|
+
*/
|
699
|
+
UV_EXTERN int uv_udp_bind6(uv_udp_t* handle, struct sockaddr_in6 addr,
|
700
|
+
unsigned flags);
|
701
|
+
UV_EXTERN int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name,
|
702
|
+
int* namelen);
|
703
|
+
|
704
|
+
/*
|
705
|
+
* Set membership for a multicast address
|
706
|
+
*
|
707
|
+
* Arguments:
|
708
|
+
* handle UDP handle. Should have been initialized with
|
709
|
+
* `uv_udp_init`.
|
710
|
+
* multicast_addr multicast address to set membership for
|
711
|
+
* interface_addr interface address
|
712
|
+
* membership Should be UV_JOIN_GROUP or UV_LEAVE_GROUP
|
713
|
+
*
|
714
|
+
* Returns:
|
715
|
+
* 0 on success, -1 on error.
|
716
|
+
*/
|
717
|
+
UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
|
718
|
+
const char* multicast_addr, const char* interface_addr,
|
719
|
+
uv_membership membership);
|
720
|
+
|
721
|
+
/*
|
722
|
+
* Set IP multicast loop flag. Makes multicast packets loop back to
|
723
|
+
* local sockets.
|
724
|
+
*
|
725
|
+
* Arguments:
|
726
|
+
* handle UDP handle. Should have been initialized with
|
727
|
+
* `uv_udp_init`.
|
728
|
+
* on 1 for on, 0 for off
|
729
|
+
*
|
730
|
+
* Returns:
|
731
|
+
* 0 on success, -1 on error.
|
732
|
+
*/
|
733
|
+
UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on);
|
734
|
+
|
735
|
+
/*
|
736
|
+
* Set the multicast ttl
|
737
|
+
*
|
738
|
+
* Arguments:
|
739
|
+
* handle UDP handle. Should have been initialized with
|
740
|
+
* `uv_udp_init`.
|
741
|
+
* ttl 1 through 255
|
742
|
+
*
|
743
|
+
* Returns:
|
744
|
+
* 0 on success, -1 on error.
|
745
|
+
*/
|
746
|
+
UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
|
747
|
+
|
748
|
+
/*
|
749
|
+
* Set broadcast on or off
|
750
|
+
*
|
751
|
+
* Arguments:
|
752
|
+
* handle UDP handle. Should have been initialized with
|
753
|
+
* `uv_udp_init`.
|
754
|
+
* on 1 for on, 0 for off
|
755
|
+
*
|
756
|
+
* Returns:
|
757
|
+
* 0 on success, -1 on error.
|
758
|
+
*/
|
759
|
+
UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on);
|
760
|
+
|
761
|
+
/*
|
762
|
+
* Set the time to live
|
763
|
+
*
|
764
|
+
* Arguments:
|
765
|
+
* handle UDP handle. Should have been initialized with
|
766
|
+
* `uv_udp_init`.
|
767
|
+
* ttl 1 through 255
|
768
|
+
*
|
769
|
+
* Returns:
|
770
|
+
* 0 on success, -1 on error.
|
771
|
+
*/
|
772
|
+
UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl);
|
773
|
+
|
774
|
+
/*
|
775
|
+
* Send data. If the socket has not previously been bound with `uv_udp_bind`
|
776
|
+
* or `uv_udp_bind6`, it is bound to 0.0.0.0 (the "all interfaces" address)
|
777
|
+
* and a random port number.
|
778
|
+
*
|
779
|
+
* Arguments:
|
780
|
+
* req UDP request handle. Need not be initialized.
|
781
|
+
* handle UDP handle. Should have been initialized with `uv_udp_init`.
|
782
|
+
* bufs List of buffers to send.
|
783
|
+
* bufcnt Number of buffers in `bufs`.
|
784
|
+
* addr Address of the remote peer. See `uv_ip4_addr`.
|
785
|
+
* send_cb Callback to invoke when the data has been sent out.
|
786
|
+
*
|
787
|
+
* Returns:
|
788
|
+
* 0 on success, -1 on error.
|
789
|
+
*/
|
790
|
+
UV_EXTERN int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle,
|
791
|
+
uv_buf_t bufs[], int bufcnt, struct sockaddr_in addr,
|
792
|
+
uv_udp_send_cb send_cb);
|
793
|
+
|
794
|
+
/*
|
795
|
+
* Send data. If the socket has not previously been bound with `uv_udp_bind6`,
|
796
|
+
* it is bound to ::0 (the "all interfaces" address) and a random port number.
|
797
|
+
*
|
798
|
+
* Arguments:
|
799
|
+
* req UDP request handle. Need not be initialized.
|
800
|
+
* handle UDP handle. Should have been initialized with `uv_udp_init`.
|
801
|
+
* bufs List of buffers to send.
|
802
|
+
* bufcnt Number of buffers in `bufs`.
|
803
|
+
* addr Address of the remote peer. See `uv_ip6_addr`.
|
804
|
+
* send_cb Callback to invoke when the data has been sent out.
|
805
|
+
*
|
806
|
+
* Returns:
|
807
|
+
* 0 on success, -1 on error.
|
808
|
+
*/
|
809
|
+
UV_EXTERN int uv_udp_send6(uv_udp_send_t* req, uv_udp_t* handle,
|
810
|
+
uv_buf_t bufs[], int bufcnt, struct sockaddr_in6 addr,
|
811
|
+
uv_udp_send_cb send_cb);
|
812
|
+
|
813
|
+
/*
|
814
|
+
* Receive data. If the socket has not previously been bound with `uv_udp_bind`
|
815
|
+
* or `uv_udp_bind6`, it is bound to 0.0.0.0 (the "all interfaces" address)
|
816
|
+
* and a random port number.
|
817
|
+
*
|
818
|
+
* Arguments:
|
819
|
+
* handle UDP handle. Should have been initialized with `uv_udp_init`.
|
820
|
+
* alloc_cb Callback to invoke when temporary storage is needed.
|
821
|
+
* recv_cb Callback to invoke with received data.
|
822
|
+
*
|
823
|
+
* Returns:
|
824
|
+
* 0 on success, -1 on error.
|
825
|
+
*/
|
826
|
+
UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
|
827
|
+
uv_udp_recv_cb recv_cb);
|
828
|
+
|
829
|
+
/*
|
830
|
+
* Stop listening for incoming datagrams.
|
831
|
+
*
|
832
|
+
* Arguments:
|
833
|
+
* handle UDP handle. Should have been initialized with `uv_udp_init`.
|
834
|
+
*
|
835
|
+
* Returns:
|
836
|
+
* 0 on success, -1 on error.
|
837
|
+
*/
|
838
|
+
UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle);
|
839
|
+
|
840
|
+
|
841
|
+
/*
|
842
|
+
* uv_tty_t is a subclass of uv_stream_t
|
843
|
+
*
|
844
|
+
* Representing a stream for the console.
|
845
|
+
*/
|
846
|
+
struct uv_tty_s {
|
847
|
+
UV_HANDLE_FIELDS
|
848
|
+
UV_STREAM_FIELDS
|
849
|
+
UV_TTY_PRIVATE_FIELDS
|
850
|
+
};
|
851
|
+
|
852
|
+
/*
|
853
|
+
* Initialize a new TTY stream with the given file descriptor. Usually the
|
854
|
+
* file descriptor will be
|
855
|
+
* 0 = stdin
|
856
|
+
* 1 = stdout
|
857
|
+
* 2 = stderr
|
858
|
+
* The last argument, readable, specifies if you plan on calling
|
859
|
+
* uv_read_start with this stream. stdin is readable, stdout is not.
|
860
|
+
*
|
861
|
+
* TTY streams which are not readable have blocking writes.
|
862
|
+
*/
|
863
|
+
UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable);
|
864
|
+
|
865
|
+
/*
|
866
|
+
* Set mode. 0 for normal, 1 for raw.
|
867
|
+
*/
|
868
|
+
UV_EXTERN int uv_tty_set_mode(uv_tty_t*, int mode);
|
869
|
+
|
870
|
+
/*
|
871
|
+
* To be called when the program exits. Resets TTY settings to default
|
872
|
+
* values for the next process to take over.
|
873
|
+
*/
|
874
|
+
UV_EXTERN void uv_tty_reset_mode(void);
|
875
|
+
|
876
|
+
/*
|
877
|
+
* Gets the current Window size. On success zero is returned.
|
878
|
+
*/
|
879
|
+
UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height);
|
880
|
+
|
881
|
+
/*
|
882
|
+
* Used to detect what type of stream should be used with a given file
|
883
|
+
* descriptor. Usually this will be used during initialization to guess the
|
884
|
+
* type of the stdio streams.
|
885
|
+
* For isatty() functionality use this function and test for UV_TTY.
|
886
|
+
*/
|
887
|
+
UV_EXTERN uv_handle_type uv_guess_handle(uv_file file);
|
888
|
+
|
889
|
+
/*
|
890
|
+
* uv_pipe_t is a subclass of uv_stream_t
|
891
|
+
*
|
892
|
+
* Representing a pipe stream or pipe server. On Windows this is a Named
|
893
|
+
* Pipe. On Unix this is a UNIX domain socket.
|
894
|
+
*/
|
895
|
+
struct uv_pipe_s {
|
896
|
+
UV_HANDLE_FIELDS
|
897
|
+
UV_STREAM_FIELDS
|
898
|
+
UV_PIPE_PRIVATE_FIELDS
|
899
|
+
int ipc; /* non-zero if this pipe is used for passing handles */
|
900
|
+
};
|
901
|
+
|
902
|
+
/*
|
903
|
+
* Initialize a pipe. The last argument is a boolean to indicate if
|
904
|
+
* this pipe will be used for handle passing between processes.
|
905
|
+
*/
|
906
|
+
UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc);
|
907
|
+
|
908
|
+
/*
|
909
|
+
* Opens an existing file descriptor or HANDLE as a pipe.
|
910
|
+
*/
|
911
|
+
UV_EXTERN void uv_pipe_open(uv_pipe_t*, uv_file file);
|
912
|
+
|
913
|
+
UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name);
|
914
|
+
|
915
|
+
UV_EXTERN void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
|
916
|
+
const char* name, uv_connect_cb cb);
|
917
|
+
|
918
|
+
/*
|
919
|
+
* This setting applies to Windows only.
|
920
|
+
* Set the number of pending pipe instance handles when the pipe server
|
921
|
+
* is waiting for connections.
|
922
|
+
*/
|
923
|
+
UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count);
|
924
|
+
|
925
|
+
|
926
|
+
/*
|
927
|
+
* uv_prepare_t is a subclass of uv_handle_t.
|
928
|
+
*
|
929
|
+
* libev wrapper. Every active prepare handle gets its callback called
|
930
|
+
* exactly once per loop iteration, just before the system blocks to wait
|
931
|
+
* for completed i/o.
|
932
|
+
*/
|
933
|
+
struct uv_prepare_s {
|
934
|
+
UV_HANDLE_FIELDS
|
935
|
+
UV_PREPARE_PRIVATE_FIELDS
|
936
|
+
};
|
937
|
+
|
938
|
+
UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare);
|
939
|
+
|
940
|
+
UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb);
|
941
|
+
|
942
|
+
UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare);
|
943
|
+
|
944
|
+
|
945
|
+
/*
|
946
|
+
* uv_check_t is a subclass of uv_handle_t.
|
947
|
+
*
|
948
|
+
* libev wrapper. Every active check handle gets its callback called exactly
|
949
|
+
* once per loop iteration, just after the system returns from blocking.
|
950
|
+
*/
|
951
|
+
struct uv_check_s {
|
952
|
+
UV_HANDLE_FIELDS
|
953
|
+
UV_CHECK_PRIVATE_FIELDS
|
954
|
+
};
|
955
|
+
|
956
|
+
UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check);
|
957
|
+
|
958
|
+
UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb);
|
959
|
+
|
960
|
+
UV_EXTERN int uv_check_stop(uv_check_t* check);
|
961
|
+
|
962
|
+
|
963
|
+
/*
|
964
|
+
* uv_idle_t is a subclass of uv_handle_t.
|
965
|
+
*
|
966
|
+
* libev wrapper. Every active idle handle gets its callback called
|
967
|
+
* repeatedly until it is stopped. This happens after all other types of
|
968
|
+
* callbacks are processed. When there are multiple "idle" handles active,
|
969
|
+
* their callbacks are called in turn.
|
970
|
+
*/
|
971
|
+
struct uv_idle_s {
|
972
|
+
UV_HANDLE_FIELDS
|
973
|
+
UV_IDLE_PRIVATE_FIELDS
|
974
|
+
};
|
975
|
+
|
976
|
+
UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle);
|
977
|
+
|
978
|
+
UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb);
|
979
|
+
|
980
|
+
UV_EXTERN int uv_idle_stop(uv_idle_t* idle);
|
981
|
+
|
982
|
+
|
983
|
+
/*
|
984
|
+
* uv_async_t is a subclass of uv_handle_t.
|
985
|
+
*
|
986
|
+
* libev wrapper. uv_async_send wakes up the event
|
987
|
+
* loop and calls the async handle's callback There is no guarantee that
|
988
|
+
* every uv_async_send call leads to exactly one invocation of the callback;
|
989
|
+
* The only guarantee is that the callback function is called at least once
|
990
|
+
* after the call to async_send. Unlike all other libuv functions,
|
991
|
+
* uv_async_send can be called from another thread.
|
992
|
+
*/
|
993
|
+
struct uv_async_s {
|
994
|
+
UV_HANDLE_FIELDS
|
995
|
+
UV_ASYNC_PRIVATE_FIELDS
|
996
|
+
};
|
997
|
+
|
998
|
+
UV_EXTERN int uv_async_init(uv_loop_t*, uv_async_t* async,
|
999
|
+
uv_async_cb async_cb);
|
1000
|
+
|
1001
|
+
/*
|
1002
|
+
* This can be called from other threads to wake up a libuv thread.
|
1003
|
+
*
|
1004
|
+
* libuv is single threaded at the moment.
|
1005
|
+
*/
|
1006
|
+
UV_EXTERN int uv_async_send(uv_async_t* async);
|
1007
|
+
|
1008
|
+
|
1009
|
+
/*
|
1010
|
+
* uv_timer_t is a subclass of uv_handle_t.
|
1011
|
+
*
|
1012
|
+
* Wraps libev's ev_timer watcher. Used to get woken up at a specified time
|
1013
|
+
* in the future.
|
1014
|
+
*/
|
1015
|
+
struct uv_timer_s {
|
1016
|
+
UV_HANDLE_FIELDS
|
1017
|
+
UV_TIMER_PRIVATE_FIELDS
|
1018
|
+
};
|
1019
|
+
|
1020
|
+
UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* timer);
|
1021
|
+
|
1022
|
+
UV_EXTERN int uv_timer_start(uv_timer_t* timer, uv_timer_cb cb,
|
1023
|
+
int64_t timeout, int64_t repeat);
|
1024
|
+
|
1025
|
+
UV_EXTERN int uv_timer_stop(uv_timer_t* timer);
|
1026
|
+
|
1027
|
+
/*
|
1028
|
+
* Stop the timer, and if it is repeating restart it using the repeat value
|
1029
|
+
* as the timeout. If the timer has never been started before it returns -1 and
|
1030
|
+
* sets the error to UV_EINVAL.
|
1031
|
+
*/
|
1032
|
+
UV_EXTERN int uv_timer_again(uv_timer_t* timer);
|
1033
|
+
|
1034
|
+
/*
|
1035
|
+
* Set the repeat value. Note that if the repeat value is set from a timer
|
1036
|
+
* callback it does not immediately take effect. If the timer was non-repeating
|
1037
|
+
* before, it will have been stopped. If it was repeating, then the old repeat
|
1038
|
+
* value will have been used to schedule the next timeout.
|
1039
|
+
*/
|
1040
|
+
UV_EXTERN void uv_timer_set_repeat(uv_timer_t* timer, int64_t repeat);
|
1041
|
+
|
1042
|
+
UV_EXTERN int64_t uv_timer_get_repeat(uv_timer_t* timer);
|
1043
|
+
|
1044
|
+
|
1045
|
+
/* c-ares integration initialize and terminate */
|
1046
|
+
UV_EXTERN int uv_ares_init_options(uv_loop_t*,
|
1047
|
+
ares_channel *channelptr, struct ares_options *options, int optmask);
|
1048
|
+
|
1049
|
+
/* TODO remove the loop argument from this function? */
|
1050
|
+
UV_EXTERN void uv_ares_destroy(uv_loop_t*, ares_channel channel);
|
1051
|
+
|
1052
|
+
|
1053
|
+
/*
|
1054
|
+
* uv_getaddrinfo_t is a subclass of uv_req_t
|
1055
|
+
*
|
1056
|
+
* Request object for uv_getaddrinfo.
|
1057
|
+
*/
|
1058
|
+
struct uv_getaddrinfo_s {
|
1059
|
+
UV_REQ_FIELDS
|
1060
|
+
/* read-only */
|
1061
|
+
uv_loop_t* loop; \
|
1062
|
+
UV_GETADDRINFO_PRIVATE_FIELDS
|
1063
|
+
};
|
1064
|
+
|
1065
|
+
|
1066
|
+
/*
|
1067
|
+
* Asynchronous getaddrinfo(3).
|
1068
|
+
*
|
1069
|
+
* Return code 0 means that request is accepted and callback will be called
|
1070
|
+
* with result. Other return codes mean that there will not be a callback.
|
1071
|
+
* Input arguments may be released after return from this call.
|
1072
|
+
*
|
1073
|
+
* uv_freeaddrinfo() must be called after completion to free the addrinfo
|
1074
|
+
* structure.
|
1075
|
+
*
|
1076
|
+
* On error NXDOMAIN the status code will be non-zero and UV_ENOENT returned.
|
1077
|
+
*/
|
1078
|
+
UV_EXTERN int uv_getaddrinfo(uv_loop_t*, uv_getaddrinfo_t* handle,
|
1079
|
+
uv_getaddrinfo_cb getaddrinfo_cb, const char* node, const char* service,
|
1080
|
+
const struct addrinfo* hints);
|
1081
|
+
|
1082
|
+
UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai);
|
1083
|
+
|
1084
|
+
/* uv_spawn() options */
|
1085
|
+
typedef struct uv_process_options_s {
|
1086
|
+
uv_exit_cb exit_cb; /* Called after the process exits. */
|
1087
|
+
const char* file; /* Path to program to execute. */
|
1088
|
+
/*
|
1089
|
+
* Command line arguments. args[0] should be the path to the program. On
|
1090
|
+
* Windows this uses CreateProcess which concatenates the arguments into a
|
1091
|
+
* string this can cause some strange errors. See the note at
|
1092
|
+
* windows_verbatim_arguments.
|
1093
|
+
*/
|
1094
|
+
char** args;
|
1095
|
+
/*
|
1096
|
+
* This will be set as the environ variable in the subprocess. If this is
|
1097
|
+
* NULL then the parents environ will be used.
|
1098
|
+
*/
|
1099
|
+
char** env;
|
1100
|
+
/*
|
1101
|
+
* If non-null this represents a directory the subprocess should execute
|
1102
|
+
* in. Stands for current working directory.
|
1103
|
+
*/
|
1104
|
+
char* cwd;
|
1105
|
+
|
1106
|
+
/*
|
1107
|
+
* TODO describe how this works.
|
1108
|
+
*/
|
1109
|
+
int windows_verbatim_arguments;
|
1110
|
+
|
1111
|
+
/*
|
1112
|
+
* The user should supply pointers to initialized uv_pipe_t structs for
|
1113
|
+
* stdio. This is used to to send or receive input from the subprocess.
|
1114
|
+
* The user is responsible for calling uv_close on them.
|
1115
|
+
*/
|
1116
|
+
uv_pipe_t* stdin_stream;
|
1117
|
+
uv_pipe_t* stdout_stream;
|
1118
|
+
uv_pipe_t* stderr_stream;
|
1119
|
+
} uv_process_options_t;
|
1120
|
+
|
1121
|
+
/*
|
1122
|
+
* uv_process_t is a subclass of uv_handle_t
|
1123
|
+
*/
|
1124
|
+
struct uv_process_s {
|
1125
|
+
UV_HANDLE_FIELDS
|
1126
|
+
uv_exit_cb exit_cb;
|
1127
|
+
int pid;
|
1128
|
+
UV_PROCESS_PRIVATE_FIELDS
|
1129
|
+
};
|
1130
|
+
|
1131
|
+
/* Initializes uv_process_t and starts the process. */
|
1132
|
+
UV_EXTERN int uv_spawn(uv_loop_t*, uv_process_t*,
|
1133
|
+
uv_process_options_t options);
|
1134
|
+
|
1135
|
+
/*
|
1136
|
+
* Kills the process with the specified signal. The user must still
|
1137
|
+
* call uv_close on the process.
|
1138
|
+
*/
|
1139
|
+
UV_EXTERN int uv_process_kill(uv_process_t*, int signum);
|
1140
|
+
|
1141
|
+
|
1142
|
+
/* Kills the process with the specified signal. */
|
1143
|
+
UV_EXTERN uv_err_t uv_kill(int pid, int signum);
|
1144
|
+
|
1145
|
+
|
1146
|
+
/*
|
1147
|
+
* uv_work_t is a subclass of uv_req_t
|
1148
|
+
*/
|
1149
|
+
struct uv_work_s {
|
1150
|
+
UV_REQ_FIELDS
|
1151
|
+
uv_loop_t* loop;
|
1152
|
+
uv_work_cb work_cb;
|
1153
|
+
uv_after_work_cb after_work_cb;
|
1154
|
+
UV_WORK_PRIVATE_FIELDS
|
1155
|
+
};
|
1156
|
+
|
1157
|
+
/* Queues a work request to execute asynchronously on the thread pool. */
|
1158
|
+
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
|
1159
|
+
uv_work_cb work_cb, uv_after_work_cb after_work_cb);
|
1160
|
+
|
1161
|
+
|
1162
|
+
struct uv_cpu_info_s {
|
1163
|
+
char* model;
|
1164
|
+
int speed;
|
1165
|
+
struct uv_cpu_times_s {
|
1166
|
+
uint64_t user;
|
1167
|
+
uint64_t nice;
|
1168
|
+
uint64_t sys;
|
1169
|
+
uint64_t idle;
|
1170
|
+
uint64_t irq;
|
1171
|
+
} cpu_times;
|
1172
|
+
};
|
1173
|
+
|
1174
|
+
struct uv_interface_address_s {
|
1175
|
+
char* name;
|
1176
|
+
int is_internal;
|
1177
|
+
union {
|
1178
|
+
struct sockaddr_in address4;
|
1179
|
+
struct sockaddr_in6 address6;
|
1180
|
+
} address;
|
1181
|
+
};
|
1182
|
+
|
1183
|
+
UV_EXTERN char** uv_setup_args(int argc, char** argv);
|
1184
|
+
UV_EXTERN uv_err_t uv_get_process_title(char* buffer, size_t size);
|
1185
|
+
UV_EXTERN uv_err_t uv_set_process_title(const char* title);
|
1186
|
+
UV_EXTERN uv_err_t uv_resident_set_memory(size_t* rss);
|
1187
|
+
UV_EXTERN uv_err_t uv_uptime(double* uptime);
|
1188
|
+
|
1189
|
+
/*
|
1190
|
+
* This allocates cpu_infos array, and sets count. The array
|
1191
|
+
* is freed using uv_free_cpu_info().
|
1192
|
+
*/
|
1193
|
+
UV_EXTERN uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
|
1194
|
+
UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);
|
1195
|
+
|
1196
|
+
/*
|
1197
|
+
* This allocates addresses array, and sets count. The array
|
1198
|
+
* is freed using uv_free_interface_addresses().
|
1199
|
+
*/
|
1200
|
+
UV_EXTERN uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
|
1201
|
+
int* count);
|
1202
|
+
UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses,
|
1203
|
+
int count);
|
1204
|
+
|
1205
|
+
/*
|
1206
|
+
* File System Methods.
|
1207
|
+
*
|
1208
|
+
* The uv_fs_* functions execute a blocking system call asynchronously (in a
|
1209
|
+
* thread pool) and call the specified callback in the specified loop after
|
1210
|
+
* completion. If the user gives NULL as the callback the blocking system
|
1211
|
+
* call will be called synchronously. req should be a pointer to an
|
1212
|
+
* uninitialized uv_fs_t object.
|
1213
|
+
*
|
1214
|
+
* uv_fs_req_cleanup() must be called after completion of the uv_fs_
|
1215
|
+
* function to free any internal memory allocations associated with the
|
1216
|
+
* request.
|
1217
|
+
*/
|
1218
|
+
|
1219
|
+
typedef enum {
|
1220
|
+
UV_FS_UNKNOWN = -1,
|
1221
|
+
UV_FS_CUSTOM,
|
1222
|
+
UV_FS_OPEN,
|
1223
|
+
UV_FS_CLOSE,
|
1224
|
+
UV_FS_READ,
|
1225
|
+
UV_FS_WRITE,
|
1226
|
+
UV_FS_SENDFILE,
|
1227
|
+
UV_FS_STAT,
|
1228
|
+
UV_FS_LSTAT,
|
1229
|
+
UV_FS_FSTAT,
|
1230
|
+
UV_FS_FTRUNCATE,
|
1231
|
+
UV_FS_UTIME,
|
1232
|
+
UV_FS_FUTIME,
|
1233
|
+
UV_FS_CHMOD,
|
1234
|
+
UV_FS_FCHMOD,
|
1235
|
+
UV_FS_FSYNC,
|
1236
|
+
UV_FS_FDATASYNC,
|
1237
|
+
UV_FS_UNLINK,
|
1238
|
+
UV_FS_RMDIR,
|
1239
|
+
UV_FS_MKDIR,
|
1240
|
+
UV_FS_RENAME,
|
1241
|
+
UV_FS_READDIR,
|
1242
|
+
UV_FS_LINK,
|
1243
|
+
UV_FS_SYMLINK,
|
1244
|
+
UV_FS_READLINK,
|
1245
|
+
UV_FS_CHOWN,
|
1246
|
+
UV_FS_FCHOWN
|
1247
|
+
} uv_fs_type;
|
1248
|
+
|
1249
|
+
/* uv_fs_t is a subclass of uv_req_t */
|
1250
|
+
struct uv_fs_s {
|
1251
|
+
UV_REQ_FIELDS
|
1252
|
+
uv_loop_t* loop;
|
1253
|
+
uv_fs_type fs_type;
|
1254
|
+
uv_fs_cb cb;
|
1255
|
+
ssize_t result;
|
1256
|
+
void* ptr;
|
1257
|
+
char* path;
|
1258
|
+
int errorno;
|
1259
|
+
UV_FS_PRIVATE_FIELDS
|
1260
|
+
};
|
1261
|
+
|
1262
|
+
UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req);
|
1263
|
+
|
1264
|
+
UV_EXTERN int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1265
|
+
uv_fs_cb cb);
|
1266
|
+
|
1267
|
+
UV_EXTERN int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1268
|
+
int flags, int mode, uv_fs_cb cb);
|
1269
|
+
|
1270
|
+
UV_EXTERN int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1271
|
+
void* buf, size_t length, off_t offset, uv_fs_cb cb);
|
1272
|
+
|
1273
|
+
UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1274
|
+
uv_fs_cb cb);
|
1275
|
+
|
1276
|
+
UV_EXTERN int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1277
|
+
void* buf, size_t length, off_t offset, uv_fs_cb cb);
|
1278
|
+
|
1279
|
+
UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1280
|
+
int mode, uv_fs_cb cb);
|
1281
|
+
|
1282
|
+
UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1283
|
+
uv_fs_cb cb);
|
1284
|
+
|
1285
|
+
UV_EXTERN int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req,
|
1286
|
+
const char* path, int flags, uv_fs_cb cb);
|
1287
|
+
|
1288
|
+
UV_EXTERN int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1289
|
+
uv_fs_cb cb);
|
1290
|
+
|
1291
|
+
UV_EXTERN int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1292
|
+
uv_fs_cb cb);
|
1293
|
+
|
1294
|
+
UV_EXTERN int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1295
|
+
const char* new_path, uv_fs_cb cb);
|
1296
|
+
|
1297
|
+
UV_EXTERN int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1298
|
+
uv_fs_cb cb);
|
1299
|
+
|
1300
|
+
UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1301
|
+
uv_fs_cb cb);
|
1302
|
+
|
1303
|
+
UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1304
|
+
off_t offset, uv_fs_cb cb);
|
1305
|
+
|
1306
|
+
UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd,
|
1307
|
+
uv_file in_fd, off_t in_offset, size_t length, uv_fs_cb cb);
|
1308
|
+
|
1309
|
+
UV_EXTERN int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1310
|
+
int mode, uv_fs_cb cb);
|
1311
|
+
|
1312
|
+
UV_EXTERN int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1313
|
+
double atime, double mtime, uv_fs_cb cb);
|
1314
|
+
|
1315
|
+
UV_EXTERN int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1316
|
+
double atime, double mtime, uv_fs_cb cb);
|
1317
|
+
|
1318
|
+
UV_EXTERN int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1319
|
+
uv_fs_cb cb);
|
1320
|
+
|
1321
|
+
UV_EXTERN int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1322
|
+
const char* new_path, uv_fs_cb cb);
|
1323
|
+
|
1324
|
+
/*
|
1325
|
+
* This flag can be used with uv_fs_symlink on Windows
|
1326
|
+
* to specify whether path argument points to a directory.
|
1327
|
+
*/
|
1328
|
+
#define UV_FS_SYMLINK_DIR 0x0001
|
1329
|
+
|
1330
|
+
UV_EXTERN int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1331
|
+
const char* new_path, int flags, uv_fs_cb cb);
|
1332
|
+
|
1333
|
+
UV_EXTERN int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1334
|
+
uv_fs_cb cb);
|
1335
|
+
|
1336
|
+
UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1337
|
+
int mode, uv_fs_cb cb);
|
1338
|
+
|
1339
|
+
UV_EXTERN int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
1340
|
+
int uid, int gid, uv_fs_cb cb);
|
1341
|
+
|
1342
|
+
UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
1343
|
+
int uid, int gid, uv_fs_cb cb);
|
1344
|
+
|
1345
|
+
|
1346
|
+
enum uv_fs_event {
|
1347
|
+
UV_RENAME = 1,
|
1348
|
+
UV_CHANGE = 2
|
1349
|
+
};
|
1350
|
+
|
1351
|
+
|
1352
|
+
struct uv_fs_event_s {
|
1353
|
+
UV_HANDLE_FIELDS
|
1354
|
+
char* filename;
|
1355
|
+
UV_FS_EVENT_PRIVATE_FIELDS
|
1356
|
+
};
|
1357
|
+
|
1358
|
+
|
1359
|
+
/*
|
1360
|
+
* Gets load avg
|
1361
|
+
* See: http://en.wikipedia.org/wiki/Load_(computing)
|
1362
|
+
* (Returns [0,0,0] for windows and cygwin)
|
1363
|
+
*/
|
1364
|
+
UV_EXTERN void uv_loadavg(double avg[3]);
|
1365
|
+
|
1366
|
+
|
1367
|
+
/*
|
1368
|
+
* Flags to be passed to uv_fs_event_init.
|
1369
|
+
*/
|
1370
|
+
enum uv_fs_event_flags {
|
1371
|
+
/*
|
1372
|
+
* By default, if the fs event watcher is given a directory name, we will
|
1373
|
+
* watch for all events in that directory. This flags overrides this behavior
|
1374
|
+
* and makes fs_event report only changes to the directory entry itself. This
|
1375
|
+
* flag does not affect individual files watched.
|
1376
|
+
* This flag is currently not implemented yet on any backend.
|
1377
|
+
*/
|
1378
|
+
UV_FS_EVENT_WATCH_ENTRY = 1,
|
1379
|
+
|
1380
|
+
/*
|
1381
|
+
* By default uv_fs_event will try to use a kernel interface such as inotify
|
1382
|
+
* or kqueue to detect events. This may not work on remote filesystems such
|
1383
|
+
* as NFS mounts. This flag makes fs_event fall back to calling stat() on a
|
1384
|
+
* regular interval.
|
1385
|
+
* This flag is currently not implemented yet on any backend.
|
1386
|
+
*/
|
1387
|
+
UV_FS_EVENT_STAT = 2
|
1388
|
+
};
|
1389
|
+
|
1390
|
+
|
1391
|
+
UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle,
|
1392
|
+
const char* filename, uv_fs_event_cb cb, int flags);
|
1393
|
+
|
1394
|
+
/* Utility */
|
1395
|
+
|
1396
|
+
/* Convert string ip addresses to binary structures */
|
1397
|
+
UV_EXTERN struct sockaddr_in uv_ip4_addr(const char* ip, int port);
|
1398
|
+
UV_EXTERN struct sockaddr_in6 uv_ip6_addr(const char* ip, int port);
|
1399
|
+
|
1400
|
+
/* Convert binary addresses to strings */
|
1401
|
+
UV_EXTERN int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size);
|
1402
|
+
UV_EXTERN int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size);
|
1403
|
+
|
1404
|
+
/* Gets the executable path */
|
1405
|
+
UV_EXTERN int uv_exepath(char* buffer, size_t* size);
|
1406
|
+
|
1407
|
+
/* Gets the current working directory */
|
1408
|
+
UV_EXTERN uv_err_t uv_cwd(char* buffer, size_t size);
|
1409
|
+
|
1410
|
+
/* Changes the current working directory */
|
1411
|
+
UV_EXTERN uv_err_t uv_chdir(const char* dir);
|
1412
|
+
|
1413
|
+
/* Gets memory info in bytes */
|
1414
|
+
UV_EXTERN uint64_t uv_get_free_memory(void);
|
1415
|
+
UV_EXTERN uint64_t uv_get_total_memory(void);
|
1416
|
+
|
1417
|
+
/*
|
1418
|
+
* Returns the current high-resolution real time. This is expressed in
|
1419
|
+
* nanoseconds. It is relative to an arbitrary time in the past. It is not
|
1420
|
+
* related to the time of day and therefore not subject to clock drift. The
|
1421
|
+
* primary use is for measuring performance between intervals.
|
1422
|
+
*
|
1423
|
+
* Note not every platform can support nanosecond resolution; however, this
|
1424
|
+
* value will always be in nanoseconds.
|
1425
|
+
*/
|
1426
|
+
UV_EXTERN extern uint64_t uv_hrtime(void);
|
1427
|
+
|
1428
|
+
|
1429
|
+
/*
|
1430
|
+
* Opens a shared library. The filename is in utf-8. On success, -1 is returned
|
1431
|
+
* and the variable pointed by library receives a handle to the library.
|
1432
|
+
*/
|
1433
|
+
UV_EXTERN uv_err_t uv_dlopen(const char* filename, uv_lib_t* library);
|
1434
|
+
UV_EXTERN uv_err_t uv_dlclose(uv_lib_t library);
|
1435
|
+
|
1436
|
+
/*
|
1437
|
+
* Retrieves a data pointer from a dynamic library. It is legal for a symbol to
|
1438
|
+
* map to NULL.
|
1439
|
+
*/
|
1440
|
+
UV_EXTERN uv_err_t uv_dlsym(uv_lib_t library, const char* name, void** ptr);
|
1441
|
+
|
1442
|
+
/*
|
1443
|
+
* Retrieves and frees an error message of dynamic linking loaders.
|
1444
|
+
*/
|
1445
|
+
UV_EXTERN const char *uv_dlerror(uv_lib_t library);
|
1446
|
+
UV_EXTERN void uv_dlerror_free(uv_lib_t library, const char *msg);
|
1447
|
+
|
1448
|
+
/*
|
1449
|
+
* The mutex functions return 0 on success, -1 on error
|
1450
|
+
* (unless the return type is void, of course).
|
1451
|
+
*/
|
1452
|
+
UV_EXTERN int uv_mutex_init(uv_mutex_t* handle);
|
1453
|
+
UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle);
|
1454
|
+
UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle);
|
1455
|
+
UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle);
|
1456
|
+
UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle);
|
1457
|
+
|
1458
|
+
/*
|
1459
|
+
* Same goes for the read/write lock functions.
|
1460
|
+
*/
|
1461
|
+
UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock);
|
1462
|
+
UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock);
|
1463
|
+
UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock);
|
1464
|
+
UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock);
|
1465
|
+
UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock);
|
1466
|
+
UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock);
|
1467
|
+
UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock);
|
1468
|
+
UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock);
|
1469
|
+
|
1470
|
+
/* Runs a function once and only once. Concurrent calls to uv_once() with the
|
1471
|
+
* same guard will block all callers except one (it's unspecified which one).
|
1472
|
+
* The guard should be initialized statically with the UV_ONCE_INIT macro.
|
1473
|
+
*/
|
1474
|
+
UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void));
|
1475
|
+
|
1476
|
+
UV_EXTERN int uv_thread_create(uv_thread_t *tid,
|
1477
|
+
void (*entry)(void *arg), void *arg);
|
1478
|
+
UV_EXTERN int uv_thread_join(uv_thread_t *tid);
|
1479
|
+
|
1480
|
+
/* the presence of these unions force similar struct layout */
|
1481
|
+
union uv_any_handle {
|
1482
|
+
uv_tcp_t tcp;
|
1483
|
+
uv_pipe_t pipe;
|
1484
|
+
uv_prepare_t prepare;
|
1485
|
+
uv_check_t check;
|
1486
|
+
uv_idle_t idle;
|
1487
|
+
uv_async_t async;
|
1488
|
+
uv_timer_t timer;
|
1489
|
+
uv_getaddrinfo_t getaddrinfo;
|
1490
|
+
uv_fs_event_t fs_event;
|
1491
|
+
};
|
1492
|
+
|
1493
|
+
union uv_any_req {
|
1494
|
+
uv_req_t req;
|
1495
|
+
uv_write_t write;
|
1496
|
+
uv_connect_t connect;
|
1497
|
+
uv_shutdown_t shutdown;
|
1498
|
+
uv_fs_t fs_req;
|
1499
|
+
uv_work_t work_req;
|
1500
|
+
};
|
1501
|
+
|
1502
|
+
|
1503
|
+
struct uv_counters_s {
|
1504
|
+
uint64_t eio_init;
|
1505
|
+
uint64_t req_init;
|
1506
|
+
uint64_t handle_init;
|
1507
|
+
uint64_t stream_init;
|
1508
|
+
uint64_t tcp_init;
|
1509
|
+
uint64_t udp_init;
|
1510
|
+
uint64_t pipe_init;
|
1511
|
+
uint64_t tty_init;
|
1512
|
+
uint64_t prepare_init;
|
1513
|
+
uint64_t check_init;
|
1514
|
+
uint64_t idle_init;
|
1515
|
+
uint64_t async_init;
|
1516
|
+
uint64_t timer_init;
|
1517
|
+
uint64_t process_init;
|
1518
|
+
uint64_t fs_event_init;
|
1519
|
+
};
|
1520
|
+
|
1521
|
+
|
1522
|
+
struct uv_loop_s {
|
1523
|
+
UV_LOOP_PRIVATE_FIELDS
|
1524
|
+
/* RB_HEAD(uv__ares_tasks, uv_ares_task_t) */
|
1525
|
+
struct uv__ares_tasks { uv_ares_task_t* rbh_root; } uv_ares_handles_;
|
1526
|
+
/* Diagnostic counters */
|
1527
|
+
uv_counters_t counters;
|
1528
|
+
/* The last error */
|
1529
|
+
uv_err_t last_err;
|
1530
|
+
/* User data - use this for whatever. */
|
1531
|
+
void* data;
|
1532
|
+
};
|
1533
|
+
|
1534
|
+
|
1535
|
+
/* Don't export the private CPP symbols. */
|
1536
|
+
#undef UV_HANDLE_TYPE_PRIVATE
|
1537
|
+
#undef UV_REQ_TYPE_PRIVATE
|
1538
|
+
#undef UV_REQ_PRIVATE_FIELDS
|
1539
|
+
#undef UV_STREAM_PRIVATE_FIELDS
|
1540
|
+
#undef UV_TCP_PRIVATE_FIELDS
|
1541
|
+
#undef UV_PREPARE_PRIVATE_FIELDS
|
1542
|
+
#undef UV_CHECK_PRIVATE_FIELDS
|
1543
|
+
#undef UV_IDLE_PRIVATE_FIELDS
|
1544
|
+
#undef UV_ASYNC_PRIVATE_FIELDS
|
1545
|
+
#undef UV_TIMER_PRIVATE_FIELDS
|
1546
|
+
#undef UV_GETADDRINFO_PRIVATE_FIELDS
|
1547
|
+
#undef UV_FS_REQ_PRIVATE_FIELDS
|
1548
|
+
#undef UV_WORK_PRIVATE_FIELDS
|
1549
|
+
#undef UV_FS_EVENT_PRIVATE_FIELDS
|
1550
|
+
#undef UV_LOOP_PRIVATE_FIELDS
|
1551
|
+
#undef UV_LOOP_PRIVATE_PLATFORM_FIELDS
|
1552
|
+
|
1553
|
+
#ifdef __cplusplus
|
1554
|
+
}
|
1555
|
+
#endif
|
1556
|
+
#endif /* UV_H */
|