passenger 5.0.8 → 5.0.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.editorconfig +20 -0
- data/CHANGELOG +21 -0
- data/bin/passenger-install-apache2-module +3 -1
- data/build/agents.rb +7 -5
- data/build/basics.rb +3 -3
- data/build/common_library.rb +52 -30
- data/build/cxx_tests.rb +20 -13
- data/build/misc.rb +5 -5
- data/doc/Design and Architecture.html +1 -1
- data/doc/Design and Architecture.txt +1 -1
- data/doc/Packaging.html +4 -4
- data/doc/Packaging.txt.md +4 -4
- data/doc/Users guide Apache.html +22 -9
- data/doc/Users guide Apache.idmap.txt +4 -2
- data/doc/Users guide Apache.txt +2 -0
- data/doc/Users guide Nginx.html +22 -9
- data/doc/Users guide Nginx.idmap.txt +4 -2
- data/doc/Users guide Nginx.txt +2 -0
- data/doc/Users guide Standalone.html +14 -9
- data/doc/Users guide Standalone.idmap.txt +4 -2
- data/doc/users_guide_snippets/installation.txt +10 -6
- data/ext/apache2/Hooks.cpp +13 -2
- data/ext/common/ApplicationPool2/Pool/Inspection.h +8 -3
- data/ext/common/BackgroundEventLoop.cpp +249 -67
- data/ext/common/BackgroundEventLoop.h +5 -5
- data/ext/common/Constants.h +1 -1
- data/ext/common/InstanceDirectory.h +8 -6
- data/ext/common/ServerKit/Context.h +8 -2
- data/ext/common/ServerKit/FileBufferedChannel.h +262 -226
- data/ext/common/ServerKit/HeaderTable.h +28 -3
- data/ext/common/ServerKit/HttpHeaderParser.h +37 -13
- data/ext/common/ServerKit/HttpServer.h +17 -1
- data/ext/common/ServerKit/Implementation.cpp +2 -0
- data/ext/common/ServerKit/Server.h +25 -28
- data/ext/common/Utils/IOUtils.cpp +11 -0
- data/ext/common/Utils/ProcessMetricsCollector.h +4 -0
- data/ext/common/Utils/StrIntUtils.cpp +11 -7
- data/ext/common/Utils/StrIntUtils.h +1 -1
- data/ext/common/Utils/StrIntUtilsNoStrictAliasing.cpp +21 -16
- data/ext/common/agents/Base.cpp +6 -0
- data/ext/common/agents/Base.h +2 -0
- data/ext/common/agents/HelperAgent/AdminServer.h +25 -25
- data/ext/common/agents/HelperAgent/Main.cpp +37 -12
- data/ext/common/agents/HelperAgent/RequestHandler.h +18 -20
- data/ext/common/agents/HelperAgent/RequestHandler/AppResponse.h +4 -0
- data/ext/common/agents/HelperAgent/RequestHandler/ForwardResponse.cpp +10 -6
- data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +2 -0
- data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +1 -1
- data/ext/common/agents/HelperAgent/RequestHandler/SendRequest.cpp +1 -1
- data/ext/common/agents/HelperAgent/RequestHandler/Utils.cpp +9 -2
- data/ext/common/agents/HelperAgent/ResponseCache.h +11 -11
- data/ext/common/agents/LoggingAgent/AdminServer.h +8 -8
- data/ext/common/agents/LoggingAgent/Main.cpp +6 -5
- data/ext/common/agents/Watchdog/AdminServer.h +13 -13
- data/ext/common/agents/Watchdog/Main.cpp +8 -3
- data/ext/libuv/.gitignore +72 -0
- data/ext/libuv/AUTHORS +199 -0
- data/ext/libuv/ChangeLog +2023 -0
- data/ext/libuv/LICENSE +46 -0
- data/ext/libuv/Makefile.am +336 -0
- data/ext/libuv/README.md +197 -0
- data/ext/libuv/checksparse.sh +233 -0
- data/ext/libuv/common.gypi +210 -0
- data/ext/libuv/configure.ac +67 -0
- data/ext/libuv/gyp_uv.py +96 -0
- data/ext/libuv/include/android-ifaddrs.h +54 -0
- data/ext/libuv/include/pthread-fixes.h +72 -0
- data/ext/libuv/include/tree.h +768 -0
- data/ext/libuv/include/uv-aix.h +32 -0
- data/ext/libuv/include/uv-bsd.h +34 -0
- data/ext/libuv/include/uv-darwin.h +61 -0
- data/ext/libuv/include/uv-errno.h +418 -0
- data/ext/libuv/include/uv-linux.h +34 -0
- data/ext/libuv/include/uv-sunos.h +44 -0
- data/ext/libuv/include/uv-threadpool.h +37 -0
- data/ext/libuv/include/uv-unix.h +383 -0
- data/ext/libuv/include/uv-version.h +39 -0
- data/ext/libuv/include/uv.h +1455 -0
- data/ext/libuv/libuv.pc.in +11 -0
- data/ext/libuv/m4/.gitignore +4 -0
- data/ext/libuv/m4/as_case.m4 +21 -0
- data/ext/libuv/m4/libuv-check-flags.m4 +319 -0
- data/ext/libuv/src/fs-poll.c +255 -0
- data/ext/libuv/src/heap-inl.h +245 -0
- data/ext/libuv/src/inet.c +313 -0
- data/ext/libuv/src/queue.h +92 -0
- data/ext/libuv/src/threadpool.c +303 -0
- data/ext/libuv/src/unix/aix.c +1240 -0
- data/ext/libuv/src/unix/android-ifaddrs.c +703 -0
- data/ext/libuv/src/unix/async.c +284 -0
- data/ext/libuv/src/unix/atomic-ops.h +60 -0
- data/ext/libuv/src/unix/core.c +985 -0
- data/ext/libuv/src/unix/darwin-proctitle.c +206 -0
- data/ext/libuv/src/unix/darwin.c +331 -0
- data/ext/libuv/src/unix/dl.c +83 -0
- data/ext/libuv/src/unix/freebsd.c +435 -0
- data/ext/libuv/src/unix/fs.c +1189 -0
- data/ext/libuv/src/unix/fsevents.c +899 -0
- data/ext/libuv/src/unix/getaddrinfo.c +202 -0
- data/ext/libuv/src/unix/getnameinfo.c +120 -0
- data/ext/libuv/src/unix/internal.h +314 -0
- data/ext/libuv/src/unix/kqueue.c +418 -0
- data/ext/libuv/src/unix/linux-core.c +876 -0
- data/ext/libuv/src/unix/linux-inotify.c +257 -0
- data/ext/libuv/src/unix/linux-syscalls.c +471 -0
- data/ext/libuv/src/unix/linux-syscalls.h +158 -0
- data/ext/libuv/src/unix/loop-watcher.c +63 -0
- data/ext/libuv/src/unix/loop.c +135 -0
- data/ext/libuv/src/unix/netbsd.c +368 -0
- data/ext/libuv/src/unix/openbsd.c +384 -0
- data/ext/libuv/src/unix/pipe.c +288 -0
- data/ext/libuv/src/unix/poll.c +113 -0
- data/ext/libuv/src/unix/process.c +551 -0
- data/ext/libuv/src/unix/proctitle.c +102 -0
- data/ext/libuv/src/unix/pthread-fixes.c +103 -0
- data/ext/libuv/src/unix/signal.c +465 -0
- data/ext/libuv/src/unix/spinlock.h +53 -0
- data/ext/libuv/src/unix/stream.c +1598 -0
- data/ext/libuv/src/unix/sunos.c +763 -0
- data/ext/libuv/src/unix/tcp.c +327 -0
- data/ext/libuv/src/unix/thread.c +519 -0
- data/ext/libuv/src/unix/timer.c +172 -0
- data/ext/libuv/src/unix/tty.c +265 -0
- data/ext/libuv/src/unix/udp.c +833 -0
- data/ext/libuv/src/uv-common.c +544 -0
- data/ext/libuv/src/uv-common.h +214 -0
- data/ext/libuv/src/version.c +49 -0
- data/ext/libuv/uv.gyp +487 -0
- data/ext/nginx/ContentHandler.c +21 -10
- data/ext/nginx/ngx_http_passenger_module.c +7 -0
- data/ext/oxt/implementation.cpp +9 -2
- data/ext/oxt/initialize.hpp +5 -1
- data/lib/phusion_passenger.rb +3 -3
- data/lib/phusion_passenger/admin_tools/instance.rb +10 -6
- data/lib/phusion_passenger/admin_tools/instance_registry.rb +6 -2
- data/lib/phusion_passenger/packaging.rb +3 -4
- data/lib/phusion_passenger/platform_info.rb +13 -1
- data/lib/phusion_passenger/platform_info/apache.rb +15 -4
- data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -1
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +184 -99
- data/lib/phusion_passenger/request_handler/thread_handler.rb +13 -6
- data/lib/phusion_passenger/standalone/start_command.rb +2 -2
- data/resources/templates/apache2/apache_install_broken.txt.erb +2 -1
- metadata +99 -22
- metadata.gz.asc +7 -7
- data/ext/libeio/Changes +0 -76
- data/ext/libeio/LICENSE +0 -36
- data/ext/libeio/Makefile.am +0 -15
- data/ext/libeio/Makefile.in +0 -694
- data/ext/libeio/aclocal.m4 +0 -9418
- data/ext/libeio/autogen.sh +0 -3
- data/ext/libeio/config.guess +0 -1540
- data/ext/libeio/config.h.in +0 -136
- data/ext/libeio/config.sub +0 -1779
- data/ext/libeio/configure +0 -14822
- data/ext/libeio/configure.ac +0 -22
- data/ext/libeio/demo.c +0 -194
- data/ext/libeio/ecb.h +0 -714
- data/ext/libeio/eio.c +0 -2818
- data/ext/libeio/eio.h +0 -414
- data/ext/libeio/install-sh +0 -520
- data/ext/libeio/libeio.m4 +0 -195
- data/ext/libeio/ltmain.sh +0 -9636
- data/ext/libeio/missing +0 -376
- data/ext/libeio/xthread.h +0 -166
@@ -0,0 +1,39 @@
|
|
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
|
+
#ifndef UV_VERSION_H
|
23
|
+
#define UV_VERSION_H
|
24
|
+
|
25
|
+
/*
|
26
|
+
* Versions with the same major number are ABI stable. API is allowed to
|
27
|
+
* evolve between minor releases, but only in a backwards compatible way.
|
28
|
+
* Make sure you update the -soname directives in configure.ac
|
29
|
+
* and uv.gyp whenever you bump UV_VERSION_MAJOR or UV_VERSION_MINOR (but
|
30
|
+
* not UV_VERSION_PATCH.)
|
31
|
+
*/
|
32
|
+
|
33
|
+
#define UV_VERSION_MAJOR 1
|
34
|
+
#define UV_VERSION_MINOR 5
|
35
|
+
#define UV_VERSION_PATCH 0
|
36
|
+
#define UV_VERSION_IS_RELEASE 1
|
37
|
+
#define UV_VERSION_SUFFIX ""
|
38
|
+
|
39
|
+
#endif /* UV_VERSION_H */
|
@@ -0,0 +1,1455 @@
|
|
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 https://github.com/libuv/libuv#documentation for documentation. */
|
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. */
|
34
|
+
# define UV_EXTERN __declspec(dllexport)
|
35
|
+
# elif defined(USING_UV_SHARED)
|
36
|
+
/* Using shared library. */
|
37
|
+
# define UV_EXTERN __declspec(dllimport)
|
38
|
+
# else
|
39
|
+
/* Building static library. */
|
40
|
+
# define UV_EXTERN /* nothing */
|
41
|
+
# endif
|
42
|
+
#elif __GNUC__ >= 4
|
43
|
+
# define UV_EXTERN __attribute__((visibility("default")))
|
44
|
+
#else
|
45
|
+
# define UV_EXTERN /* nothing */
|
46
|
+
#endif
|
47
|
+
|
48
|
+
#include "uv-errno.h"
|
49
|
+
#include "uv-version.h"
|
50
|
+
#include <stddef.h>
|
51
|
+
|
52
|
+
#if defined(_MSC_VER) && _MSC_VER < 1600
|
53
|
+
# include "stdint-msvc2008.h"
|
54
|
+
#else
|
55
|
+
# include <stdint.h>
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#if defined(_WIN32)
|
59
|
+
# include "uv-win.h"
|
60
|
+
#else
|
61
|
+
# include "uv-unix.h"
|
62
|
+
#endif
|
63
|
+
|
64
|
+
/* Expand this list if necessary. */
|
65
|
+
#define UV_ERRNO_MAP(XX) \
|
66
|
+
XX(E2BIG, "argument list too long") \
|
67
|
+
XX(EACCES, "permission denied") \
|
68
|
+
XX(EADDRINUSE, "address already in use") \
|
69
|
+
XX(EADDRNOTAVAIL, "address not available") \
|
70
|
+
XX(EAFNOSUPPORT, "address family not supported") \
|
71
|
+
XX(EAGAIN, "resource temporarily unavailable") \
|
72
|
+
XX(EAI_ADDRFAMILY, "address family not supported") \
|
73
|
+
XX(EAI_AGAIN, "temporary failure") \
|
74
|
+
XX(EAI_BADFLAGS, "bad ai_flags value") \
|
75
|
+
XX(EAI_BADHINTS, "invalid value for hints") \
|
76
|
+
XX(EAI_CANCELED, "request canceled") \
|
77
|
+
XX(EAI_FAIL, "permanent failure") \
|
78
|
+
XX(EAI_FAMILY, "ai_family not supported") \
|
79
|
+
XX(EAI_MEMORY, "out of memory") \
|
80
|
+
XX(EAI_NODATA, "no address") \
|
81
|
+
XX(EAI_NONAME, "unknown node or service") \
|
82
|
+
XX(EAI_OVERFLOW, "argument buffer overflow") \
|
83
|
+
XX(EAI_PROTOCOL, "resolved protocol is unknown") \
|
84
|
+
XX(EAI_SERVICE, "service not available for socket type") \
|
85
|
+
XX(EAI_SOCKTYPE, "socket type not supported") \
|
86
|
+
XX(EALREADY, "connection already in progress") \
|
87
|
+
XX(EBADF, "bad file descriptor") \
|
88
|
+
XX(EBUSY, "resource busy or locked") \
|
89
|
+
XX(ECANCELED, "operation canceled") \
|
90
|
+
XX(ECHARSET, "invalid Unicode character") \
|
91
|
+
XX(ECONNABORTED, "software caused connection abort") \
|
92
|
+
XX(ECONNREFUSED, "connection refused") \
|
93
|
+
XX(ECONNRESET, "connection reset by peer") \
|
94
|
+
XX(EDESTADDRREQ, "destination address required") \
|
95
|
+
XX(EEXIST, "file already exists") \
|
96
|
+
XX(EFAULT, "bad address in system call argument") \
|
97
|
+
XX(EFBIG, "file too large") \
|
98
|
+
XX(EHOSTUNREACH, "host is unreachable") \
|
99
|
+
XX(EINTR, "interrupted system call") \
|
100
|
+
XX(EINVAL, "invalid argument") \
|
101
|
+
XX(EIO, "i/o error") \
|
102
|
+
XX(EISCONN, "socket is already connected") \
|
103
|
+
XX(EISDIR, "illegal operation on a directory") \
|
104
|
+
XX(ELOOP, "too many symbolic links encountered") \
|
105
|
+
XX(EMFILE, "too many open files") \
|
106
|
+
XX(EMSGSIZE, "message too long") \
|
107
|
+
XX(ENAMETOOLONG, "name too long") \
|
108
|
+
XX(ENETDOWN, "network is down") \
|
109
|
+
XX(ENETUNREACH, "network is unreachable") \
|
110
|
+
XX(ENFILE, "file table overflow") \
|
111
|
+
XX(ENOBUFS, "no buffer space available") \
|
112
|
+
XX(ENODEV, "no such device") \
|
113
|
+
XX(ENOENT, "no such file or directory") \
|
114
|
+
XX(ENOMEM, "not enough memory") \
|
115
|
+
XX(ENONET, "machine is not on the network") \
|
116
|
+
XX(ENOPROTOOPT, "protocol not available") \
|
117
|
+
XX(ENOSPC, "no space left on device") \
|
118
|
+
XX(ENOSYS, "function not implemented") \
|
119
|
+
XX(ENOTCONN, "socket is not connected") \
|
120
|
+
XX(ENOTDIR, "not a directory") \
|
121
|
+
XX(ENOTEMPTY, "directory not empty") \
|
122
|
+
XX(ENOTSOCK, "socket operation on non-socket") \
|
123
|
+
XX(ENOTSUP, "operation not supported on socket") \
|
124
|
+
XX(EPERM, "operation not permitted") \
|
125
|
+
XX(EPIPE, "broken pipe") \
|
126
|
+
XX(EPROTO, "protocol error") \
|
127
|
+
XX(EPROTONOSUPPORT, "protocol not supported") \
|
128
|
+
XX(EPROTOTYPE, "protocol wrong type for socket") \
|
129
|
+
XX(ERANGE, "result too large") \
|
130
|
+
XX(EROFS, "read-only file system") \
|
131
|
+
XX(ESHUTDOWN, "cannot send after transport endpoint shutdown") \
|
132
|
+
XX(ESPIPE, "invalid seek") \
|
133
|
+
XX(ESRCH, "no such process") \
|
134
|
+
XX(ETIMEDOUT, "connection timed out") \
|
135
|
+
XX(ETXTBSY, "text file is busy") \
|
136
|
+
XX(EXDEV, "cross-device link not permitted") \
|
137
|
+
XX(UNKNOWN, "unknown error") \
|
138
|
+
XX(EOF, "end of file") \
|
139
|
+
XX(ENXIO, "no such device or address") \
|
140
|
+
XX(EMLINK, "too many links") \
|
141
|
+
XX(EHOSTDOWN, "host is down") \
|
142
|
+
|
143
|
+
#define UV_HANDLE_TYPE_MAP(XX) \
|
144
|
+
XX(ASYNC, async) \
|
145
|
+
XX(CHECK, check) \
|
146
|
+
XX(FS_EVENT, fs_event) \
|
147
|
+
XX(FS_POLL, fs_poll) \
|
148
|
+
XX(HANDLE, handle) \
|
149
|
+
XX(IDLE, idle) \
|
150
|
+
XX(NAMED_PIPE, pipe) \
|
151
|
+
XX(POLL, poll) \
|
152
|
+
XX(PREPARE, prepare) \
|
153
|
+
XX(PROCESS, process) \
|
154
|
+
XX(STREAM, stream) \
|
155
|
+
XX(TCP, tcp) \
|
156
|
+
XX(TIMER, timer) \
|
157
|
+
XX(TTY, tty) \
|
158
|
+
XX(UDP, udp) \
|
159
|
+
XX(SIGNAL, signal) \
|
160
|
+
|
161
|
+
#define UV_REQ_TYPE_MAP(XX) \
|
162
|
+
XX(REQ, req) \
|
163
|
+
XX(CONNECT, connect) \
|
164
|
+
XX(WRITE, write) \
|
165
|
+
XX(SHUTDOWN, shutdown) \
|
166
|
+
XX(UDP_SEND, udp_send) \
|
167
|
+
XX(FS, fs) \
|
168
|
+
XX(WORK, work) \
|
169
|
+
XX(GETADDRINFO, getaddrinfo) \
|
170
|
+
XX(GETNAMEINFO, getnameinfo) \
|
171
|
+
|
172
|
+
typedef enum {
|
173
|
+
#define XX(code, _) UV_ ## code = UV__ ## code,
|
174
|
+
UV_ERRNO_MAP(XX)
|
175
|
+
#undef XX
|
176
|
+
UV_ERRNO_MAX = UV__EOF - 1
|
177
|
+
} uv_errno_t;
|
178
|
+
|
179
|
+
typedef enum {
|
180
|
+
UV_UNKNOWN_HANDLE = 0,
|
181
|
+
#define XX(uc, lc) UV_##uc,
|
182
|
+
UV_HANDLE_TYPE_MAP(XX)
|
183
|
+
#undef XX
|
184
|
+
UV_FILE,
|
185
|
+
UV_HANDLE_TYPE_MAX
|
186
|
+
} uv_handle_type;
|
187
|
+
|
188
|
+
typedef enum {
|
189
|
+
UV_UNKNOWN_REQ = 0,
|
190
|
+
#define XX(uc, lc) UV_##uc,
|
191
|
+
UV_REQ_TYPE_MAP(XX)
|
192
|
+
#undef XX
|
193
|
+
UV_REQ_TYPE_PRIVATE
|
194
|
+
UV_REQ_TYPE_MAX
|
195
|
+
} uv_req_type;
|
196
|
+
|
197
|
+
|
198
|
+
/* Handle types. */
|
199
|
+
typedef struct uv_loop_s uv_loop_t;
|
200
|
+
typedef struct uv_handle_s uv_handle_t;
|
201
|
+
typedef struct uv_stream_s uv_stream_t;
|
202
|
+
typedef struct uv_tcp_s uv_tcp_t;
|
203
|
+
typedef struct uv_udp_s uv_udp_t;
|
204
|
+
typedef struct uv_pipe_s uv_pipe_t;
|
205
|
+
typedef struct uv_tty_s uv_tty_t;
|
206
|
+
typedef struct uv_poll_s uv_poll_t;
|
207
|
+
typedef struct uv_timer_s uv_timer_t;
|
208
|
+
typedef struct uv_prepare_s uv_prepare_t;
|
209
|
+
typedef struct uv_check_s uv_check_t;
|
210
|
+
typedef struct uv_idle_s uv_idle_t;
|
211
|
+
typedef struct uv_async_s uv_async_t;
|
212
|
+
typedef struct uv_process_s uv_process_t;
|
213
|
+
typedef struct uv_fs_event_s uv_fs_event_t;
|
214
|
+
typedef struct uv_fs_poll_s uv_fs_poll_t;
|
215
|
+
typedef struct uv_signal_s uv_signal_t;
|
216
|
+
|
217
|
+
/* Request types. */
|
218
|
+
typedef struct uv_req_s uv_req_t;
|
219
|
+
typedef struct uv_getaddrinfo_s uv_getaddrinfo_t;
|
220
|
+
typedef struct uv_getnameinfo_s uv_getnameinfo_t;
|
221
|
+
typedef struct uv_shutdown_s uv_shutdown_t;
|
222
|
+
typedef struct uv_write_s uv_write_t;
|
223
|
+
typedef struct uv_connect_s uv_connect_t;
|
224
|
+
typedef struct uv_udp_send_s uv_udp_send_t;
|
225
|
+
typedef struct uv_fs_s uv_fs_t;
|
226
|
+
typedef struct uv_work_s uv_work_t;
|
227
|
+
|
228
|
+
/* None of the above. */
|
229
|
+
typedef struct uv_cpu_info_s uv_cpu_info_t;
|
230
|
+
typedef struct uv_interface_address_s uv_interface_address_t;
|
231
|
+
typedef struct uv_dirent_s uv_dirent_t;
|
232
|
+
|
233
|
+
typedef enum {
|
234
|
+
UV_LOOP_BLOCK_SIGNAL
|
235
|
+
} uv_loop_option;
|
236
|
+
|
237
|
+
typedef enum {
|
238
|
+
UV_RUN_DEFAULT = 0,
|
239
|
+
UV_RUN_ONCE,
|
240
|
+
UV_RUN_NOWAIT
|
241
|
+
} uv_run_mode;
|
242
|
+
|
243
|
+
|
244
|
+
UV_EXTERN unsigned int uv_version(void);
|
245
|
+
UV_EXTERN const char* uv_version_string(void);
|
246
|
+
|
247
|
+
UV_EXTERN uv_loop_t* uv_default_loop(void);
|
248
|
+
UV_EXTERN int uv_loop_init(uv_loop_t* loop);
|
249
|
+
UV_EXTERN int uv_loop_close(uv_loop_t* loop);
|
250
|
+
/*
|
251
|
+
* NOTE:
|
252
|
+
* This function is DEPRECATED (to be removed after 0.12), users should
|
253
|
+
* allocate the loop manually and use uv_loop_init instead.
|
254
|
+
*/
|
255
|
+
UV_EXTERN uv_loop_t* uv_loop_new(void);
|
256
|
+
/*
|
257
|
+
* NOTE:
|
258
|
+
* This function is DEPRECATED (to be removed after 0.12). Users should use
|
259
|
+
* uv_loop_close and free the memory manually instead.
|
260
|
+
*/
|
261
|
+
UV_EXTERN void uv_loop_delete(uv_loop_t*);
|
262
|
+
UV_EXTERN size_t uv_loop_size(void);
|
263
|
+
UV_EXTERN int uv_loop_alive(const uv_loop_t* loop);
|
264
|
+
UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...);
|
265
|
+
|
266
|
+
UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode);
|
267
|
+
UV_EXTERN void uv_stop(uv_loop_t*);
|
268
|
+
|
269
|
+
UV_EXTERN void uv_ref(uv_handle_t*);
|
270
|
+
UV_EXTERN void uv_unref(uv_handle_t*);
|
271
|
+
UV_EXTERN int uv_has_ref(const uv_handle_t*);
|
272
|
+
|
273
|
+
UV_EXTERN void uv_update_time(uv_loop_t*);
|
274
|
+
UV_EXTERN uint64_t uv_now(const uv_loop_t*);
|
275
|
+
|
276
|
+
UV_EXTERN int uv_backend_fd(const uv_loop_t*);
|
277
|
+
UV_EXTERN int uv_backend_timeout(const uv_loop_t*);
|
278
|
+
|
279
|
+
typedef void (*uv_alloc_cb)(uv_handle_t* handle,
|
280
|
+
size_t suggested_size,
|
281
|
+
uv_buf_t* buf);
|
282
|
+
typedef void (*uv_read_cb)(uv_stream_t* stream,
|
283
|
+
ssize_t nread,
|
284
|
+
const uv_buf_t* buf);
|
285
|
+
typedef void (*uv_write_cb)(uv_write_t* req, int status);
|
286
|
+
typedef void (*uv_connect_cb)(uv_connect_t* req, int status);
|
287
|
+
typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status);
|
288
|
+
typedef void (*uv_connection_cb)(uv_stream_t* server, int status);
|
289
|
+
typedef void (*uv_close_cb)(uv_handle_t* handle);
|
290
|
+
typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events);
|
291
|
+
typedef void (*uv_timer_cb)(uv_timer_t* handle);
|
292
|
+
typedef void (*uv_async_cb)(uv_async_t* handle);
|
293
|
+
typedef void (*uv_prepare_cb)(uv_prepare_t* handle);
|
294
|
+
typedef void (*uv_check_cb)(uv_check_t* handle);
|
295
|
+
typedef void (*uv_idle_cb)(uv_idle_t* handle);
|
296
|
+
typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal);
|
297
|
+
typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg);
|
298
|
+
typedef void (*uv_fs_cb)(uv_fs_t* req);
|
299
|
+
typedef void (*uv_work_cb)(uv_work_t* req);
|
300
|
+
typedef void (*uv_after_work_cb)(uv_work_t* req, int status);
|
301
|
+
typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req,
|
302
|
+
int status,
|
303
|
+
struct addrinfo* res);
|
304
|
+
typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req,
|
305
|
+
int status,
|
306
|
+
const char* hostname,
|
307
|
+
const char* service);
|
308
|
+
|
309
|
+
typedef struct {
|
310
|
+
long tv_sec;
|
311
|
+
long tv_nsec;
|
312
|
+
} uv_timespec_t;
|
313
|
+
|
314
|
+
|
315
|
+
typedef struct {
|
316
|
+
uint64_t st_dev;
|
317
|
+
uint64_t st_mode;
|
318
|
+
uint64_t st_nlink;
|
319
|
+
uint64_t st_uid;
|
320
|
+
uint64_t st_gid;
|
321
|
+
uint64_t st_rdev;
|
322
|
+
uint64_t st_ino;
|
323
|
+
uint64_t st_size;
|
324
|
+
uint64_t st_blksize;
|
325
|
+
uint64_t st_blocks;
|
326
|
+
uint64_t st_flags;
|
327
|
+
uint64_t st_gen;
|
328
|
+
uv_timespec_t st_atim;
|
329
|
+
uv_timespec_t st_mtim;
|
330
|
+
uv_timespec_t st_ctim;
|
331
|
+
uv_timespec_t st_birthtim;
|
332
|
+
} uv_stat_t;
|
333
|
+
|
334
|
+
|
335
|
+
typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle,
|
336
|
+
const char* filename,
|
337
|
+
int events,
|
338
|
+
int status);
|
339
|
+
|
340
|
+
typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle,
|
341
|
+
int status,
|
342
|
+
const uv_stat_t* prev,
|
343
|
+
const uv_stat_t* curr);
|
344
|
+
|
345
|
+
typedef void (*uv_signal_cb)(uv_signal_t* handle, int signum);
|
346
|
+
|
347
|
+
|
348
|
+
typedef enum {
|
349
|
+
UV_LEAVE_GROUP = 0,
|
350
|
+
UV_JOIN_GROUP
|
351
|
+
} uv_membership;
|
352
|
+
|
353
|
+
|
354
|
+
UV_EXTERN const char* uv_strerror(int err);
|
355
|
+
UV_EXTERN const char* uv_err_name(int err);
|
356
|
+
|
357
|
+
|
358
|
+
#define UV_REQ_FIELDS \
|
359
|
+
/* public */ \
|
360
|
+
void* data; \
|
361
|
+
/* read-only */ \
|
362
|
+
uv_req_type type; \
|
363
|
+
/* private */ \
|
364
|
+
void* active_queue[2]; \
|
365
|
+
void* reserved[4]; \
|
366
|
+
UV_REQ_PRIVATE_FIELDS \
|
367
|
+
|
368
|
+
/* Abstract base class of all requests. */
|
369
|
+
struct uv_req_s {
|
370
|
+
UV_REQ_FIELDS
|
371
|
+
};
|
372
|
+
|
373
|
+
|
374
|
+
/* Platform-specific request types. */
|
375
|
+
UV_PRIVATE_REQ_TYPES
|
376
|
+
|
377
|
+
|
378
|
+
UV_EXTERN int uv_shutdown(uv_shutdown_t* req,
|
379
|
+
uv_stream_t* handle,
|
380
|
+
uv_shutdown_cb cb);
|
381
|
+
|
382
|
+
struct uv_shutdown_s {
|
383
|
+
UV_REQ_FIELDS
|
384
|
+
uv_stream_t* handle;
|
385
|
+
uv_shutdown_cb cb;
|
386
|
+
UV_SHUTDOWN_PRIVATE_FIELDS
|
387
|
+
};
|
388
|
+
|
389
|
+
|
390
|
+
#define UV_HANDLE_FIELDS \
|
391
|
+
/* public */ \
|
392
|
+
void* data; \
|
393
|
+
/* read-only */ \
|
394
|
+
uv_loop_t* loop; \
|
395
|
+
uv_handle_type type; \
|
396
|
+
/* private */ \
|
397
|
+
uv_close_cb close_cb; \
|
398
|
+
void* handle_queue[2]; \
|
399
|
+
void* reserved[4]; \
|
400
|
+
UV_HANDLE_PRIVATE_FIELDS \
|
401
|
+
|
402
|
+
/* The abstract base class of all handles. */
|
403
|
+
struct uv_handle_s {
|
404
|
+
UV_HANDLE_FIELDS
|
405
|
+
};
|
406
|
+
|
407
|
+
UV_EXTERN size_t uv_handle_size(uv_handle_type type);
|
408
|
+
UV_EXTERN size_t uv_req_size(uv_req_type type);
|
409
|
+
|
410
|
+
UV_EXTERN int uv_is_active(const uv_handle_t* handle);
|
411
|
+
|
412
|
+
UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg);
|
413
|
+
|
414
|
+
UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
|
415
|
+
|
416
|
+
UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value);
|
417
|
+
UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value);
|
418
|
+
|
419
|
+
UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd);
|
420
|
+
|
421
|
+
UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len);
|
422
|
+
|
423
|
+
|
424
|
+
#define UV_STREAM_FIELDS \
|
425
|
+
/* number of bytes queued for writing */ \
|
426
|
+
size_t write_queue_size; \
|
427
|
+
uv_alloc_cb alloc_cb; \
|
428
|
+
uv_read_cb read_cb; \
|
429
|
+
/* private */ \
|
430
|
+
UV_STREAM_PRIVATE_FIELDS
|
431
|
+
|
432
|
+
/*
|
433
|
+
* uv_stream_t is a subclass of uv_handle_t.
|
434
|
+
*
|
435
|
+
* uv_stream is an abstract class.
|
436
|
+
*
|
437
|
+
* uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t and uv_tty_t.
|
438
|
+
*/
|
439
|
+
struct uv_stream_s {
|
440
|
+
UV_HANDLE_FIELDS
|
441
|
+
UV_STREAM_FIELDS
|
442
|
+
};
|
443
|
+
|
444
|
+
UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb);
|
445
|
+
UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client);
|
446
|
+
|
447
|
+
UV_EXTERN int uv_read_start(uv_stream_t*,
|
448
|
+
uv_alloc_cb alloc_cb,
|
449
|
+
uv_read_cb read_cb);
|
450
|
+
UV_EXTERN int uv_read_stop(uv_stream_t*);
|
451
|
+
|
452
|
+
UV_EXTERN int uv_write(uv_write_t* req,
|
453
|
+
uv_stream_t* handle,
|
454
|
+
const uv_buf_t bufs[],
|
455
|
+
unsigned int nbufs,
|
456
|
+
uv_write_cb cb);
|
457
|
+
UV_EXTERN int uv_write2(uv_write_t* req,
|
458
|
+
uv_stream_t* handle,
|
459
|
+
const uv_buf_t bufs[],
|
460
|
+
unsigned int nbufs,
|
461
|
+
uv_stream_t* send_handle,
|
462
|
+
uv_write_cb cb);
|
463
|
+
UV_EXTERN int uv_try_write(uv_stream_t* handle,
|
464
|
+
const uv_buf_t bufs[],
|
465
|
+
unsigned int nbufs);
|
466
|
+
|
467
|
+
/* uv_write_t is a subclass of uv_req_t. */
|
468
|
+
struct uv_write_s {
|
469
|
+
UV_REQ_FIELDS
|
470
|
+
uv_write_cb cb;
|
471
|
+
uv_stream_t* send_handle;
|
472
|
+
uv_stream_t* handle;
|
473
|
+
UV_WRITE_PRIVATE_FIELDS
|
474
|
+
};
|
475
|
+
|
476
|
+
|
477
|
+
UV_EXTERN int uv_is_readable(const uv_stream_t* handle);
|
478
|
+
UV_EXTERN int uv_is_writable(const uv_stream_t* handle);
|
479
|
+
|
480
|
+
UV_EXTERN int uv_stream_set_blocking(uv_stream_t* handle, int blocking);
|
481
|
+
|
482
|
+
UV_EXTERN int uv_is_closing(const uv_handle_t* handle);
|
483
|
+
|
484
|
+
|
485
|
+
/*
|
486
|
+
* uv_tcp_t is a subclass of uv_stream_t.
|
487
|
+
*
|
488
|
+
* Represents a TCP stream or TCP server.
|
489
|
+
*/
|
490
|
+
struct uv_tcp_s {
|
491
|
+
UV_HANDLE_FIELDS
|
492
|
+
UV_STREAM_FIELDS
|
493
|
+
UV_TCP_PRIVATE_FIELDS
|
494
|
+
};
|
495
|
+
|
496
|
+
UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle);
|
497
|
+
UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock);
|
498
|
+
UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable);
|
499
|
+
UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle,
|
500
|
+
int enable,
|
501
|
+
unsigned int delay);
|
502
|
+
UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable);
|
503
|
+
|
504
|
+
enum uv_tcp_flags {
|
505
|
+
/* Used with uv_tcp_bind, when an IPv6 address is used. */
|
506
|
+
UV_TCP_IPV6ONLY = 1
|
507
|
+
};
|
508
|
+
|
509
|
+
UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle,
|
510
|
+
const struct sockaddr* addr,
|
511
|
+
unsigned int flags);
|
512
|
+
UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle,
|
513
|
+
struct sockaddr* name,
|
514
|
+
int* namelen);
|
515
|
+
UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle,
|
516
|
+
struct sockaddr* name,
|
517
|
+
int* namelen);
|
518
|
+
UV_EXTERN int uv_tcp_connect(uv_connect_t* req,
|
519
|
+
uv_tcp_t* handle,
|
520
|
+
const struct sockaddr* addr,
|
521
|
+
uv_connect_cb cb);
|
522
|
+
|
523
|
+
/* uv_connect_t is a subclass of uv_req_t. */
|
524
|
+
struct uv_connect_s {
|
525
|
+
UV_REQ_FIELDS
|
526
|
+
uv_connect_cb cb;
|
527
|
+
uv_stream_t* handle;
|
528
|
+
UV_CONNECT_PRIVATE_FIELDS
|
529
|
+
};
|
530
|
+
|
531
|
+
|
532
|
+
/*
|
533
|
+
* UDP support.
|
534
|
+
*/
|
535
|
+
|
536
|
+
enum uv_udp_flags {
|
537
|
+
/* Disables dual stack mode. */
|
538
|
+
UV_UDP_IPV6ONLY = 1,
|
539
|
+
/*
|
540
|
+
* Indicates message was truncated because read buffer was too small. The
|
541
|
+
* remainder was discarded by the OS. Used in uv_udp_recv_cb.
|
542
|
+
*/
|
543
|
+
UV_UDP_PARTIAL = 2,
|
544
|
+
/*
|
545
|
+
* Indicates if SO_REUSEADDR will be set when binding the handle.
|
546
|
+
* This sets the SO_REUSEPORT socket flag on the BSDs and OS X. On other
|
547
|
+
* Unix platforms, it sets the SO_REUSEADDR flag. What that means is that
|
548
|
+
* multiple threads or processes can bind to the same address without error
|
549
|
+
* (provided they all set the flag) but only the last one to bind will receive
|
550
|
+
* any traffic, in effect "stealing" the port from the previous listener.
|
551
|
+
*/
|
552
|
+
UV_UDP_REUSEADDR = 4
|
553
|
+
};
|
554
|
+
|
555
|
+
typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status);
|
556
|
+
typedef void (*uv_udp_recv_cb)(uv_udp_t* handle,
|
557
|
+
ssize_t nread,
|
558
|
+
const uv_buf_t* buf,
|
559
|
+
const struct sockaddr* addr,
|
560
|
+
unsigned flags);
|
561
|
+
|
562
|
+
/* uv_udp_t is a subclass of uv_handle_t. */
|
563
|
+
struct uv_udp_s {
|
564
|
+
UV_HANDLE_FIELDS
|
565
|
+
/* read-only */
|
566
|
+
/*
|
567
|
+
* Number of bytes queued for sending. This field strictly shows how much
|
568
|
+
* information is currently queued.
|
569
|
+
*/
|
570
|
+
size_t send_queue_size;
|
571
|
+
/*
|
572
|
+
* Number of send requests currently in the queue awaiting to be processed.
|
573
|
+
*/
|
574
|
+
size_t send_queue_count;
|
575
|
+
UV_UDP_PRIVATE_FIELDS
|
576
|
+
};
|
577
|
+
|
578
|
+
/* uv_udp_send_t is a subclass of uv_req_t. */
|
579
|
+
struct uv_udp_send_s {
|
580
|
+
UV_REQ_FIELDS
|
581
|
+
uv_udp_t* handle;
|
582
|
+
uv_udp_send_cb cb;
|
583
|
+
UV_UDP_SEND_PRIVATE_FIELDS
|
584
|
+
};
|
585
|
+
|
586
|
+
UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
|
587
|
+
UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock);
|
588
|
+
UV_EXTERN int uv_udp_bind(uv_udp_t* handle,
|
589
|
+
const struct sockaddr* addr,
|
590
|
+
unsigned int flags);
|
591
|
+
|
592
|
+
UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle,
|
593
|
+
struct sockaddr* name,
|
594
|
+
int* namelen);
|
595
|
+
UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
|
596
|
+
const char* multicast_addr,
|
597
|
+
const char* interface_addr,
|
598
|
+
uv_membership membership);
|
599
|
+
UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on);
|
600
|
+
UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
|
601
|
+
UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle,
|
602
|
+
const char* interface_addr);
|
603
|
+
UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on);
|
604
|
+
UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl);
|
605
|
+
UV_EXTERN int uv_udp_send(uv_udp_send_t* req,
|
606
|
+
uv_udp_t* handle,
|
607
|
+
const uv_buf_t bufs[],
|
608
|
+
unsigned int nbufs,
|
609
|
+
const struct sockaddr* addr,
|
610
|
+
uv_udp_send_cb send_cb);
|
611
|
+
UV_EXTERN int uv_udp_try_send(uv_udp_t* handle,
|
612
|
+
const uv_buf_t bufs[],
|
613
|
+
unsigned int nbufs,
|
614
|
+
const struct sockaddr* addr);
|
615
|
+
UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle,
|
616
|
+
uv_alloc_cb alloc_cb,
|
617
|
+
uv_udp_recv_cb recv_cb);
|
618
|
+
UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle);
|
619
|
+
|
620
|
+
|
621
|
+
/*
|
622
|
+
* uv_tty_t is a subclass of uv_stream_t.
|
623
|
+
*
|
624
|
+
* Representing a stream for the console.
|
625
|
+
*/
|
626
|
+
struct uv_tty_s {
|
627
|
+
UV_HANDLE_FIELDS
|
628
|
+
UV_STREAM_FIELDS
|
629
|
+
UV_TTY_PRIVATE_FIELDS
|
630
|
+
};
|
631
|
+
|
632
|
+
typedef enum {
|
633
|
+
/* Initial/normal terminal mode */
|
634
|
+
UV_TTY_MODE_NORMAL,
|
635
|
+
/* Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled) */
|
636
|
+
UV_TTY_MODE_RAW,
|
637
|
+
/* Binary-safe I/O mode for IPC (Unix-only) */
|
638
|
+
UV_TTY_MODE_IO
|
639
|
+
} uv_tty_mode_t;
|
640
|
+
|
641
|
+
UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable);
|
642
|
+
UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode);
|
643
|
+
UV_EXTERN int uv_tty_reset_mode(void);
|
644
|
+
UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height);
|
645
|
+
|
646
|
+
#ifdef __cplusplus
|
647
|
+
extern "C++" {
|
648
|
+
|
649
|
+
inline int uv_tty_set_mode(uv_tty_t* handle, int mode) {
|
650
|
+
return uv_tty_set_mode(handle, static_cast<uv_tty_mode_t>(mode));
|
651
|
+
}
|
652
|
+
|
653
|
+
}
|
654
|
+
#endif
|
655
|
+
|
656
|
+
UV_EXTERN uv_handle_type uv_guess_handle(uv_file file);
|
657
|
+
|
658
|
+
/*
|
659
|
+
* uv_pipe_t is a subclass of uv_stream_t.
|
660
|
+
*
|
661
|
+
* Representing a pipe stream or pipe server. On Windows this is a Named
|
662
|
+
* Pipe. On Unix this is a Unix domain socket.
|
663
|
+
*/
|
664
|
+
struct uv_pipe_s {
|
665
|
+
UV_HANDLE_FIELDS
|
666
|
+
UV_STREAM_FIELDS
|
667
|
+
int ipc; /* non-zero if this pipe is used for passing handles */
|
668
|
+
UV_PIPE_PRIVATE_FIELDS
|
669
|
+
};
|
670
|
+
|
671
|
+
UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc);
|
672
|
+
UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file);
|
673
|
+
UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name);
|
674
|
+
UV_EXTERN void uv_pipe_connect(uv_connect_t* req,
|
675
|
+
uv_pipe_t* handle,
|
676
|
+
const char* name,
|
677
|
+
uv_connect_cb cb);
|
678
|
+
UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle,
|
679
|
+
char* buffer,
|
680
|
+
size_t* size);
|
681
|
+
UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle,
|
682
|
+
char* buffer,
|
683
|
+
size_t* size);
|
684
|
+
UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count);
|
685
|
+
UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle);
|
686
|
+
UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle);
|
687
|
+
|
688
|
+
|
689
|
+
struct uv_poll_s {
|
690
|
+
UV_HANDLE_FIELDS
|
691
|
+
uv_poll_cb poll_cb;
|
692
|
+
UV_POLL_PRIVATE_FIELDS
|
693
|
+
};
|
694
|
+
|
695
|
+
enum uv_poll_event {
|
696
|
+
UV_READABLE = 1,
|
697
|
+
UV_WRITABLE = 2
|
698
|
+
};
|
699
|
+
|
700
|
+
UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd);
|
701
|
+
UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop,
|
702
|
+
uv_poll_t* handle,
|
703
|
+
uv_os_sock_t socket);
|
704
|
+
UV_EXTERN int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb);
|
705
|
+
UV_EXTERN int uv_poll_stop(uv_poll_t* handle);
|
706
|
+
|
707
|
+
|
708
|
+
struct uv_prepare_s {
|
709
|
+
UV_HANDLE_FIELDS
|
710
|
+
UV_PREPARE_PRIVATE_FIELDS
|
711
|
+
};
|
712
|
+
|
713
|
+
UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare);
|
714
|
+
UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb);
|
715
|
+
UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare);
|
716
|
+
|
717
|
+
|
718
|
+
struct uv_check_s {
|
719
|
+
UV_HANDLE_FIELDS
|
720
|
+
UV_CHECK_PRIVATE_FIELDS
|
721
|
+
};
|
722
|
+
|
723
|
+
UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check);
|
724
|
+
UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb);
|
725
|
+
UV_EXTERN int uv_check_stop(uv_check_t* check);
|
726
|
+
|
727
|
+
|
728
|
+
struct uv_idle_s {
|
729
|
+
UV_HANDLE_FIELDS
|
730
|
+
UV_IDLE_PRIVATE_FIELDS
|
731
|
+
};
|
732
|
+
|
733
|
+
UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle);
|
734
|
+
UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb);
|
735
|
+
UV_EXTERN int uv_idle_stop(uv_idle_t* idle);
|
736
|
+
|
737
|
+
|
738
|
+
struct uv_async_s {
|
739
|
+
UV_HANDLE_FIELDS
|
740
|
+
UV_ASYNC_PRIVATE_FIELDS
|
741
|
+
};
|
742
|
+
|
743
|
+
UV_EXTERN int uv_async_init(uv_loop_t*,
|
744
|
+
uv_async_t* async,
|
745
|
+
uv_async_cb async_cb);
|
746
|
+
UV_EXTERN int uv_async_send(uv_async_t* async);
|
747
|
+
|
748
|
+
|
749
|
+
/*
|
750
|
+
* uv_timer_t is a subclass of uv_handle_t.
|
751
|
+
*
|
752
|
+
* Used to get woken up at a specified time in the future.
|
753
|
+
*/
|
754
|
+
struct uv_timer_s {
|
755
|
+
UV_HANDLE_FIELDS
|
756
|
+
UV_TIMER_PRIVATE_FIELDS
|
757
|
+
};
|
758
|
+
|
759
|
+
UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle);
|
760
|
+
UV_EXTERN int uv_timer_start(uv_timer_t* handle,
|
761
|
+
uv_timer_cb cb,
|
762
|
+
uint64_t timeout,
|
763
|
+
uint64_t repeat);
|
764
|
+
UV_EXTERN int uv_timer_stop(uv_timer_t* handle);
|
765
|
+
UV_EXTERN int uv_timer_again(uv_timer_t* handle);
|
766
|
+
UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat);
|
767
|
+
UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle);
|
768
|
+
|
769
|
+
|
770
|
+
/*
|
771
|
+
* uv_getaddrinfo_t is a subclass of uv_req_t.
|
772
|
+
*
|
773
|
+
* Request object for uv_getaddrinfo.
|
774
|
+
*/
|
775
|
+
struct uv_getaddrinfo_s {
|
776
|
+
UV_REQ_FIELDS
|
777
|
+
/* read-only */
|
778
|
+
uv_loop_t* loop;
|
779
|
+
/* struct addrinfo* addrinfo is marked as private, but it really isn't. */
|
780
|
+
UV_GETADDRINFO_PRIVATE_FIELDS
|
781
|
+
};
|
782
|
+
|
783
|
+
|
784
|
+
UV_EXTERN int uv_getaddrinfo(uv_loop_t* loop,
|
785
|
+
uv_getaddrinfo_t* req,
|
786
|
+
uv_getaddrinfo_cb getaddrinfo_cb,
|
787
|
+
const char* node,
|
788
|
+
const char* service,
|
789
|
+
const struct addrinfo* hints);
|
790
|
+
UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai);
|
791
|
+
|
792
|
+
|
793
|
+
/*
|
794
|
+
* uv_getnameinfo_t is a subclass of uv_req_t.
|
795
|
+
*
|
796
|
+
* Request object for uv_getnameinfo.
|
797
|
+
*/
|
798
|
+
struct uv_getnameinfo_s {
|
799
|
+
UV_REQ_FIELDS
|
800
|
+
/* read-only */
|
801
|
+
uv_loop_t* loop;
|
802
|
+
/* host and service are marked as private, but they really aren't. */
|
803
|
+
UV_GETNAMEINFO_PRIVATE_FIELDS
|
804
|
+
};
|
805
|
+
|
806
|
+
UV_EXTERN int uv_getnameinfo(uv_loop_t* loop,
|
807
|
+
uv_getnameinfo_t* req,
|
808
|
+
uv_getnameinfo_cb getnameinfo_cb,
|
809
|
+
const struct sockaddr* addr,
|
810
|
+
int flags);
|
811
|
+
|
812
|
+
|
813
|
+
/* uv_spawn() options. */
|
814
|
+
typedef enum {
|
815
|
+
UV_IGNORE = 0x00,
|
816
|
+
UV_CREATE_PIPE = 0x01,
|
817
|
+
UV_INHERIT_FD = 0x02,
|
818
|
+
UV_INHERIT_STREAM = 0x04,
|
819
|
+
|
820
|
+
/*
|
821
|
+
* When UV_CREATE_PIPE is specified, UV_READABLE_PIPE and UV_WRITABLE_PIPE
|
822
|
+
* determine the direction of flow, from the child process' perspective. Both
|
823
|
+
* flags may be specified to create a duplex data stream.
|
824
|
+
*/
|
825
|
+
UV_READABLE_PIPE = 0x10,
|
826
|
+
UV_WRITABLE_PIPE = 0x20
|
827
|
+
} uv_stdio_flags;
|
828
|
+
|
829
|
+
typedef struct uv_stdio_container_s {
|
830
|
+
uv_stdio_flags flags;
|
831
|
+
|
832
|
+
union {
|
833
|
+
uv_stream_t* stream;
|
834
|
+
int fd;
|
835
|
+
} data;
|
836
|
+
} uv_stdio_container_t;
|
837
|
+
|
838
|
+
typedef struct uv_process_options_s {
|
839
|
+
uv_exit_cb exit_cb; /* Called after the process exits. */
|
840
|
+
const char* file; /* Path to program to execute. */
|
841
|
+
/*
|
842
|
+
* Command line arguments. args[0] should be the path to the program. On
|
843
|
+
* Windows this uses CreateProcess which concatenates the arguments into a
|
844
|
+
* string this can cause some strange errors. See the note at
|
845
|
+
* windows_verbatim_arguments.
|
846
|
+
*/
|
847
|
+
char** args;
|
848
|
+
/*
|
849
|
+
* This will be set as the environ variable in the subprocess. If this is
|
850
|
+
* NULL then the parents environ will be used.
|
851
|
+
*/
|
852
|
+
char** env;
|
853
|
+
/*
|
854
|
+
* If non-null this represents a directory the subprocess should execute
|
855
|
+
* in. Stands for current working directory.
|
856
|
+
*/
|
857
|
+
const char* cwd;
|
858
|
+
/*
|
859
|
+
* Various flags that control how uv_spawn() behaves. See the definition of
|
860
|
+
* `enum uv_process_flags` below.
|
861
|
+
*/
|
862
|
+
unsigned int flags;
|
863
|
+
/*
|
864
|
+
* The `stdio` field points to an array of uv_stdio_container_t structs that
|
865
|
+
* describe the file descriptors that will be made available to the child
|
866
|
+
* process. The convention is that stdio[0] points to stdin, fd 1 is used for
|
867
|
+
* stdout, and fd 2 is stderr.
|
868
|
+
*
|
869
|
+
* Note that on windows file descriptors greater than 2 are available to the
|
870
|
+
* child process only if the child processes uses the MSVCRT runtime.
|
871
|
+
*/
|
872
|
+
int stdio_count;
|
873
|
+
uv_stdio_container_t* stdio;
|
874
|
+
/*
|
875
|
+
* Libuv can change the child process' user/group id. This happens only when
|
876
|
+
* the appropriate bits are set in the flags fields. This is not supported on
|
877
|
+
* windows; uv_spawn() will fail and set the error to UV_ENOTSUP.
|
878
|
+
*/
|
879
|
+
uv_uid_t uid;
|
880
|
+
uv_gid_t gid;
|
881
|
+
} uv_process_options_t;
|
882
|
+
|
883
|
+
/*
|
884
|
+
* These are the flags that can be used for the uv_process_options.flags field.
|
885
|
+
*/
|
886
|
+
enum uv_process_flags {
|
887
|
+
/*
|
888
|
+
* Set the child process' user id. The user id is supplied in the `uid` field
|
889
|
+
* of the options struct. This does not work on windows; setting this flag
|
890
|
+
* will cause uv_spawn() to fail.
|
891
|
+
*/
|
892
|
+
UV_PROCESS_SETUID = (1 << 0),
|
893
|
+
/*
|
894
|
+
* Set the child process' group id. The user id is supplied in the `gid`
|
895
|
+
* field of the options struct. This does not work on windows; setting this
|
896
|
+
* flag will cause uv_spawn() to fail.
|
897
|
+
*/
|
898
|
+
UV_PROCESS_SETGID = (1 << 1),
|
899
|
+
/*
|
900
|
+
* Do not wrap any arguments in quotes, or perform any other escaping, when
|
901
|
+
* converting the argument list into a command line string. This option is
|
902
|
+
* only meaningful on Windows systems. On Unix it is silently ignored.
|
903
|
+
*/
|
904
|
+
UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2),
|
905
|
+
/*
|
906
|
+
* Spawn the child process in a detached state - this will make it a process
|
907
|
+
* group leader, and will effectively enable the child to keep running after
|
908
|
+
* the parent exits. Note that the child process will still keep the
|
909
|
+
* parent's event loop alive unless the parent process calls uv_unref() on
|
910
|
+
* the child's process handle.
|
911
|
+
*/
|
912
|
+
UV_PROCESS_DETACHED = (1 << 3),
|
913
|
+
/*
|
914
|
+
* Hide the subprocess console window that would normally be created. This
|
915
|
+
* option is only meaningful on Windows systems. On Unix it is silently
|
916
|
+
* ignored.
|
917
|
+
*/
|
918
|
+
UV_PROCESS_WINDOWS_HIDE = (1 << 4)
|
919
|
+
};
|
920
|
+
|
921
|
+
/*
|
922
|
+
* uv_process_t is a subclass of uv_handle_t.
|
923
|
+
*/
|
924
|
+
struct uv_process_s {
|
925
|
+
UV_HANDLE_FIELDS
|
926
|
+
uv_exit_cb exit_cb;
|
927
|
+
int pid;
|
928
|
+
UV_PROCESS_PRIVATE_FIELDS
|
929
|
+
};
|
930
|
+
|
931
|
+
UV_EXTERN int uv_spawn(uv_loop_t* loop,
|
932
|
+
uv_process_t* handle,
|
933
|
+
const uv_process_options_t* options);
|
934
|
+
UV_EXTERN int uv_process_kill(uv_process_t*, int signum);
|
935
|
+
UV_EXTERN int uv_kill(int pid, int signum);
|
936
|
+
|
937
|
+
|
938
|
+
/*
|
939
|
+
* uv_work_t is a subclass of uv_req_t.
|
940
|
+
*/
|
941
|
+
struct uv_work_s {
|
942
|
+
UV_REQ_FIELDS
|
943
|
+
uv_loop_t* loop;
|
944
|
+
uv_work_cb work_cb;
|
945
|
+
uv_after_work_cb after_work_cb;
|
946
|
+
UV_WORK_PRIVATE_FIELDS
|
947
|
+
};
|
948
|
+
|
949
|
+
UV_EXTERN int uv_queue_work(uv_loop_t* loop,
|
950
|
+
uv_work_t* req,
|
951
|
+
uv_work_cb work_cb,
|
952
|
+
uv_after_work_cb after_work_cb);
|
953
|
+
|
954
|
+
UV_EXTERN int uv_cancel(uv_req_t* req);
|
955
|
+
|
956
|
+
|
957
|
+
struct uv_cpu_info_s {
|
958
|
+
char* model;
|
959
|
+
int speed;
|
960
|
+
struct uv_cpu_times_s {
|
961
|
+
uint64_t user;
|
962
|
+
uint64_t nice;
|
963
|
+
uint64_t sys;
|
964
|
+
uint64_t idle;
|
965
|
+
uint64_t irq;
|
966
|
+
} cpu_times;
|
967
|
+
};
|
968
|
+
|
969
|
+
struct uv_interface_address_s {
|
970
|
+
char* name;
|
971
|
+
char phys_addr[6];
|
972
|
+
int is_internal;
|
973
|
+
union {
|
974
|
+
struct sockaddr_in address4;
|
975
|
+
struct sockaddr_in6 address6;
|
976
|
+
} address;
|
977
|
+
union {
|
978
|
+
struct sockaddr_in netmask4;
|
979
|
+
struct sockaddr_in6 netmask6;
|
980
|
+
} netmask;
|
981
|
+
};
|
982
|
+
|
983
|
+
typedef enum {
|
984
|
+
UV_DIRENT_UNKNOWN,
|
985
|
+
UV_DIRENT_FILE,
|
986
|
+
UV_DIRENT_DIR,
|
987
|
+
UV_DIRENT_LINK,
|
988
|
+
UV_DIRENT_FIFO,
|
989
|
+
UV_DIRENT_SOCKET,
|
990
|
+
UV_DIRENT_CHAR,
|
991
|
+
UV_DIRENT_BLOCK
|
992
|
+
} uv_dirent_type_t;
|
993
|
+
|
994
|
+
struct uv_dirent_s {
|
995
|
+
const char* name;
|
996
|
+
uv_dirent_type_t type;
|
997
|
+
};
|
998
|
+
|
999
|
+
UV_EXTERN char** uv_setup_args(int argc, char** argv);
|
1000
|
+
UV_EXTERN int uv_get_process_title(char* buffer, size_t size);
|
1001
|
+
UV_EXTERN int uv_set_process_title(const char* title);
|
1002
|
+
UV_EXTERN int uv_resident_set_memory(size_t* rss);
|
1003
|
+
UV_EXTERN int uv_uptime(double* uptime);
|
1004
|
+
|
1005
|
+
typedef struct {
|
1006
|
+
long tv_sec;
|
1007
|
+
long tv_usec;
|
1008
|
+
} uv_timeval_t;
|
1009
|
+
|
1010
|
+
typedef struct {
|
1011
|
+
uv_timeval_t ru_utime; /* user CPU time used */
|
1012
|
+
uv_timeval_t ru_stime; /* system CPU time used */
|
1013
|
+
uint64_t ru_maxrss; /* maximum resident set size */
|
1014
|
+
uint64_t ru_ixrss; /* integral shared memory size */
|
1015
|
+
uint64_t ru_idrss; /* integral unshared data size */
|
1016
|
+
uint64_t ru_isrss; /* integral unshared stack size */
|
1017
|
+
uint64_t ru_minflt; /* page reclaims (soft page faults) */
|
1018
|
+
uint64_t ru_majflt; /* page faults (hard page faults) */
|
1019
|
+
uint64_t ru_nswap; /* swaps */
|
1020
|
+
uint64_t ru_inblock; /* block input operations */
|
1021
|
+
uint64_t ru_oublock; /* block output operations */
|
1022
|
+
uint64_t ru_msgsnd; /* IPC messages sent */
|
1023
|
+
uint64_t ru_msgrcv; /* IPC messages received */
|
1024
|
+
uint64_t ru_nsignals; /* signals received */
|
1025
|
+
uint64_t ru_nvcsw; /* voluntary context switches */
|
1026
|
+
uint64_t ru_nivcsw; /* involuntary context switches */
|
1027
|
+
} uv_rusage_t;
|
1028
|
+
|
1029
|
+
UV_EXTERN int uv_getrusage(uv_rusage_t* rusage);
|
1030
|
+
|
1031
|
+
UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
|
1032
|
+
UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);
|
1033
|
+
|
1034
|
+
UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses,
|
1035
|
+
int* count);
|
1036
|
+
UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses,
|
1037
|
+
int count);
|
1038
|
+
|
1039
|
+
|
1040
|
+
typedef enum {
|
1041
|
+
UV_FS_UNKNOWN = -1,
|
1042
|
+
UV_FS_CUSTOM,
|
1043
|
+
UV_FS_OPEN,
|
1044
|
+
UV_FS_CLOSE,
|
1045
|
+
UV_FS_READ,
|
1046
|
+
UV_FS_WRITE,
|
1047
|
+
UV_FS_SENDFILE,
|
1048
|
+
UV_FS_STAT,
|
1049
|
+
UV_FS_LSTAT,
|
1050
|
+
UV_FS_FSTAT,
|
1051
|
+
UV_FS_FTRUNCATE,
|
1052
|
+
UV_FS_UTIME,
|
1053
|
+
UV_FS_FUTIME,
|
1054
|
+
UV_FS_ACCESS,
|
1055
|
+
UV_FS_CHMOD,
|
1056
|
+
UV_FS_FCHMOD,
|
1057
|
+
UV_FS_FSYNC,
|
1058
|
+
UV_FS_FDATASYNC,
|
1059
|
+
UV_FS_UNLINK,
|
1060
|
+
UV_FS_RMDIR,
|
1061
|
+
UV_FS_MKDIR,
|
1062
|
+
UV_FS_MKDTEMP,
|
1063
|
+
UV_FS_RENAME,
|
1064
|
+
UV_FS_SCANDIR,
|
1065
|
+
UV_FS_LINK,
|
1066
|
+
UV_FS_SYMLINK,
|
1067
|
+
UV_FS_READLINK,
|
1068
|
+
UV_FS_CHOWN,
|
1069
|
+
UV_FS_FCHOWN
|
1070
|
+
} uv_fs_type;
|
1071
|
+
|
1072
|
+
/* uv_fs_t is a subclass of uv_req_t. */
|
1073
|
+
struct uv_fs_s {
|
1074
|
+
UV_REQ_FIELDS
|
1075
|
+
uv_fs_type fs_type;
|
1076
|
+
uv_loop_t* loop;
|
1077
|
+
uv_fs_cb cb;
|
1078
|
+
ssize_t result;
|
1079
|
+
void* ptr;
|
1080
|
+
const char* path;
|
1081
|
+
uv_stat_t statbuf; /* Stores the result of uv_fs_stat() and uv_fs_fstat(). */
|
1082
|
+
UV_FS_PRIVATE_FIELDS
|
1083
|
+
};
|
1084
|
+
|
1085
|
+
UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req);
|
1086
|
+
UV_EXTERN int uv_fs_close(uv_loop_t* loop,
|
1087
|
+
uv_fs_t* req,
|
1088
|
+
uv_file file,
|
1089
|
+
uv_fs_cb cb);
|
1090
|
+
UV_EXTERN int uv_fs_open(uv_loop_t* loop,
|
1091
|
+
uv_fs_t* req,
|
1092
|
+
const char* path,
|
1093
|
+
int flags,
|
1094
|
+
int mode,
|
1095
|
+
uv_fs_cb cb);
|
1096
|
+
UV_EXTERN int uv_fs_read(uv_loop_t* loop,
|
1097
|
+
uv_fs_t* req,
|
1098
|
+
uv_file file,
|
1099
|
+
const uv_buf_t bufs[],
|
1100
|
+
unsigned int nbufs,
|
1101
|
+
int64_t offset,
|
1102
|
+
uv_fs_cb cb);
|
1103
|
+
UV_EXTERN int uv_fs_unlink(uv_loop_t* loop,
|
1104
|
+
uv_fs_t* req,
|
1105
|
+
const char* path,
|
1106
|
+
uv_fs_cb cb);
|
1107
|
+
UV_EXTERN int uv_fs_write(uv_loop_t* loop,
|
1108
|
+
uv_fs_t* req,
|
1109
|
+
uv_file file,
|
1110
|
+
const uv_buf_t bufs[],
|
1111
|
+
unsigned int nbufs,
|
1112
|
+
int64_t offset,
|
1113
|
+
uv_fs_cb cb);
|
1114
|
+
UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop,
|
1115
|
+
uv_fs_t* req,
|
1116
|
+
const char* path,
|
1117
|
+
int mode,
|
1118
|
+
uv_fs_cb cb);
|
1119
|
+
UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop,
|
1120
|
+
uv_fs_t* req,
|
1121
|
+
const char* tpl,
|
1122
|
+
uv_fs_cb cb);
|
1123
|
+
UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop,
|
1124
|
+
uv_fs_t* req,
|
1125
|
+
const char* path,
|
1126
|
+
uv_fs_cb cb);
|
1127
|
+
UV_EXTERN int uv_fs_scandir(uv_loop_t* loop,
|
1128
|
+
uv_fs_t* req,
|
1129
|
+
const char* path,
|
1130
|
+
int flags,
|
1131
|
+
uv_fs_cb cb);
|
1132
|
+
UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req,
|
1133
|
+
uv_dirent_t* ent);
|
1134
|
+
UV_EXTERN int uv_fs_stat(uv_loop_t* loop,
|
1135
|
+
uv_fs_t* req,
|
1136
|
+
const char* path,
|
1137
|
+
uv_fs_cb cb);
|
1138
|
+
UV_EXTERN int uv_fs_fstat(uv_loop_t* loop,
|
1139
|
+
uv_fs_t* req,
|
1140
|
+
uv_file file,
|
1141
|
+
uv_fs_cb cb);
|
1142
|
+
UV_EXTERN int uv_fs_rename(uv_loop_t* loop,
|
1143
|
+
uv_fs_t* req,
|
1144
|
+
const char* path,
|
1145
|
+
const char* new_path,
|
1146
|
+
uv_fs_cb cb);
|
1147
|
+
UV_EXTERN int uv_fs_fsync(uv_loop_t* loop,
|
1148
|
+
uv_fs_t* req,
|
1149
|
+
uv_file file,
|
1150
|
+
uv_fs_cb cb);
|
1151
|
+
UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop,
|
1152
|
+
uv_fs_t* req,
|
1153
|
+
uv_file file,
|
1154
|
+
uv_fs_cb cb);
|
1155
|
+
UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop,
|
1156
|
+
uv_fs_t* req,
|
1157
|
+
uv_file file,
|
1158
|
+
int64_t offset,
|
1159
|
+
uv_fs_cb cb);
|
1160
|
+
UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop,
|
1161
|
+
uv_fs_t* req,
|
1162
|
+
uv_file out_fd,
|
1163
|
+
uv_file in_fd,
|
1164
|
+
int64_t in_offset,
|
1165
|
+
size_t length,
|
1166
|
+
uv_fs_cb cb);
|
1167
|
+
UV_EXTERN int uv_fs_access(uv_loop_t* loop,
|
1168
|
+
uv_fs_t* req,
|
1169
|
+
const char* path,
|
1170
|
+
int mode,
|
1171
|
+
uv_fs_cb cb);
|
1172
|
+
UV_EXTERN int uv_fs_chmod(uv_loop_t* loop,
|
1173
|
+
uv_fs_t* req,
|
1174
|
+
const char* path,
|
1175
|
+
int mode,
|
1176
|
+
uv_fs_cb cb);
|
1177
|
+
UV_EXTERN int uv_fs_utime(uv_loop_t* loop,
|
1178
|
+
uv_fs_t* req,
|
1179
|
+
const char* path,
|
1180
|
+
double atime,
|
1181
|
+
double mtime,
|
1182
|
+
uv_fs_cb cb);
|
1183
|
+
UV_EXTERN int uv_fs_futime(uv_loop_t* loop,
|
1184
|
+
uv_fs_t* req,
|
1185
|
+
uv_file file,
|
1186
|
+
double atime,
|
1187
|
+
double mtime,
|
1188
|
+
uv_fs_cb cb);
|
1189
|
+
UV_EXTERN int uv_fs_lstat(uv_loop_t* loop,
|
1190
|
+
uv_fs_t* req,
|
1191
|
+
const char* path,
|
1192
|
+
uv_fs_cb cb);
|
1193
|
+
UV_EXTERN int uv_fs_link(uv_loop_t* loop,
|
1194
|
+
uv_fs_t* req,
|
1195
|
+
const char* path,
|
1196
|
+
const char* new_path,
|
1197
|
+
uv_fs_cb cb);
|
1198
|
+
|
1199
|
+
/*
|
1200
|
+
* This flag can be used with uv_fs_symlink() on Windows to specify whether
|
1201
|
+
* path argument points to a directory.
|
1202
|
+
*/
|
1203
|
+
#define UV_FS_SYMLINK_DIR 0x0001
|
1204
|
+
|
1205
|
+
/*
|
1206
|
+
* This flag can be used with uv_fs_symlink() on Windows to specify whether
|
1207
|
+
* the symlink is to be created using junction points.
|
1208
|
+
*/
|
1209
|
+
#define UV_FS_SYMLINK_JUNCTION 0x0002
|
1210
|
+
|
1211
|
+
UV_EXTERN int uv_fs_symlink(uv_loop_t* loop,
|
1212
|
+
uv_fs_t* req,
|
1213
|
+
const char* path,
|
1214
|
+
const char* new_path,
|
1215
|
+
int flags,
|
1216
|
+
uv_fs_cb cb);
|
1217
|
+
UV_EXTERN int uv_fs_readlink(uv_loop_t* loop,
|
1218
|
+
uv_fs_t* req,
|
1219
|
+
const char* path,
|
1220
|
+
uv_fs_cb cb);
|
1221
|
+
UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop,
|
1222
|
+
uv_fs_t* req,
|
1223
|
+
uv_file file,
|
1224
|
+
int mode,
|
1225
|
+
uv_fs_cb cb);
|
1226
|
+
UV_EXTERN int uv_fs_chown(uv_loop_t* loop,
|
1227
|
+
uv_fs_t* req,
|
1228
|
+
const char* path,
|
1229
|
+
uv_uid_t uid,
|
1230
|
+
uv_gid_t gid,
|
1231
|
+
uv_fs_cb cb);
|
1232
|
+
UV_EXTERN int uv_fs_fchown(uv_loop_t* loop,
|
1233
|
+
uv_fs_t* req,
|
1234
|
+
uv_file file,
|
1235
|
+
uv_uid_t uid,
|
1236
|
+
uv_gid_t gid,
|
1237
|
+
uv_fs_cb cb);
|
1238
|
+
|
1239
|
+
|
1240
|
+
enum uv_fs_event {
|
1241
|
+
UV_RENAME = 1,
|
1242
|
+
UV_CHANGE = 2
|
1243
|
+
};
|
1244
|
+
|
1245
|
+
|
1246
|
+
struct uv_fs_event_s {
|
1247
|
+
UV_HANDLE_FIELDS
|
1248
|
+
/* private */
|
1249
|
+
char* path;
|
1250
|
+
UV_FS_EVENT_PRIVATE_FIELDS
|
1251
|
+
};
|
1252
|
+
|
1253
|
+
|
1254
|
+
/*
|
1255
|
+
* uv_fs_stat() based polling file watcher.
|
1256
|
+
*/
|
1257
|
+
struct uv_fs_poll_s {
|
1258
|
+
UV_HANDLE_FIELDS
|
1259
|
+
/* Private, don't touch. */
|
1260
|
+
void* poll_ctx;
|
1261
|
+
};
|
1262
|
+
|
1263
|
+
UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle);
|
1264
|
+
UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle,
|
1265
|
+
uv_fs_poll_cb poll_cb,
|
1266
|
+
const char* path,
|
1267
|
+
unsigned int interval);
|
1268
|
+
UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle);
|
1269
|
+
UV_EXTERN int uv_fs_poll_getpath(uv_fs_poll_t* handle,
|
1270
|
+
char* buffer,
|
1271
|
+
size_t* size);
|
1272
|
+
|
1273
|
+
|
1274
|
+
struct uv_signal_s {
|
1275
|
+
UV_HANDLE_FIELDS
|
1276
|
+
uv_signal_cb signal_cb;
|
1277
|
+
int signum;
|
1278
|
+
UV_SIGNAL_PRIVATE_FIELDS
|
1279
|
+
};
|
1280
|
+
|
1281
|
+
UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle);
|
1282
|
+
UV_EXTERN int uv_signal_start(uv_signal_t* handle,
|
1283
|
+
uv_signal_cb signal_cb,
|
1284
|
+
int signum);
|
1285
|
+
UV_EXTERN int uv_signal_stop(uv_signal_t* handle);
|
1286
|
+
|
1287
|
+
UV_EXTERN void uv_loadavg(double avg[3]);
|
1288
|
+
|
1289
|
+
|
1290
|
+
/*
|
1291
|
+
* Flags to be passed to uv_fs_event_start().
|
1292
|
+
*/
|
1293
|
+
enum uv_fs_event_flags {
|
1294
|
+
/*
|
1295
|
+
* By default, if the fs event watcher is given a directory name, we will
|
1296
|
+
* watch for all events in that directory. This flags overrides this behavior
|
1297
|
+
* and makes fs_event report only changes to the directory entry itself. This
|
1298
|
+
* flag does not affect individual files watched.
|
1299
|
+
* This flag is currently not implemented yet on any backend.
|
1300
|
+
*/
|
1301
|
+
UV_FS_EVENT_WATCH_ENTRY = 1,
|
1302
|
+
|
1303
|
+
/*
|
1304
|
+
* By default uv_fs_event will try to use a kernel interface such as inotify
|
1305
|
+
* or kqueue to detect events. This may not work on remote filesystems such
|
1306
|
+
* as NFS mounts. This flag makes fs_event fall back to calling stat() on a
|
1307
|
+
* regular interval.
|
1308
|
+
* This flag is currently not implemented yet on any backend.
|
1309
|
+
*/
|
1310
|
+
UV_FS_EVENT_STAT = 2,
|
1311
|
+
|
1312
|
+
/*
|
1313
|
+
* By default, event watcher, when watching directory, is not registering
|
1314
|
+
* (is ignoring) changes in it's subdirectories.
|
1315
|
+
* This flag will override this behaviour on platforms that support it.
|
1316
|
+
*/
|
1317
|
+
UV_FS_EVENT_RECURSIVE = 4
|
1318
|
+
};
|
1319
|
+
|
1320
|
+
|
1321
|
+
UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle);
|
1322
|
+
UV_EXTERN int uv_fs_event_start(uv_fs_event_t* handle,
|
1323
|
+
uv_fs_event_cb cb,
|
1324
|
+
const char* path,
|
1325
|
+
unsigned int flags);
|
1326
|
+
UV_EXTERN int uv_fs_event_stop(uv_fs_event_t* handle);
|
1327
|
+
UV_EXTERN int uv_fs_event_getpath(uv_fs_event_t* handle,
|
1328
|
+
char* buffer,
|
1329
|
+
size_t* size);
|
1330
|
+
|
1331
|
+
UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr);
|
1332
|
+
UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr);
|
1333
|
+
|
1334
|
+
UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size);
|
1335
|
+
UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size);
|
1336
|
+
|
1337
|
+
UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size);
|
1338
|
+
UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst);
|
1339
|
+
|
1340
|
+
UV_EXTERN int uv_exepath(char* buffer, size_t* size);
|
1341
|
+
|
1342
|
+
UV_EXTERN int uv_cwd(char* buffer, size_t* size);
|
1343
|
+
|
1344
|
+
UV_EXTERN int uv_chdir(const char* dir);
|
1345
|
+
|
1346
|
+
UV_EXTERN uint64_t uv_get_free_memory(void);
|
1347
|
+
UV_EXTERN uint64_t uv_get_total_memory(void);
|
1348
|
+
|
1349
|
+
UV_EXTERN extern uint64_t uv_hrtime(void);
|
1350
|
+
|
1351
|
+
UV_EXTERN void uv_disable_stdio_inheritance(void);
|
1352
|
+
|
1353
|
+
UV_EXTERN int uv_dlopen(const char* filename, uv_lib_t* lib);
|
1354
|
+
UV_EXTERN void uv_dlclose(uv_lib_t* lib);
|
1355
|
+
UV_EXTERN int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr);
|
1356
|
+
UV_EXTERN const char* uv_dlerror(const uv_lib_t* lib);
|
1357
|
+
|
1358
|
+
UV_EXTERN int uv_mutex_init(uv_mutex_t* handle);
|
1359
|
+
UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle);
|
1360
|
+
UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle);
|
1361
|
+
UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle);
|
1362
|
+
UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle);
|
1363
|
+
|
1364
|
+
UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock);
|
1365
|
+
UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock);
|
1366
|
+
UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock);
|
1367
|
+
UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock);
|
1368
|
+
UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock);
|
1369
|
+
UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock);
|
1370
|
+
UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock);
|
1371
|
+
UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock);
|
1372
|
+
|
1373
|
+
UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value);
|
1374
|
+
UV_EXTERN void uv_sem_destroy(uv_sem_t* sem);
|
1375
|
+
UV_EXTERN void uv_sem_post(uv_sem_t* sem);
|
1376
|
+
UV_EXTERN void uv_sem_wait(uv_sem_t* sem);
|
1377
|
+
UV_EXTERN int uv_sem_trywait(uv_sem_t* sem);
|
1378
|
+
|
1379
|
+
UV_EXTERN int uv_cond_init(uv_cond_t* cond);
|
1380
|
+
UV_EXTERN void uv_cond_destroy(uv_cond_t* cond);
|
1381
|
+
UV_EXTERN void uv_cond_signal(uv_cond_t* cond);
|
1382
|
+
UV_EXTERN void uv_cond_broadcast(uv_cond_t* cond);
|
1383
|
+
|
1384
|
+
UV_EXTERN int uv_barrier_init(uv_barrier_t* barrier, unsigned int count);
|
1385
|
+
UV_EXTERN void uv_barrier_destroy(uv_barrier_t* barrier);
|
1386
|
+
UV_EXTERN int uv_barrier_wait(uv_barrier_t* barrier);
|
1387
|
+
|
1388
|
+
UV_EXTERN void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex);
|
1389
|
+
UV_EXTERN int uv_cond_timedwait(uv_cond_t* cond,
|
1390
|
+
uv_mutex_t* mutex,
|
1391
|
+
uint64_t timeout);
|
1392
|
+
|
1393
|
+
UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void));
|
1394
|
+
|
1395
|
+
UV_EXTERN int uv_key_create(uv_key_t* key);
|
1396
|
+
UV_EXTERN void uv_key_delete(uv_key_t* key);
|
1397
|
+
UV_EXTERN void* uv_key_get(uv_key_t* key);
|
1398
|
+
UV_EXTERN void uv_key_set(uv_key_t* key, void* value);
|
1399
|
+
|
1400
|
+
typedef void (*uv_thread_cb)(void* arg);
|
1401
|
+
|
1402
|
+
UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg);
|
1403
|
+
UV_EXTERN uv_thread_t uv_thread_self(void);
|
1404
|
+
UV_EXTERN int uv_thread_join(uv_thread_t *tid);
|
1405
|
+
UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2);
|
1406
|
+
|
1407
|
+
/* The presence of these unions force similar struct layout. */
|
1408
|
+
#define XX(_, name) uv_ ## name ## _t name;
|
1409
|
+
union uv_any_handle {
|
1410
|
+
UV_HANDLE_TYPE_MAP(XX)
|
1411
|
+
};
|
1412
|
+
|
1413
|
+
union uv_any_req {
|
1414
|
+
UV_REQ_TYPE_MAP(XX)
|
1415
|
+
};
|
1416
|
+
#undef XX
|
1417
|
+
|
1418
|
+
|
1419
|
+
struct uv_loop_s {
|
1420
|
+
/* User data - use this for whatever. */
|
1421
|
+
void* data;
|
1422
|
+
/* Loop reference counting. */
|
1423
|
+
unsigned int active_handles;
|
1424
|
+
void* handle_queue[2];
|
1425
|
+
void* active_reqs[2];
|
1426
|
+
/* Internal flag to signal loop stop. */
|
1427
|
+
unsigned int stop_flag;
|
1428
|
+
UV_LOOP_PRIVATE_FIELDS
|
1429
|
+
};
|
1430
|
+
|
1431
|
+
|
1432
|
+
/* Don't export the private CPP symbols. */
|
1433
|
+
#undef UV_HANDLE_TYPE_PRIVATE
|
1434
|
+
#undef UV_REQ_TYPE_PRIVATE
|
1435
|
+
#undef UV_REQ_PRIVATE_FIELDS
|
1436
|
+
#undef UV_STREAM_PRIVATE_FIELDS
|
1437
|
+
#undef UV_TCP_PRIVATE_FIELDS
|
1438
|
+
#undef UV_PREPARE_PRIVATE_FIELDS
|
1439
|
+
#undef UV_CHECK_PRIVATE_FIELDS
|
1440
|
+
#undef UV_IDLE_PRIVATE_FIELDS
|
1441
|
+
#undef UV_ASYNC_PRIVATE_FIELDS
|
1442
|
+
#undef UV_TIMER_PRIVATE_FIELDS
|
1443
|
+
#undef UV_GETADDRINFO_PRIVATE_FIELDS
|
1444
|
+
#undef UV_GETNAMEINFO_PRIVATE_FIELDS
|
1445
|
+
#undef UV_FS_REQ_PRIVATE_FIELDS
|
1446
|
+
#undef UV_WORK_PRIVATE_FIELDS
|
1447
|
+
#undef UV_FS_EVENT_PRIVATE_FIELDS
|
1448
|
+
#undef UV_SIGNAL_PRIVATE_FIELDS
|
1449
|
+
#undef UV_LOOP_PRIVATE_FIELDS
|
1450
|
+
#undef UV_LOOP_PRIVATE_PLATFORM_FIELDS
|
1451
|
+
|
1452
|
+
#ifdef __cplusplus
|
1453
|
+
}
|
1454
|
+
#endif
|
1455
|
+
#endif /* UV_H */
|