uv.h 57 KB

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