File indexing completed on 2026-08-05 09:21:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef UV_H
0025 #define UV_H
0026 #ifdef __cplusplus
0027 extern "C" {
0028 #endif
0029
0030 #if defined(BUILDING_UV_SHARED) && defined(USING_UV_SHARED)
0031 #error "Define either BUILDING_UV_SHARED or USING_UV_SHARED, not both."
0032 #endif
0033
0034 #ifndef UV_EXTERN
0035 #ifdef _WIN32
0036
0037 # if defined(BUILDING_UV_SHARED)
0038
0039 # define UV_EXTERN __declspec(dllexport)
0040 # elif defined(USING_UV_SHARED)
0041
0042 # define UV_EXTERN __declspec(dllimport)
0043 # else
0044
0045 # define UV_EXTERN
0046 # endif
0047 #elif defined(__GNUC__)
0048 # define UV_EXTERN __attribute__((visibility("default")))
0049 #else
0050 # define UV_EXTERN
0051 #endif
0052 #endif
0053
0054 #include "uv/errno.h"
0055 #include "uv/version.h"
0056 #include <stddef.h>
0057 #include <stdio.h>
0058 #include <stdint.h>
0059 #include <math.h>
0060
0061
0062 struct uv__queue {
0063 struct uv__queue* next;
0064 struct uv__queue* prev;
0065 };
0066
0067 #if defined(_WIN32)
0068 # include "uv/win.h"
0069 #else
0070 # include "uv/unix.h"
0071 #endif
0072
0073
0074 #define UV_ERRNO_MAP(XX) \
0075 XX(E2BIG, "argument list too long") \
0076 XX(EACCES, "permission denied") \
0077 XX(EADDRINUSE, "address already in use") \
0078 XX(EADDRNOTAVAIL, "address not available") \
0079 XX(EAFNOSUPPORT, "address family not supported") \
0080 XX(EAGAIN, "resource temporarily unavailable") \
0081 XX(EAI_ADDRFAMILY, "address family not supported") \
0082 XX(EAI_AGAIN, "temporary failure") \
0083 XX(EAI_BADFLAGS, "bad ai_flags value") \
0084 XX(EAI_BADHINTS, "invalid value for hints") \
0085 XX(EAI_CANCELED, "request canceled") \
0086 XX(EAI_FAIL, "permanent failure") \
0087 XX(EAI_FAMILY, "ai_family not supported") \
0088 XX(EAI_MEMORY, "out of memory") \
0089 XX(EAI_NODATA, "no address") \
0090 XX(EAI_NONAME, "unknown node or service") \
0091 XX(EAI_OVERFLOW, "argument buffer overflow") \
0092 XX(EAI_PROTOCOL, "resolved protocol is unknown") \
0093 XX(EAI_SERVICE, "service not available for socket type") \
0094 XX(EAI_SOCKTYPE, "socket type not supported") \
0095 XX(EALREADY, "connection already in progress") \
0096 XX(EBADF, "bad file descriptor") \
0097 XX(EBUSY, "resource busy or locked") \
0098 XX(ECANCELED, "operation canceled") \
0099 XX(ECHARSET, "invalid Unicode character") \
0100 XX(ECONNABORTED, "software caused connection abort") \
0101 XX(ECONNREFUSED, "connection refused") \
0102 XX(ECONNRESET, "connection reset by peer") \
0103 XX(EDESTADDRREQ, "destination address required") \
0104 XX(EEXIST, "file already exists") \
0105 XX(EFAULT, "bad address in system call argument") \
0106 XX(EFBIG, "file too large") \
0107 XX(EHOSTUNREACH, "host is unreachable") \
0108 XX(EINTR, "interrupted system call") \
0109 XX(EINVAL, "invalid argument") \
0110 XX(EIO, "i/o error") \
0111 XX(EISCONN, "socket is already connected") \
0112 XX(EISDIR, "illegal operation on a directory") \
0113 XX(ELOOP, "too many symbolic links encountered") \
0114 XX(EMFILE, "too many open files") \
0115 XX(EMSGSIZE, "message too long") \
0116 XX(ENAMETOOLONG, "name too long") \
0117 XX(ENETDOWN, "network is down") \
0118 XX(ENETUNREACH, "network is unreachable") \
0119 XX(ENFILE, "file table overflow") \
0120 XX(ENOBUFS, "no buffer space available") \
0121 XX(ENODEV, "no such device") \
0122 XX(ENOENT, "no such file or directory") \
0123 XX(ENOMEM, "not enough memory") \
0124 XX(ENONET, "machine is not on the network") \
0125 XX(ENOPROTOOPT, "protocol not available") \
0126 XX(ENOSPC, "no space left on device") \
0127 XX(ENOSYS, "function not implemented") \
0128 XX(ENOTCONN, "socket is not connected") \
0129 XX(ENOTDIR, "not a directory") \
0130 XX(ENOTEMPTY, "directory not empty") \
0131 XX(ENOTSOCK, "socket operation on non-socket") \
0132 XX(ENOTSUP, "operation not supported on socket") \
0133 XX(EOVERFLOW, "value too large for defined data type") \
0134 XX(EPERM, "operation not permitted") \
0135 XX(EPIPE, "broken pipe") \
0136 XX(EPROTO, "protocol error") \
0137 XX(EPROTONOSUPPORT, "protocol not supported") \
0138 XX(EPROTOTYPE, "protocol wrong type for socket") \
0139 XX(ERANGE, "result too large") \
0140 XX(EROFS, "read-only file system") \
0141 XX(ESHUTDOWN, "cannot send after transport endpoint shutdown") \
0142 XX(ESPIPE, "invalid seek") \
0143 XX(ESRCH, "no such process") \
0144 XX(ETIMEDOUT, "connection timed out") \
0145 XX(ETXTBSY, "text file is busy") \
0146 XX(EXDEV, "cross-device link not permitted") \
0147 XX(UNKNOWN, "unknown error") \
0148 XX(EOF, "end of file") \
0149 XX(ENXIO, "no such device or address") \
0150 XX(EMLINK, "too many links") \
0151 XX(EHOSTDOWN, "host is down") \
0152 XX(EREMOTEIO, "remote I/O error") \
0153 XX(ENOTTY, "inappropriate ioctl for device") \
0154 XX(EFTYPE, "inappropriate file type or format") \
0155 XX(EILSEQ, "illegal byte sequence") \
0156 XX(ESOCKTNOSUPPORT, "socket type not supported") \
0157 XX(ENODATA, "no data available") \
0158 XX(EUNATCH, "protocol driver not attached") \
0159 XX(ENOEXEC, "exec format error") \
0160
0161 #define UV_HANDLE_TYPE_MAP(XX) \
0162 XX(ASYNC, async) \
0163 XX(CHECK, check) \
0164 XX(FS_EVENT, fs_event) \
0165 XX(FS_POLL, fs_poll) \
0166 XX(HANDLE, handle) \
0167 XX(IDLE, idle) \
0168 XX(NAMED_PIPE, pipe) \
0169 XX(POLL, poll) \
0170 XX(PREPARE, prepare) \
0171 XX(PROCESS, process) \
0172 XX(STREAM, stream) \
0173 XX(TCP, tcp) \
0174 XX(TIMER, timer) \
0175 XX(TTY, tty) \
0176 XX(UDP, udp) \
0177 XX(SIGNAL, signal) \
0178
0179 #define UV_REQ_TYPE_MAP(XX) \
0180 XX(REQ, req) \
0181 XX(CONNECT, connect) \
0182 XX(WRITE, write) \
0183 XX(SHUTDOWN, shutdown) \
0184 XX(UDP_SEND, udp_send) \
0185 XX(FS, fs) \
0186 XX(WORK, work) \
0187 XX(GETADDRINFO, getaddrinfo) \
0188 XX(GETNAMEINFO, getnameinfo) \
0189 XX(RANDOM, random) \
0190
0191 typedef enum {
0192 #define XX(code, _) UV_ ## code = UV__ ## code,
0193 UV_ERRNO_MAP(XX)
0194 #undef XX
0195 UV_ERRNO_MAX = UV__EOF - 1
0196 } uv_errno_t;
0197
0198 typedef enum {
0199 UV_UNKNOWN_HANDLE = 0,
0200 #define XX(uc, lc) UV_##uc,
0201 UV_HANDLE_TYPE_MAP(XX)
0202 #undef XX
0203 UV_FILE,
0204 UV_HANDLE_TYPE_MAX
0205 } uv_handle_type;
0206
0207 typedef enum {
0208 UV_UNKNOWN_REQ = 0,
0209 #define XX(uc, lc) UV_##uc,
0210 UV_REQ_TYPE_MAP(XX)
0211 #undef XX
0212 UV_REQ_TYPE_PRIVATE
0213 UV_REQ_TYPE_MAX
0214 } uv_req_type;
0215
0216
0217
0218 typedef struct uv_loop_s uv_loop_t;
0219 typedef struct uv_handle_s uv_handle_t;
0220 typedef struct uv_dir_s uv_dir_t;
0221 typedef struct uv_stream_s uv_stream_t;
0222 typedef struct uv_tcp_s uv_tcp_t;
0223 typedef struct uv_udp_s uv_udp_t;
0224 typedef struct uv_pipe_s uv_pipe_t;
0225 typedef struct uv_tty_s uv_tty_t;
0226 typedef struct uv_poll_s uv_poll_t;
0227 typedef struct uv_timer_s uv_timer_t;
0228 typedef struct uv_prepare_s uv_prepare_t;
0229 typedef struct uv_check_s uv_check_t;
0230 typedef struct uv_idle_s uv_idle_t;
0231 typedef struct uv_async_s uv_async_t;
0232 typedef struct uv_process_s uv_process_t;
0233 typedef struct uv_fs_event_s uv_fs_event_t;
0234 typedef struct uv_fs_poll_s uv_fs_poll_t;
0235 typedef struct uv_signal_s uv_signal_t;
0236
0237
0238 typedef struct uv_req_s uv_req_t;
0239 typedef struct uv_getaddrinfo_s uv_getaddrinfo_t;
0240 typedef struct uv_getnameinfo_s uv_getnameinfo_t;
0241 typedef struct uv_shutdown_s uv_shutdown_t;
0242 typedef struct uv_write_s uv_write_t;
0243 typedef struct uv_connect_s uv_connect_t;
0244 typedef struct uv_udp_send_s uv_udp_send_t;
0245 typedef struct uv_fs_s uv_fs_t;
0246 typedef struct uv_work_s uv_work_t;
0247 typedef struct uv_random_s uv_random_t;
0248
0249
0250 typedef struct uv_env_item_s uv_env_item_t;
0251 typedef struct uv_cpu_info_s uv_cpu_info_t;
0252 typedef struct uv_interface_address_s uv_interface_address_t;
0253 typedef struct uv_dirent_s uv_dirent_t;
0254 typedef struct uv_passwd_s uv_passwd_t;
0255 typedef struct uv_group_s uv_group_t;
0256 typedef struct uv_utsname_s uv_utsname_t;
0257 typedef struct uv_statfs_s uv_statfs_t;
0258
0259 typedef struct uv_metrics_s uv_metrics_t;
0260
0261 typedef enum {
0262 UV_LOOP_BLOCK_SIGNAL = 0,
0263 UV_METRICS_IDLE_TIME,
0264 UV_LOOP_USE_IO_URING_SQPOLL
0265 #define UV_LOOP_USE_IO_URING_SQPOLL UV_LOOP_USE_IO_URING_SQPOLL
0266 } uv_loop_option;
0267
0268 typedef enum {
0269 UV_RUN_DEFAULT = 0,
0270 UV_RUN_ONCE,
0271 UV_RUN_NOWAIT
0272 } uv_run_mode;
0273
0274
0275 UV_EXTERN unsigned int uv_version(void);
0276 UV_EXTERN const char* uv_version_string(void);
0277
0278 typedef void* (*uv_malloc_func)(size_t size);
0279 typedef void* (*uv_realloc_func)(void* ptr, size_t size);
0280 typedef void* (*uv_calloc_func)(size_t count, size_t size);
0281 typedef void (*uv_free_func)(void* ptr);
0282
0283 UV_EXTERN void uv_library_shutdown(void);
0284
0285 UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func,
0286 uv_realloc_func realloc_func,
0287 uv_calloc_func calloc_func,
0288 uv_free_func free_func);
0289
0290 UV_EXTERN uv_loop_t* uv_default_loop(void);
0291 UV_EXTERN int uv_loop_init(uv_loop_t* loop);
0292 UV_EXTERN int uv_loop_close(uv_loop_t* loop);
0293
0294
0295
0296
0297
0298 UV_EXTERN uv_loop_t* uv_loop_new(void);
0299
0300
0301
0302
0303
0304 UV_EXTERN void uv_loop_delete(uv_loop_t*);
0305 UV_EXTERN size_t uv_loop_size(void);
0306 UV_EXTERN int uv_loop_alive(const uv_loop_t* loop);
0307 UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...);
0308 UV_EXTERN int uv_loop_fork(uv_loop_t* loop);
0309
0310 UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode);
0311 UV_EXTERN void uv_stop(uv_loop_t*);
0312
0313 UV_EXTERN void uv_ref(uv_handle_t*);
0314 UV_EXTERN void uv_unref(uv_handle_t*);
0315 UV_EXTERN int uv_has_ref(const uv_handle_t*);
0316
0317 UV_EXTERN void uv_update_time(uv_loop_t*);
0318 UV_EXTERN uint64_t uv_now(const uv_loop_t*);
0319
0320 UV_EXTERN int uv_backend_fd(const uv_loop_t*);
0321 UV_EXTERN int uv_backend_timeout(const uv_loop_t*);
0322
0323 typedef void (*uv_alloc_cb)(uv_handle_t* handle,
0324 size_t suggested_size,
0325 uv_buf_t* buf);
0326 typedef void (*uv_read_cb)(uv_stream_t* stream,
0327 ssize_t nread,
0328 const uv_buf_t* buf);
0329 typedef void (*uv_write_cb)(uv_write_t* req, int status);
0330 typedef void (*uv_connect_cb)(uv_connect_t* req, int status);
0331 typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status);
0332 typedef void (*uv_connection_cb)(uv_stream_t* server, int status);
0333 typedef void (*uv_close_cb)(uv_handle_t* handle);
0334 typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events);
0335 typedef void (*uv_timer_cb)(uv_timer_t* handle);
0336 typedef void (*uv_async_cb)(uv_async_t* handle);
0337 typedef void (*uv_prepare_cb)(uv_prepare_t* handle);
0338 typedef void (*uv_check_cb)(uv_check_t* handle);
0339 typedef void (*uv_idle_cb)(uv_idle_t* handle);
0340 typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal);
0341 typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg);
0342 typedef void (*uv_fs_cb)(uv_fs_t* req);
0343 typedef void (*uv_work_cb)(uv_work_t* req);
0344 typedef void (*uv_after_work_cb)(uv_work_t* req, int status);
0345 typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req,
0346 int status,
0347 struct addrinfo* res);
0348 typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req,
0349 int status,
0350 const char* hostname,
0351 const char* service);
0352 typedef void (*uv_random_cb)(uv_random_t* req,
0353 int status,
0354 void* buf,
0355 size_t buflen);
0356
0357 typedef enum {
0358 UV_CLOCK_MONOTONIC,
0359 UV_CLOCK_REALTIME
0360 } uv_clock_id;
0361
0362
0363 typedef struct {
0364 long tv_sec;
0365 long tv_nsec;
0366 } uv_timespec_t;
0367
0368 typedef struct {
0369 int64_t tv_sec;
0370 int32_t tv_nsec;
0371 } uv_timespec64_t;
0372
0373
0374 typedef struct {
0375 long tv_sec;
0376 long tv_usec;
0377 } uv_timeval_t;
0378
0379 typedef struct {
0380 int64_t tv_sec;
0381 int32_t tv_usec;
0382 } uv_timeval64_t;
0383
0384 typedef struct {
0385 uint64_t st_dev;
0386 uint64_t st_mode;
0387 uint64_t st_nlink;
0388 uint64_t st_uid;
0389 uint64_t st_gid;
0390 uint64_t st_rdev;
0391 uint64_t st_ino;
0392 uint64_t st_size;
0393 uint64_t st_blksize;
0394 uint64_t st_blocks;
0395 uint64_t st_flags;
0396 uint64_t st_gen;
0397 uv_timespec_t st_atim;
0398 uv_timespec_t st_mtim;
0399 uv_timespec_t st_ctim;
0400 uv_timespec_t st_birthtim;
0401 } uv_stat_t;
0402
0403
0404 typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle,
0405 const char* filename,
0406 int events,
0407 int status);
0408
0409 typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle,
0410 int status,
0411 const uv_stat_t* prev,
0412 const uv_stat_t* curr);
0413
0414 typedef void (*uv_signal_cb)(uv_signal_t* handle, int signum);
0415
0416
0417 typedef enum {
0418 UV_LEAVE_GROUP = 0,
0419 UV_JOIN_GROUP
0420 } uv_membership;
0421
0422
0423 UV_EXTERN int uv_translate_sys_error(int sys_errno);
0424
0425 UV_EXTERN const char* uv_strerror(int err);
0426 UV_EXTERN char* uv_strerror_r(int err, char* buf, size_t buflen);
0427
0428 UV_EXTERN const char* uv_err_name(int err);
0429 UV_EXTERN char* uv_err_name_r(int err, char* buf, size_t buflen);
0430
0431
0432 #define UV_REQ_FIELDS \
0433 \
0434 void* data; \
0435 \
0436 uv_req_type type; \
0437 \
0438 void* reserved[6]; \
0439 UV_REQ_PRIVATE_FIELDS \
0440
0441
0442 struct uv_req_s {
0443 UV_REQ_FIELDS
0444 };
0445
0446
0447
0448 UV_PRIVATE_REQ_TYPES
0449
0450
0451 UV_EXTERN int uv_shutdown(uv_shutdown_t* req,
0452 uv_stream_t* handle,
0453 uv_shutdown_cb cb);
0454
0455 struct uv_shutdown_s {
0456 UV_REQ_FIELDS
0457 uv_stream_t* handle;
0458 uv_shutdown_cb cb;
0459 UV_SHUTDOWN_PRIVATE_FIELDS
0460 };
0461
0462
0463 #define UV_HANDLE_FIELDS \
0464 \
0465 void* data; \
0466 \
0467 uv_loop_t* loop; \
0468 uv_handle_type type; \
0469 \
0470 uv_close_cb close_cb; \
0471 struct uv__queue handle_queue; \
0472 union { \
0473 int fd; \
0474 void* reserved[4]; \
0475 } u; \
0476 UV_HANDLE_PRIVATE_FIELDS \
0477
0478
0479 struct uv_handle_s {
0480 UV_HANDLE_FIELDS
0481 };
0482
0483 UV_EXTERN size_t uv_handle_size(uv_handle_type type);
0484 UV_EXTERN uv_handle_type uv_handle_get_type(const uv_handle_t* handle);
0485 UV_EXTERN const char* uv_handle_type_name(uv_handle_type type);
0486 UV_EXTERN void* uv_handle_get_data(const uv_handle_t* handle);
0487 UV_EXTERN uv_loop_t* uv_handle_get_loop(const uv_handle_t* handle);
0488 UV_EXTERN void uv_handle_set_data(uv_handle_t* handle, void* data);
0489
0490 UV_EXTERN size_t uv_req_size(uv_req_type type);
0491 UV_EXTERN void* uv_req_get_data(const uv_req_t* req);
0492 UV_EXTERN void uv_req_set_data(uv_req_t* req, void* data);
0493 UV_EXTERN uv_req_type uv_req_get_type(const uv_req_t* req);
0494 UV_EXTERN const char* uv_req_type_name(uv_req_type type);
0495
0496 UV_EXTERN int uv_is_active(const uv_handle_t* handle);
0497
0498 UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg);
0499
0500
0501 UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream);
0502 UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream);
0503
0504 UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
0505
0506 UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value);
0507 UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value);
0508
0509 UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd);
0510
0511 UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len);
0512
0513 UV_EXTERN int uv_pipe(uv_file fds[2], int read_flags, int write_flags);
0514 UV_EXTERN int uv_socketpair(int type,
0515 int protocol,
0516 uv_os_sock_t socket_vector[2],
0517 int flags0,
0518 int flags1);
0519
0520 #define UV_STREAM_FIELDS \
0521 \
0522 size_t write_queue_size; \
0523 uv_alloc_cb alloc_cb; \
0524 uv_read_cb read_cb; \
0525 \
0526 UV_STREAM_PRIVATE_FIELDS
0527
0528
0529
0530
0531
0532
0533
0534
0535 struct uv_stream_s {
0536 UV_HANDLE_FIELDS
0537 UV_STREAM_FIELDS
0538 };
0539
0540 UV_EXTERN size_t uv_stream_get_write_queue_size(const uv_stream_t* stream);
0541
0542 UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb);
0543 UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client);
0544
0545 UV_EXTERN int uv_read_start(uv_stream_t*,
0546 uv_alloc_cb alloc_cb,
0547 uv_read_cb read_cb);
0548 UV_EXTERN int uv_read_stop(uv_stream_t*);
0549
0550 UV_EXTERN int uv_write(uv_write_t* req,
0551 uv_stream_t* handle,
0552 const uv_buf_t bufs[],
0553 unsigned int nbufs,
0554 uv_write_cb cb);
0555 UV_EXTERN int uv_write2(uv_write_t* req,
0556 uv_stream_t* handle,
0557 const uv_buf_t bufs[],
0558 unsigned int nbufs,
0559 uv_stream_t* send_handle,
0560 uv_write_cb cb);
0561 UV_EXTERN int uv_try_write(uv_stream_t* handle,
0562 const uv_buf_t bufs[],
0563 unsigned int nbufs);
0564 UV_EXTERN int uv_try_write2(uv_stream_t* handle,
0565 const uv_buf_t bufs[],
0566 unsigned int nbufs,
0567 uv_stream_t* send_handle);
0568
0569
0570 struct uv_write_s {
0571 UV_REQ_FIELDS
0572 uv_write_cb cb;
0573 uv_stream_t* send_handle;
0574 uv_stream_t* handle;
0575 UV_WRITE_PRIVATE_FIELDS
0576 };
0577
0578
0579 UV_EXTERN int uv_is_readable(const uv_stream_t* handle);
0580 UV_EXTERN int uv_is_writable(const uv_stream_t* handle);
0581
0582 UV_EXTERN int uv_stream_set_blocking(uv_stream_t* handle, int blocking);
0583
0584 UV_EXTERN int uv_is_closing(const uv_handle_t* handle);
0585
0586
0587
0588
0589
0590
0591
0592 struct uv_tcp_s {
0593 UV_HANDLE_FIELDS
0594 UV_STREAM_FIELDS
0595 UV_TCP_PRIVATE_FIELDS
0596 };
0597
0598 UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle);
0599 UV_EXTERN int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags);
0600 UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock);
0601 UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable);
0602 UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle,
0603 int enable,
0604 unsigned int delay);
0605 UV_EXTERN int uv_tcp_keepalive_ex(uv_tcp_t* handle,
0606 int on,
0607 unsigned int idle,
0608 unsigned int intvl,
0609 unsigned int cnt);
0610 UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable);
0611
0612 enum uv_tcp_flags {
0613
0614 UV_TCP_IPV6ONLY = 1,
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625 UV_TCP_REUSEPORT = 2,
0626 };
0627
0628 UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle,
0629 const struct sockaddr* addr,
0630 unsigned int flags);
0631 UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle,
0632 struct sockaddr* name,
0633 int* namelen);
0634 UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle,
0635 struct sockaddr* name,
0636 int* namelen);
0637 UV_EXTERN int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb);
0638 UV_EXTERN int uv_tcp_connect(uv_connect_t* req,
0639 uv_tcp_t* handle,
0640 const struct sockaddr* addr,
0641 uv_connect_cb cb);
0642
0643
0644 struct uv_connect_s {
0645 UV_REQ_FIELDS
0646 uv_connect_cb cb;
0647 uv_stream_t* handle;
0648 UV_CONNECT_PRIVATE_FIELDS
0649 };
0650
0651
0652
0653
0654
0655
0656 enum uv_udp_flags {
0657
0658 UV_UDP_IPV6ONLY = 1,
0659
0660
0661
0662
0663 UV_UDP_PARTIAL = 2,
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673
0674
0675 UV_UDP_REUSEADDR = 4,
0676
0677
0678
0679
0680 UV_UDP_MMSG_CHUNK = 8,
0681
0682
0683
0684
0685
0686 UV_UDP_MMSG_FREE = 16,
0687
0688
0689
0690
0691
0692
0693
0694 UV_UDP_LINUX_RECVERR = 32,
0695
0696
0697
0698
0699
0700
0701
0702
0703
0704
0705
0706 UV_UDP_REUSEPORT = 64,
0707
0708
0709
0710 UV_UDP_RECVMMSG = 256
0711 };
0712
0713 typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status);
0714 typedef void (*uv_udp_recv_cb)(uv_udp_t* handle,
0715 ssize_t nread,
0716 const uv_buf_t* buf,
0717 const struct sockaddr* addr,
0718 unsigned flags);
0719
0720
0721 struct uv_udp_s {
0722 UV_HANDLE_FIELDS
0723
0724
0725
0726
0727
0728 size_t send_queue_size;
0729
0730
0731
0732 size_t send_queue_count;
0733 UV_UDP_PRIVATE_FIELDS
0734 };
0735
0736
0737 struct uv_udp_send_s {
0738 UV_REQ_FIELDS
0739 uv_udp_t* handle;
0740 uv_udp_send_cb cb;
0741 UV_UDP_SEND_PRIVATE_FIELDS
0742 };
0743
0744 UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
0745 UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags);
0746 UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock);
0747 UV_EXTERN int uv_udp_open_ex(uv_udp_t* handle,
0748 uv_os_sock_t sock,
0749 unsigned int flags);
0750 UV_EXTERN int uv_udp_bind(uv_udp_t* handle,
0751 const struct sockaddr* addr,
0752 unsigned int flags);
0753 UV_EXTERN int uv_udp_connect(uv_udp_t* handle, const struct sockaddr* addr);
0754
0755 UV_EXTERN int uv_udp_getpeername(const uv_udp_t* handle,
0756 struct sockaddr* name,
0757 int* namelen);
0758 UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle,
0759 struct sockaddr* name,
0760 int* namelen);
0761 UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
0762 const char* multicast_addr,
0763 const char* interface_addr,
0764 uv_membership membership);
0765 UV_EXTERN int uv_udp_set_source_membership(uv_udp_t* handle,
0766 const char* multicast_addr,
0767 const char* interface_addr,
0768 const char* source_addr,
0769 uv_membership membership);
0770 UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on);
0771 UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
0772 UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle,
0773 const char* interface_addr);
0774 UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on);
0775 UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl);
0776 UV_EXTERN int uv_udp_send(uv_udp_send_t* req,
0777 uv_udp_t* handle,
0778 const uv_buf_t bufs[],
0779 unsigned int nbufs,
0780 const struct sockaddr* addr,
0781 uv_udp_send_cb send_cb);
0782 UV_EXTERN int uv_udp_try_send(uv_udp_t* handle,
0783 const uv_buf_t bufs[],
0784 unsigned int nbufs,
0785 const struct sockaddr* addr);
0786 UV_EXTERN int uv_udp_try_send2(uv_udp_t* handle,
0787 unsigned int count,
0788 uv_buf_t* bufs[],
0789 unsigned int nbufs[],
0790 struct sockaddr* addrs[],
0791 unsigned int flags);
0792 UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle,
0793 uv_alloc_cb alloc_cb,
0794 uv_udp_recv_cb recv_cb);
0795 UV_EXTERN int uv_udp_using_recvmmsg(const uv_udp_t* handle);
0796 UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle);
0797 UV_EXTERN size_t uv_udp_get_send_queue_size(const uv_udp_t* handle);
0798 UV_EXTERN size_t uv_udp_get_send_queue_count(const uv_udp_t* handle);
0799
0800
0801
0802
0803
0804
0805
0806 struct uv_tty_s {
0807 UV_HANDLE_FIELDS
0808 UV_STREAM_FIELDS
0809 UV_TTY_PRIVATE_FIELDS
0810 };
0811
0812 typedef enum {
0813
0814 UV_TTY_MODE_NORMAL,
0815
0816
0817
0818
0819 UV_TTY_MODE_RAW,
0820
0821 UV_TTY_MODE_IO,
0822
0823 UV_TTY_MODE_RAW_VT
0824 } uv_tty_mode_t;
0825
0826 typedef enum {
0827
0828
0829
0830
0831 UV_TTY_SUPPORTED,
0832
0833
0834
0835 UV_TTY_UNSUPPORTED
0836 } uv_tty_vtermstate_t;
0837
0838
0839 UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable);
0840 UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode);
0841 UV_EXTERN int uv_tty_reset_mode(void);
0842 UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height);
0843 UV_EXTERN void uv_tty_set_vterm_state(uv_tty_vtermstate_t state);
0844 UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state);
0845
0846 #ifdef __cplusplus
0847 extern "C++" {
0848
0849 inline int uv_tty_set_mode(uv_tty_t* handle, int mode) {
0850 return uv_tty_set_mode(handle, static_cast<uv_tty_mode_t>(mode));
0851 }
0852
0853 }
0854 #endif
0855
0856 UV_EXTERN uv_handle_type uv_guess_handle(uv_file file);
0857
0858 enum {
0859 UV_PIPE_NO_TRUNCATE = 1u << 0
0860 };
0861
0862
0863
0864
0865
0866
0867
0868 struct uv_pipe_s {
0869 UV_HANDLE_FIELDS
0870 UV_STREAM_FIELDS
0871 int ipc;
0872 UV_PIPE_PRIVATE_FIELDS
0873 };
0874
0875 UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc);
0876 UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file);
0877 UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name);
0878 UV_EXTERN int uv_pipe_bind2(uv_pipe_t* handle,
0879 const char* name,
0880 size_t namelen,
0881 unsigned int flags);
0882 UV_EXTERN void uv_pipe_connect(uv_connect_t* req,
0883 uv_pipe_t* handle,
0884 const char* name,
0885 uv_connect_cb cb);
0886 UV_EXTERN int uv_pipe_connect2(uv_connect_t* req,
0887 uv_pipe_t* handle,
0888 const char* name,
0889 size_t namelen,
0890 unsigned int flags,
0891 uv_connect_cb cb);
0892 UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle,
0893 char* buffer,
0894 size_t* size);
0895 UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle,
0896 char* buffer,
0897 size_t* size);
0898 UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count);
0899 UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle);
0900 UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle);
0901 UV_EXTERN int uv_pipe_chmod(uv_pipe_t* handle, int flags);
0902
0903
0904 struct uv_poll_s {
0905 UV_HANDLE_FIELDS
0906 uv_poll_cb poll_cb;
0907 UV_POLL_PRIVATE_FIELDS
0908 };
0909
0910 enum uv_poll_event {
0911 UV_READABLE = 1,
0912 UV_WRITABLE = 2,
0913 UV_DISCONNECT = 4,
0914 UV_PRIORITIZED = 8
0915 };
0916
0917 UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd);
0918 UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop,
0919 uv_poll_t* handle,
0920 uv_os_sock_t socket);
0921 UV_EXTERN int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb);
0922 UV_EXTERN int uv_poll_stop(uv_poll_t* handle);
0923
0924
0925 struct uv_prepare_s {
0926 UV_HANDLE_FIELDS
0927 UV_PREPARE_PRIVATE_FIELDS
0928 };
0929
0930 UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare);
0931 UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb);
0932 UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare);
0933
0934
0935 struct uv_check_s {
0936 UV_HANDLE_FIELDS
0937 UV_CHECK_PRIVATE_FIELDS
0938 };
0939
0940 UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check);
0941 UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb);
0942 UV_EXTERN int uv_check_stop(uv_check_t* check);
0943
0944
0945 struct uv_idle_s {
0946 UV_HANDLE_FIELDS
0947 UV_IDLE_PRIVATE_FIELDS
0948 };
0949
0950 UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle);
0951 UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb);
0952 UV_EXTERN int uv_idle_stop(uv_idle_t* idle);
0953
0954
0955 struct uv_async_s {
0956 UV_HANDLE_FIELDS
0957 UV_ASYNC_PRIVATE_FIELDS
0958 };
0959
0960 UV_EXTERN int uv_async_init(uv_loop_t*,
0961 uv_async_t* async,
0962 uv_async_cb async_cb);
0963 UV_EXTERN int uv_async_send(uv_async_t* async);
0964
0965
0966
0967
0968
0969
0970
0971 struct uv_timer_s {
0972 UV_HANDLE_FIELDS
0973 UV_TIMER_PRIVATE_FIELDS
0974 };
0975
0976 UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle);
0977 UV_EXTERN int uv_timer_start(uv_timer_t* handle,
0978 uv_timer_cb cb,
0979 uint64_t timeout,
0980 uint64_t repeat);
0981 UV_EXTERN int uv_timer_stop(uv_timer_t* handle);
0982 UV_EXTERN int uv_timer_again(uv_timer_t* handle);
0983 UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat);
0984 UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle);
0985 UV_EXTERN uint64_t uv_timer_get_due_in(const uv_timer_t* handle);
0986
0987
0988
0989
0990
0991
0992
0993 struct uv_getaddrinfo_s {
0994 UV_REQ_FIELDS
0995
0996 uv_loop_t* loop;
0997
0998 UV_GETADDRINFO_PRIVATE_FIELDS
0999 };
1000
1001
1002 UV_EXTERN int uv_getaddrinfo(uv_loop_t* loop,
1003 uv_getaddrinfo_t* req,
1004 uv_getaddrinfo_cb getaddrinfo_cb,
1005 const char* node,
1006 const char* service,
1007 const struct addrinfo* hints);
1008 UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai);
1009
1010
1011
1012
1013
1014
1015
1016 struct uv_getnameinfo_s {
1017 UV_REQ_FIELDS
1018
1019 uv_loop_t* loop;
1020
1021 UV_GETNAMEINFO_PRIVATE_FIELDS
1022 };
1023
1024 UV_EXTERN int uv_getnameinfo(uv_loop_t* loop,
1025 uv_getnameinfo_t* req,
1026 uv_getnameinfo_cb getnameinfo_cb,
1027 const struct sockaddr* addr,
1028 int flags);
1029
1030
1031
1032 typedef enum {
1033 UV_IGNORE = 0x00,
1034 UV_CREATE_PIPE = 0x01,
1035 UV_INHERIT_FD = 0x02,
1036 UV_INHERIT_STREAM = 0x04,
1037
1038
1039
1040
1041
1042
1043 UV_READABLE_PIPE = 0x10,
1044 UV_WRITABLE_PIPE = 0x20,
1045
1046
1047
1048
1049
1050
1051
1052 UV_NONBLOCK_PIPE = 0x40,
1053 UV_OVERLAPPED_PIPE = 0x40
1054 } uv_stdio_flags;
1055
1056 typedef struct uv_stdio_container_s {
1057 uv_stdio_flags flags;
1058
1059 union {
1060 uv_stream_t* stream;
1061 int fd;
1062 } data;
1063 } uv_stdio_container_t;
1064
1065 typedef struct uv_process_options_s {
1066 uv_exit_cb exit_cb;
1067 const char* file;
1068
1069
1070
1071
1072
1073
1074 char** args;
1075
1076
1077
1078
1079 char** env;
1080
1081
1082
1083
1084 const char* cwd;
1085
1086
1087
1088
1089 unsigned int flags;
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099 int stdio_count;
1100 uv_stdio_container_t* stdio;
1101
1102
1103
1104
1105
1106 uv_uid_t uid;
1107 uv_gid_t gid;
1108 } uv_process_options_t;
1109
1110
1111
1112
1113 enum uv_process_flags {
1114
1115
1116
1117
1118
1119 UV_PROCESS_SETUID = (1 << 0),
1120
1121
1122
1123
1124
1125 UV_PROCESS_SETGID = (1 << 1),
1126
1127
1128
1129
1130
1131 UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2),
1132
1133
1134
1135
1136
1137
1138
1139 UV_PROCESS_DETACHED = (1 << 3),
1140
1141
1142
1143
1144 UV_PROCESS_WINDOWS_HIDE = (1 << 4),
1145
1146
1147
1148
1149
1150 UV_PROCESS_WINDOWS_HIDE_CONSOLE = (1 << 5),
1151
1152
1153
1154
1155
1156 UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6),
1157
1158
1159
1160
1161
1162
1163 UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME = (1 << 7)
1164 };
1165
1166
1167
1168
1169 struct uv_process_s {
1170 UV_HANDLE_FIELDS
1171 uv_exit_cb exit_cb;
1172 int pid;
1173 UV_PROCESS_PRIVATE_FIELDS
1174 };
1175
1176 UV_EXTERN int uv_spawn(uv_loop_t* loop,
1177 uv_process_t* handle,
1178 const uv_process_options_t* options);
1179 UV_EXTERN int uv_process_kill(uv_process_t*, int signum);
1180 UV_EXTERN int uv_kill(int pid, int signum);
1181 UV_EXTERN uv_pid_t uv_process_get_pid(const uv_process_t*);
1182
1183
1184
1185
1186
1187 struct uv_work_s {
1188 UV_REQ_FIELDS
1189 uv_loop_t* loop;
1190 uv_work_cb work_cb;
1191 uv_after_work_cb after_work_cb;
1192 UV_WORK_PRIVATE_FIELDS
1193 };
1194
1195 UV_EXTERN int uv_queue_work(uv_loop_t* loop,
1196 uv_work_t* req,
1197 uv_work_cb work_cb,
1198 uv_after_work_cb after_work_cb);
1199
1200 UV_EXTERN int uv_cancel(uv_req_t* req);
1201
1202
1203 struct uv_cpu_times_s {
1204 uint64_t user;
1205 uint64_t nice;
1206 uint64_t sys;
1207 uint64_t idle;
1208 uint64_t irq;
1209 };
1210
1211 struct uv_cpu_info_s {
1212 const char* model;
1213 int speed;
1214 struct uv_cpu_times_s cpu_times;
1215 };
1216
1217 struct uv_interface_address_s {
1218 char* name;
1219 char phys_addr[6];
1220 int is_internal;
1221 union {
1222 struct sockaddr_in address4;
1223 struct sockaddr_in6 address6;
1224 } address;
1225 union {
1226 struct sockaddr_in netmask4;
1227 struct sockaddr_in6 netmask6;
1228 } netmask;
1229 };
1230
1231 struct uv_passwd_s {
1232 char* username;
1233 unsigned long uid;
1234 unsigned long gid;
1235 char* shell;
1236 char* homedir;
1237 };
1238
1239 struct uv_group_s {
1240 char* groupname;
1241 unsigned long gid;
1242 char** members;
1243 };
1244
1245 struct uv_utsname_s {
1246 char sysname[256];
1247 char release[256];
1248 char version[256];
1249 char machine[256];
1250
1251
1252
1253 };
1254
1255 struct uv_statfs_s {
1256 uint64_t f_type;
1257 uint64_t f_bsize;
1258 uint64_t f_blocks;
1259 uint64_t f_bfree;
1260 uint64_t f_bavail;
1261 uint64_t f_files;
1262 uint64_t f_ffree;
1263 uint64_t f_frsize;
1264 uint64_t f_spare[3];
1265 };
1266
1267 typedef enum {
1268 UV_DIRENT_UNKNOWN,
1269 UV_DIRENT_FILE,
1270 UV_DIRENT_DIR,
1271 UV_DIRENT_LINK,
1272 UV_DIRENT_FIFO,
1273 UV_DIRENT_SOCKET,
1274 UV_DIRENT_CHAR,
1275 UV_DIRENT_BLOCK
1276 } uv_dirent_type_t;
1277
1278 struct uv_dirent_s {
1279 const char* name;
1280 uv_dirent_type_t type;
1281 };
1282
1283 UV_EXTERN char** uv_setup_args(int argc, char** argv);
1284 UV_EXTERN int uv_get_process_title(char* buffer, size_t size);
1285 UV_EXTERN int uv_set_process_title(const char* title);
1286 UV_EXTERN int uv_resident_set_memory(size_t* rss);
1287 UV_EXTERN int uv_uptime(double* uptime);
1288 UV_EXTERN uv_os_fd_t uv_get_osfhandle(int fd);
1289 UV_EXTERN int uv_open_osfhandle(uv_os_fd_t os_fd);
1290
1291 typedef struct {
1292 uv_timeval_t ru_utime;
1293 uv_timeval_t ru_stime;
1294 uint64_t ru_maxrss;
1295 uint64_t ru_ixrss;
1296 uint64_t ru_idrss;
1297 uint64_t ru_isrss;
1298 uint64_t ru_minflt;
1299 uint64_t ru_majflt;
1300 uint64_t ru_nswap;
1301 uint64_t ru_inblock;
1302 uint64_t ru_oublock;
1303 uint64_t ru_msgsnd;
1304 uint64_t ru_msgrcv;
1305 uint64_t ru_nsignals;
1306 uint64_t ru_nvcsw;
1307 uint64_t ru_nivcsw;
1308 } uv_rusage_t;
1309
1310 UV_EXTERN int uv_getrusage(uv_rusage_t* rusage);
1311 UV_EXTERN int uv_getrusage_thread(uv_rusage_t* rusage);
1312
1313 UV_EXTERN int uv_os_homedir(char* buffer, size_t* size);
1314 UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size);
1315 UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd);
1316 UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd);
1317 UV_EXTERN int uv_os_get_passwd2(uv_passwd_t* pwd, uv_uid_t uid);
1318 UV_EXTERN int uv_os_get_group(uv_group_t* grp, uv_uid_t gid);
1319 UV_EXTERN void uv_os_free_group(uv_group_t* grp);
1320 UV_EXTERN uv_pid_t uv_os_getpid(void);
1321 UV_EXTERN uv_pid_t uv_os_getppid(void);
1322
1323 #if defined(__PASE__)
1324
1325 # define UV_PRIORITY_LOW 39
1326 # define UV_PRIORITY_BELOW_NORMAL 15
1327 # define UV_PRIORITY_NORMAL 0
1328 # define UV_PRIORITY_ABOVE_NORMAL -4
1329 # define UV_PRIORITY_HIGH -7
1330 # define UV_PRIORITY_HIGHEST -10
1331 #else
1332 # define UV_PRIORITY_LOW 19
1333 # define UV_PRIORITY_BELOW_NORMAL 10
1334 # define UV_PRIORITY_NORMAL 0
1335 # define UV_PRIORITY_ABOVE_NORMAL -7
1336 # define UV_PRIORITY_HIGH -14
1337 # define UV_PRIORITY_HIGHEST -20
1338 #endif
1339
1340 UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority);
1341 UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority);
1342
1343 enum {
1344 UV_THREAD_PRIORITY_HIGHEST = 2,
1345 UV_THREAD_PRIORITY_ABOVE_NORMAL = 1,
1346 UV_THREAD_PRIORITY_NORMAL = 0,
1347 UV_THREAD_PRIORITY_BELOW_NORMAL = -1,
1348 UV_THREAD_PRIORITY_LOWEST = -2,
1349 };
1350
1351 UV_EXTERN int uv_thread_getpriority(uv_thread_t tid, int* priority);
1352 UV_EXTERN int uv_thread_setpriority(uv_thread_t tid, int priority);
1353
1354 UV_EXTERN unsigned int uv_available_parallelism(void);
1355 UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
1356 UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);
1357 UV_EXTERN int uv_cpumask_size(void);
1358
1359 UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses,
1360 int* count);
1361 UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses,
1362 int count);
1363
1364 struct uv_env_item_s {
1365 char* name;
1366 char* value;
1367 };
1368
1369 UV_EXTERN int uv_os_environ(uv_env_item_t** envitems, int* count);
1370 UV_EXTERN void uv_os_free_environ(uv_env_item_t* envitems, int count);
1371 UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size);
1372 UV_EXTERN int uv_os_setenv(const char* name, const char* value);
1373 UV_EXTERN int uv_os_unsetenv(const char* name);
1374
1375 #ifdef MAXHOSTNAMELEN
1376 # define UV_MAXHOSTNAMESIZE (MAXHOSTNAMELEN + 1)
1377 #else
1378
1379
1380
1381
1382
1383 # define UV_MAXHOSTNAMESIZE 256
1384 #endif
1385
1386 UV_EXTERN int uv_os_gethostname(char* buffer, size_t* size);
1387
1388 UV_EXTERN int uv_os_uname(uv_utsname_t* buffer);
1389
1390 struct uv_metrics_s {
1391 uint64_t loop_count;
1392 uint64_t events;
1393 uint64_t events_waiting;
1394
1395 uint64_t* reserved[13];
1396 };
1397
1398 UV_EXTERN int uv_metrics_info(uv_loop_t* loop, uv_metrics_t* metrics);
1399 UV_EXTERN uint64_t uv_metrics_idle_time(uv_loop_t* loop);
1400
1401 typedef enum {
1402 UV_FS_UNKNOWN = -1,
1403 UV_FS_CUSTOM,
1404 UV_FS_OPEN,
1405 UV_FS_CLOSE,
1406 UV_FS_READ,
1407 UV_FS_WRITE,
1408 UV_FS_SENDFILE,
1409 UV_FS_STAT,
1410 UV_FS_LSTAT,
1411 UV_FS_FSTAT,
1412 UV_FS_FTRUNCATE,
1413 UV_FS_UTIME,
1414 UV_FS_FUTIME,
1415 UV_FS_ACCESS,
1416 UV_FS_CHMOD,
1417 UV_FS_FCHMOD,
1418 UV_FS_FSYNC,
1419 UV_FS_FDATASYNC,
1420 UV_FS_UNLINK,
1421 UV_FS_RMDIR,
1422 UV_FS_MKDIR,
1423 UV_FS_MKDTEMP,
1424 UV_FS_RENAME,
1425 UV_FS_SCANDIR,
1426 UV_FS_LINK,
1427 UV_FS_SYMLINK,
1428 UV_FS_READLINK,
1429 UV_FS_CHOWN,
1430 UV_FS_FCHOWN,
1431 UV_FS_REALPATH,
1432 UV_FS_COPYFILE,
1433 UV_FS_LCHOWN,
1434 UV_FS_OPENDIR,
1435 UV_FS_READDIR,
1436 UV_FS_CLOSEDIR,
1437 UV_FS_STATFS,
1438 UV_FS_MKSTEMP,
1439 UV_FS_LUTIME
1440 } uv_fs_type;
1441
1442 struct uv_dir_s {
1443 uv_dirent_t* dirents;
1444 size_t nentries;
1445 void* reserved[4];
1446 UV_DIR_PRIVATE_FIELDS
1447 };
1448
1449
1450 struct uv_fs_s {
1451 UV_REQ_FIELDS
1452 uv_fs_type fs_type;
1453 uv_loop_t* loop;
1454 uv_fs_cb cb;
1455 ssize_t result;
1456 void* ptr;
1457 const char* path;
1458 uv_stat_t statbuf;
1459 UV_FS_PRIVATE_FIELDS
1460 };
1461
1462 UV_EXTERN uv_fs_type uv_fs_get_type(const uv_fs_t*);
1463 UV_EXTERN ssize_t uv_fs_get_result(const uv_fs_t*);
1464 UV_EXTERN int uv_fs_get_system_error(const uv_fs_t*);
1465 UV_EXTERN void* uv_fs_get_ptr(const uv_fs_t*);
1466 UV_EXTERN const char* uv_fs_get_path(const uv_fs_t*);
1467 UV_EXTERN uv_stat_t* uv_fs_get_statbuf(uv_fs_t*);
1468
1469 UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req);
1470 UV_EXTERN int uv_fs_close(uv_loop_t* loop,
1471 uv_fs_t* req,
1472 uv_file file,
1473 uv_fs_cb cb);
1474 UV_EXTERN int uv_fs_open(uv_loop_t* loop,
1475 uv_fs_t* req,
1476 const char* path,
1477 int flags,
1478 int mode,
1479 uv_fs_cb cb);
1480 UV_EXTERN int uv_fs_read(uv_loop_t* loop,
1481 uv_fs_t* req,
1482 uv_file file,
1483 const uv_buf_t bufs[],
1484 unsigned int nbufs,
1485 int64_t offset,
1486 uv_fs_cb cb);
1487 UV_EXTERN int uv_fs_unlink(uv_loop_t* loop,
1488 uv_fs_t* req,
1489 const char* path,
1490 uv_fs_cb cb);
1491 UV_EXTERN int uv_fs_write(uv_loop_t* loop,
1492 uv_fs_t* req,
1493 uv_file file,
1494 const uv_buf_t bufs[],
1495 unsigned int nbufs,
1496 int64_t offset,
1497 uv_fs_cb cb);
1498
1499
1500
1501
1502 #define UV_FS_COPYFILE_EXCL 0x0001
1503
1504
1505
1506
1507
1508 #define UV_FS_COPYFILE_FICLONE 0x0002
1509
1510
1511
1512
1513
1514 #define UV_FS_COPYFILE_FICLONE_FORCE 0x0004
1515
1516 UV_EXTERN int uv_fs_copyfile(uv_loop_t* loop,
1517 uv_fs_t* req,
1518 const char* path,
1519 const char* new_path,
1520 int flags,
1521 uv_fs_cb cb);
1522 UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop,
1523 uv_fs_t* req,
1524 const char* path,
1525 int mode,
1526 uv_fs_cb cb);
1527 UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop,
1528 uv_fs_t* req,
1529 const char* tpl,
1530 uv_fs_cb cb);
1531 UV_EXTERN int uv_fs_mkstemp(uv_loop_t* loop,
1532 uv_fs_t* req,
1533 const char* tpl,
1534 uv_fs_cb cb);
1535 UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop,
1536 uv_fs_t* req,
1537 const char* path,
1538 uv_fs_cb cb);
1539 UV_EXTERN int uv_fs_scandir(uv_loop_t* loop,
1540 uv_fs_t* req,
1541 const char* path,
1542 int flags,
1543 uv_fs_cb cb);
1544 UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req,
1545 uv_dirent_t* ent);
1546 UV_EXTERN int uv_fs_opendir(uv_loop_t* loop,
1547 uv_fs_t* req,
1548 const char* path,
1549 uv_fs_cb cb);
1550 UV_EXTERN int uv_fs_readdir(uv_loop_t* loop,
1551 uv_fs_t* req,
1552 uv_dir_t* dir,
1553 uv_fs_cb cb);
1554 UV_EXTERN int uv_fs_closedir(uv_loop_t* loop,
1555 uv_fs_t* req,
1556 uv_dir_t* dir,
1557 uv_fs_cb cb);
1558 UV_EXTERN int uv_fs_stat(uv_loop_t* loop,
1559 uv_fs_t* req,
1560 const char* path,
1561 uv_fs_cb cb);
1562 UV_EXTERN int uv_fs_fstat(uv_loop_t* loop,
1563 uv_fs_t* req,
1564 uv_file file,
1565 uv_fs_cb cb);
1566 UV_EXTERN int uv_fs_rename(uv_loop_t* loop,
1567 uv_fs_t* req,
1568 const char* path,
1569 const char* new_path,
1570 uv_fs_cb cb);
1571 UV_EXTERN int uv_fs_fsync(uv_loop_t* loop,
1572 uv_fs_t* req,
1573 uv_file file,
1574 uv_fs_cb cb);
1575 UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop,
1576 uv_fs_t* req,
1577 uv_file file,
1578 uv_fs_cb cb);
1579 UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop,
1580 uv_fs_t* req,
1581 uv_file file,
1582 int64_t offset,
1583 uv_fs_cb cb);
1584 UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop,
1585 uv_fs_t* req,
1586 uv_file out_fd,
1587 uv_file in_fd,
1588 int64_t in_offset,
1589 size_t length,
1590 uv_fs_cb cb);
1591 UV_EXTERN int uv_fs_access(uv_loop_t* loop,
1592 uv_fs_t* req,
1593 const char* path,
1594 int mode,
1595 uv_fs_cb cb);
1596 UV_EXTERN int uv_fs_chmod(uv_loop_t* loop,
1597 uv_fs_t* req,
1598 const char* path,
1599 int mode,
1600 uv_fs_cb cb);
1601 #define UV_FS_UTIME_NOW (INFINITY)
1602 #define UV_FS_UTIME_OMIT (NAN)
1603 UV_EXTERN int uv_fs_utime(uv_loop_t* loop,
1604 uv_fs_t* req,
1605 const char* path,
1606 double atime,
1607 double mtime,
1608 uv_fs_cb cb);
1609 UV_EXTERN int uv_fs_futime(uv_loop_t* loop,
1610 uv_fs_t* req,
1611 uv_file file,
1612 double atime,
1613 double mtime,
1614 uv_fs_cb cb);
1615 UV_EXTERN int uv_fs_lutime(uv_loop_t* loop,
1616 uv_fs_t* req,
1617 const char* path,
1618 double atime,
1619 double mtime,
1620 uv_fs_cb cb);
1621 UV_EXTERN int uv_fs_lstat(uv_loop_t* loop,
1622 uv_fs_t* req,
1623 const char* path,
1624 uv_fs_cb cb);
1625 UV_EXTERN int uv_fs_link(uv_loop_t* loop,
1626 uv_fs_t* req,
1627 const char* path,
1628 const char* new_path,
1629 uv_fs_cb cb);
1630
1631
1632
1633
1634
1635 #define UV_FS_SYMLINK_DIR 0x0001
1636
1637
1638
1639
1640
1641 #define UV_FS_SYMLINK_JUNCTION 0x0002
1642
1643 UV_EXTERN int uv_fs_symlink(uv_loop_t* loop,
1644 uv_fs_t* req,
1645 const char* path,
1646 const char* new_path,
1647 int flags,
1648 uv_fs_cb cb);
1649 UV_EXTERN int uv_fs_readlink(uv_loop_t* loop,
1650 uv_fs_t* req,
1651 const char* path,
1652 uv_fs_cb cb);
1653 UV_EXTERN int uv_fs_realpath(uv_loop_t* loop,
1654 uv_fs_t* req,
1655 const char* path,
1656 uv_fs_cb cb);
1657 UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop,
1658 uv_fs_t* req,
1659 uv_file file,
1660 int mode,
1661 uv_fs_cb cb);
1662 UV_EXTERN int uv_fs_chown(uv_loop_t* loop,
1663 uv_fs_t* req,
1664 const char* path,
1665 uv_uid_t uid,
1666 uv_gid_t gid,
1667 uv_fs_cb cb);
1668 UV_EXTERN int uv_fs_fchown(uv_loop_t* loop,
1669 uv_fs_t* req,
1670 uv_file file,
1671 uv_uid_t uid,
1672 uv_gid_t gid,
1673 uv_fs_cb cb);
1674 UV_EXTERN int uv_fs_lchown(uv_loop_t* loop,
1675 uv_fs_t* req,
1676 const char* path,
1677 uv_uid_t uid,
1678 uv_gid_t gid,
1679 uv_fs_cb cb);
1680 UV_EXTERN int uv_fs_statfs(uv_loop_t* loop,
1681 uv_fs_t* req,
1682 const char* path,
1683 uv_fs_cb cb);
1684
1685
1686 enum uv_fs_event {
1687 UV_RENAME = 1,
1688 UV_CHANGE = 2
1689 };
1690
1691
1692 struct uv_fs_event_s {
1693 UV_HANDLE_FIELDS
1694
1695 char* path;
1696 UV_FS_EVENT_PRIVATE_FIELDS
1697 };
1698
1699
1700
1701
1702
1703 struct uv_fs_poll_s {
1704 UV_HANDLE_FIELDS
1705
1706 void* poll_ctx;
1707 };
1708
1709 UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle);
1710 UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle,
1711 uv_fs_poll_cb poll_cb,
1712 const char* path,
1713 unsigned int interval);
1714 UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle);
1715 UV_EXTERN int uv_fs_poll_getpath(uv_fs_poll_t* handle,
1716 char* buffer,
1717 size_t* size);
1718
1719
1720 struct uv_signal_s {
1721 UV_HANDLE_FIELDS
1722 uv_signal_cb signal_cb;
1723 int signum;
1724 UV_SIGNAL_PRIVATE_FIELDS
1725 };
1726
1727 UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle);
1728 UV_EXTERN int uv_signal_start(uv_signal_t* handle,
1729 uv_signal_cb signal_cb,
1730 int signum);
1731 UV_EXTERN int uv_signal_start_oneshot(uv_signal_t* handle,
1732 uv_signal_cb signal_cb,
1733 int signum);
1734 UV_EXTERN int uv_signal_stop(uv_signal_t* handle);
1735
1736 UV_EXTERN void uv_loadavg(double avg[3]);
1737
1738
1739
1740
1741
1742 enum uv_fs_event_flags {
1743
1744
1745
1746
1747
1748
1749
1750 UV_FS_EVENT_WATCH_ENTRY = 1,
1751
1752
1753
1754
1755
1756
1757
1758
1759 UV_FS_EVENT_STAT = 2,
1760
1761
1762
1763
1764
1765
1766 UV_FS_EVENT_RECURSIVE = 4
1767 };
1768
1769
1770 UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle);
1771 UV_EXTERN int uv_fs_event_start(uv_fs_event_t* handle,
1772 uv_fs_event_cb cb,
1773 const char* path,
1774 unsigned int flags);
1775 UV_EXTERN int uv_fs_event_stop(uv_fs_event_t* handle);
1776 UV_EXTERN int uv_fs_event_getpath(uv_fs_event_t* handle,
1777 char* buffer,
1778 size_t* size);
1779
1780 UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr);
1781 UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr);
1782
1783 UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size);
1784 UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size);
1785 UV_EXTERN int uv_ip_name(const struct sockaddr* src, char* dst, size_t size);
1786
1787 UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size);
1788 UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst);
1789
1790
1791 struct uv_random_s {
1792 UV_REQ_FIELDS
1793
1794 uv_loop_t* loop;
1795
1796 int status;
1797 void* buf;
1798 size_t buflen;
1799 uv_random_cb cb;
1800 struct uv__work work_req;
1801 };
1802
1803 UV_EXTERN int uv_random(uv_loop_t* loop,
1804 uv_random_t* req,
1805 void *buf,
1806 size_t buflen,
1807 unsigned flags,
1808 uv_random_cb cb);
1809
1810 #if defined(IF_NAMESIZE)
1811 # define UV_IF_NAMESIZE (IF_NAMESIZE + 1)
1812 #elif defined(IFNAMSIZ)
1813 # define UV_IF_NAMESIZE (IFNAMSIZ + 1)
1814 #else
1815 # define UV_IF_NAMESIZE (16 + 1)
1816 #endif
1817
1818 UV_EXTERN int uv_if_indextoname(unsigned int ifindex,
1819 char* buffer,
1820 size_t* size);
1821 UV_EXTERN int uv_if_indextoiid(unsigned int ifindex,
1822 char* buffer,
1823 size_t* size);
1824
1825 UV_EXTERN int uv_exepath(char* buffer, size_t* size);
1826
1827 UV_EXTERN int uv_cwd(char* buffer, size_t* size);
1828
1829 UV_EXTERN int uv_chdir(const char* dir);
1830
1831 UV_EXTERN uint64_t uv_get_free_memory(void);
1832 UV_EXTERN uint64_t uv_get_total_memory(void);
1833 UV_EXTERN uint64_t uv_get_constrained_memory(void);
1834 UV_EXTERN uint64_t uv_get_available_memory(void);
1835
1836 UV_EXTERN int uv_clock_gettime(uv_clock_id clock_id, uv_timespec64_t* ts);
1837 UV_EXTERN uint64_t uv_hrtime(void);
1838 UV_EXTERN void uv_sleep(unsigned int msec);
1839
1840 UV_EXTERN void uv_disable_stdio_inheritance(void);
1841
1842 UV_EXTERN int uv_dlopen(const char* filename, uv_lib_t* lib);
1843 UV_EXTERN void uv_dlclose(uv_lib_t* lib);
1844 UV_EXTERN int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr);
1845 UV_EXTERN const char* uv_dlerror(const uv_lib_t* lib);
1846
1847 UV_EXTERN int uv_mutex_init(uv_mutex_t* handle);
1848 UV_EXTERN int uv_mutex_init_recursive(uv_mutex_t* handle);
1849 UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle);
1850 UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle);
1851 UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle);
1852 UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle);
1853
1854 UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock);
1855 UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock);
1856 UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock);
1857 UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock);
1858 UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock);
1859 UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock);
1860 UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock);
1861 UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock);
1862
1863 UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value);
1864 UV_EXTERN void uv_sem_destroy(uv_sem_t* sem);
1865 UV_EXTERN void uv_sem_post(uv_sem_t* sem);
1866 UV_EXTERN void uv_sem_wait(uv_sem_t* sem);
1867 UV_EXTERN int uv_sem_trywait(uv_sem_t* sem);
1868
1869 UV_EXTERN int uv_cond_init(uv_cond_t* cond);
1870 UV_EXTERN void uv_cond_destroy(uv_cond_t* cond);
1871 UV_EXTERN void uv_cond_signal(uv_cond_t* cond);
1872 UV_EXTERN void uv_cond_broadcast(uv_cond_t* cond);
1873
1874 UV_EXTERN int uv_barrier_init(uv_barrier_t* barrier, unsigned int count);
1875 UV_EXTERN void uv_barrier_destroy(uv_barrier_t* barrier);
1876 UV_EXTERN int uv_barrier_wait(uv_barrier_t* barrier);
1877
1878 UV_EXTERN void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex);
1879 UV_EXTERN int uv_cond_timedwait(uv_cond_t* cond,
1880 uv_mutex_t* mutex,
1881 uint64_t timeout);
1882
1883 UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void));
1884
1885 UV_EXTERN int uv_key_create(uv_key_t* key);
1886 UV_EXTERN void uv_key_delete(uv_key_t* key);
1887 UV_EXTERN void* uv_key_get(uv_key_t* key);
1888 UV_EXTERN void uv_key_set(uv_key_t* key, void* value);
1889
1890 UV_EXTERN int uv_gettimeofday(uv_timeval64_t* tv);
1891
1892 typedef void (*uv_thread_cb)(void* arg);
1893
1894 UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg);
1895 UV_EXTERN int uv_thread_detach(uv_thread_t* tid);
1896
1897 typedef enum {
1898 UV_THREAD_NO_FLAGS = 0x00,
1899 UV_THREAD_HAS_STACK_SIZE = 0x01
1900 } uv_thread_create_flags;
1901
1902 struct uv_thread_options_s {
1903 unsigned int flags;
1904 size_t stack_size;
1905
1906 };
1907
1908 typedef struct uv_thread_options_s uv_thread_options_t;
1909
1910 UV_EXTERN int uv_thread_create_ex(uv_thread_t* tid,
1911 const uv_thread_options_t* params,
1912 uv_thread_cb entry,
1913 void* arg);
1914 UV_EXTERN int uv_thread_setaffinity(uv_thread_t* tid,
1915 char* cpumask,
1916 char* oldmask,
1917 size_t mask_size);
1918 UV_EXTERN int uv_thread_getaffinity(uv_thread_t* tid,
1919 char* cpumask,
1920 size_t mask_size);
1921 UV_EXTERN int uv_thread_getcpu(void);
1922 UV_EXTERN uv_thread_t uv_thread_self(void);
1923 UV_EXTERN int uv_thread_join(uv_thread_t *tid);
1924 UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2);
1925 UV_EXTERN int uv_thread_setname(const char* name);
1926 UV_EXTERN int uv_thread_getname(uv_thread_t* tid, char* name, size_t size);
1927
1928
1929
1930 #define XX(_, name) uv_ ## name ## _t name;
1931 union uv_any_handle {
1932 UV_HANDLE_TYPE_MAP(XX)
1933 };
1934
1935 union uv_any_req {
1936 UV_REQ_TYPE_MAP(XX)
1937 };
1938 #undef XX
1939
1940
1941 struct uv_loop_s {
1942
1943 void* data;
1944
1945 unsigned int active_handles;
1946 struct uv__queue handle_queue;
1947 union {
1948 void* unused;
1949 unsigned int count;
1950 } active_reqs;
1951
1952 void* internal_fields;
1953
1954 unsigned int stop_flag;
1955 UV_LOOP_PRIVATE_FIELDS
1956 };
1957
1958 UV_EXTERN void* uv_loop_get_data(const uv_loop_t*);
1959 UV_EXTERN void uv_loop_set_data(uv_loop_t*, void* data);
1960
1961
1962 UV_EXTERN size_t uv_utf16_length_as_wtf8(const uint16_t* utf16,
1963 ssize_t utf16_len);
1964 UV_EXTERN int uv_utf16_to_wtf8(const uint16_t* utf16,
1965 ssize_t utf16_len,
1966 char** wtf8_ptr,
1967 size_t* wtf8_len_ptr);
1968 UV_EXTERN ssize_t uv_wtf8_length_as_utf16(const char* wtf8);
1969 UV_EXTERN void uv_wtf8_to_utf16(const char* wtf8,
1970 uint16_t* utf16,
1971 size_t utf16_len);
1972
1973
1974 #undef UV_REQ_TYPE_PRIVATE
1975 #undef UV_REQ_PRIVATE_FIELDS
1976 #undef UV_STREAM_PRIVATE_FIELDS
1977 #undef UV_TCP_PRIVATE_FIELDS
1978 #undef UV_PREPARE_PRIVATE_FIELDS
1979 #undef UV_CHECK_PRIVATE_FIELDS
1980 #undef UV_IDLE_PRIVATE_FIELDS
1981 #undef UV_ASYNC_PRIVATE_FIELDS
1982 #undef UV_TIMER_PRIVATE_FIELDS
1983 #undef UV_GETADDRINFO_PRIVATE_FIELDS
1984 #undef UV_GETNAMEINFO_PRIVATE_FIELDS
1985 #undef UV_WORK_PRIVATE_FIELDS
1986 #undef UV_FS_EVENT_PRIVATE_FIELDS
1987 #undef UV_SIGNAL_PRIVATE_FIELDS
1988 #undef UV_LOOP_PRIVATE_FIELDS
1989 #undef UV__ERR
1990
1991 #ifdef __cplusplus
1992 }
1993 #endif
1994 #endif