34 #if defined(_MSC_VER) && _MSC_VER < 1600
46 # define UV__ERR(x) (-(x))
48 # define UV__ERR(x) (x)
51 #if !defined(snprintf) && defined(_MSC_VER) && _MSC_VER < 1900
52 extern int snprintf(
char*,
size_t,
const char*, ...);
55 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
57 #define container_of(ptr, type, member) \
58 ((type *) ((char *) (ptr) - offsetof(type, member)))
60 #define STATIC_ASSERT(expr) \
61 void uv__static_assert(int static_assert_failed[1 - 2 * !(expr)])
63 #if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 7)
64 #define uv__load_relaxed(p) __atomic_load_n(p, __ATOMIC_RELAXED)
65 #define uv__store_relaxed(p, v) __atomic_store_n(p, v, __ATOMIC_RELAXED)
67 #define uv__load_relaxed(p) (*p)
68 #define uv__store_relaxed(p, v) do *p = v; while (0)
221 #define uv__has_active_reqs(loop) \
222 ((loop)->active_reqs.count > 0)
224 #define uv__req_register(loop, req) \
226 (loop)->active_reqs.count++; \
230 #define uv__req_unregister(loop, req) \
232 assert(uv__has_active_reqs(loop)); \
233 (loop)->active_reqs.count--; \
237 #define uv__has_active_handles(loop) \
238 ((loop)->active_handles > 0)
240 #define uv__active_handle_add(h) \
242 (h)->loop->active_handles++; \
246 #define uv__active_handle_rm(h) \
248 (h)->loop->active_handles--; \
252 #define uv__is_active(h) \
253 (((h)->flags & UV_HANDLE_ACTIVE) != 0)
255 #define uv__is_closing(h) \
256 (((h)->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED)) != 0)
258 #define uv__handle_start(h) \
260 if (((h)->flags & UV_HANDLE_ACTIVE) != 0) break; \
261 (h)->flags |= UV_HANDLE_ACTIVE; \
262 if (((h)->flags & UV_HANDLE_REF) != 0) uv__active_handle_add(h); \
266 #define uv__handle_stop(h) \
268 if (((h)->flags & UV_HANDLE_ACTIVE) == 0) break; \
269 (h)->flags &= ~UV_HANDLE_ACTIVE; \
270 if (((h)->flags & UV_HANDLE_REF) != 0) uv__active_handle_rm(h); \
274 #define uv__handle_ref(h) \
276 if (((h)->flags & UV_HANDLE_REF) != 0) break; \
277 (h)->flags |= UV_HANDLE_REF; \
278 if (((h)->flags & UV_HANDLE_CLOSING) != 0) break; \
279 if (((h)->flags & UV_HANDLE_ACTIVE) != 0) uv__active_handle_add(h); \
283 #define uv__handle_unref(h) \
285 if (((h)->flags & UV_HANDLE_REF) == 0) break; \
286 (h)->flags &= ~UV_HANDLE_REF; \
287 if (((h)->flags & UV_HANDLE_CLOSING) != 0) break; \
288 if (((h)->flags & UV_HANDLE_ACTIVE) != 0) uv__active_handle_rm(h); \
292 #define uv__has_ref(h) \
293 (((h)->flags & UV_HANDLE_REF) != 0)
296 # define uv__handle_platform_init(h) ((h)->u.fd = -1)
298 # define uv__handle_platform_init(h) ((h)->next_closing = NULL)
301 #define uv__handle_init(loop_, h, type_) \
303 (h)->loop = (loop_); \
304 (h)->type = (type_); \
305 (h)->flags = UV_HANDLE_REF; \
306 QUEUE_INSERT_TAIL(&(loop_)->handle_queue, &(h)->handle_queue); \
307 uv__handle_platform_init(h); \
315 # define UV_REQ_INIT(req, typ) \
317 (req)->type = (typ); \
318 (req)->u.io.overlapped.Internal = 0; \
322 # define UV_REQ_INIT(req, typ) \
324 (req)->type = (typ); \
329 #define uv__req_init(loop, req, typ) \
331 UV_REQ_INIT(req, typ); \
332 uv__req_register(loop, req); \
336 #define uv__get_internal_fields(loop) \
337 ((uv__loop_internal_fields_t*) loop->internal_fields)
339 #define uv__get_loop_metrics(loop) \
340 (&uv__get_internal_fields(loop)->loop_metrics)
static mcore_handle handle
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd domain
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static const char struct stat static buf struct stat static buf static vhangup int status
static const void static count static fd struct stat static buf struct pollfd unsigned static timeout void static offset void static length char static len const struct iovec static count unsigned long static filedes static sched_yield static flags static oldfd static pause unsigned static seconds static protocol struct sockaddr addrlen
static struct sockaddr static addrlen static backlog const void static flags void flags
uv__loop_metrics_t loop_metrics
uint64_t provider_idle_time
uint64_t provider_entry_time
static char bufs[4][128]
Buffers for uint64_to_str() and uint64_to_nicestr()
pthread_mutex_t uv_mutex_t
int uv__loop_configure(uv_loop_t *loop, uv_loop_option option, va_list ap)
@ UV_HANDLE_TCP_KEEPALIVE
@ UV_HANDLE_TTY_SAVED_POSITION
@ UV_HANDLE_UDP_PROCESSING
@ UV_HANDLE_TTY_SAVED_ATTRIBUTES
@ UV_HANDLE_BLOCKING_WRITES
@ UV_HANDLE_CANCELLATION_PENDING
@ UV_HANDLE_TCP_SOCKET_CLOSED
@ UV_HANDLE_TCP_SINGLE_ACCEPT
@ UV_HANDLE_UDP_CONNECTED
@ UV_HANDLE_ENDGAME_QUEUED
@ UV_HANDLE_SHARED_TCP_SOCKET
@ UV_HANDLE_TCP_ACCEPT_STATE_CHANGING
@ UV_HANDLE_SYNC_BYPASS_IOCP
@ UV_SIGNAL_ONE_SHOT_DISPATCHED
@ UV_HANDLE_NON_OVERLAPPED_PIPE
int uv__udp_init_ex(uv_loop_t *loop, uv_udp_t *handle, unsigned flags, int domain)
int uv__udp_send(uv_udp_send_t *req, uv_udp_t *handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr *addr, unsigned int addrlen, uv_udp_send_cb send_cb)
int uv__udp_is_connected(uv_udp_t *handle)
void * uv__reallocf(void *ptr, size_t size)
void uv__work_done(uv_async_t *handle)
char * uv__strndup(const char *s, size_t n)
void * uv__realloc(void *ptr, size_t size)
int uv__next_timeout(const uv_loop_t *loop)
size_t uv__count_bufs(const uv_buf_t bufs[], unsigned int nbufs)
void uv__threadpool_cleanup(void)
int uv__tcp_connect(uv_connect_t *req, uv_tcp_t *handle, const struct sockaddr *addr, unsigned int addrlen, uv_connect_cb cb)
int uv__udp_disconnect(uv_udp_t *handle)
int uv__tcp_bind(uv_tcp_t *tcp, const struct sockaddr *addr, unsigned int addrlen, unsigned int flags)
int uv__udp_connect(uv_udp_t *handle, const struct sockaddr *addr, unsigned int addrlen)
void uv__fs_scandir_cleanup(uv_fs_t *req)
char * uv__strdup(const char *s)
void uv__process_title_cleanup(void)
void uv__run_timers(uv_loop_t *loop)
void uv__signal_cleanup(void)
void uv__fs_poll_close(uv_fs_poll_t *handle)
void * uv__malloc(size_t size)
void * uv__calloc(size_t count, size_t size)
int uv__socket_sockopt(uv_handle_t *handle, int optname, int *value)
void uv__fs_readdir_cleanup(uv_fs_t *req)
int uv__udp_recv_stop(uv_udp_t *handle)
int uv__getaddrinfo_translate_error(int sys_err)
int uv__udp_try_send(uv_udp_t *handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr *addr, unsigned int addrlen)
void uv__metrics_update_idle_time(uv_loop_t *loop)
uv_dirent_type_t uv__fs_get_dirent_type(uv__dirent_t *dent)
int uv__udp_recv_start(uv_udp_t *handle, uv_alloc_cb alloccb, uv_udp_recv_cb recv_cb)
void uv__work_submit(uv_loop_t *loop, struct uv__work *w, enum uv__work_kind kind, void(*work)(struct uv__work *w), void(*done)(struct uv__work *w, int status))
int uv__udp_bind(uv_udp_t *handle, const struct sockaddr *addr, unsigned int addrlen, unsigned int flags)
void uv__loop_close(uv_loop_t *loop)
void uv__timer_close(uv_timer_t *handle)
void uv__metrics_set_provider_entry_time(uv_loop_t *loop)
void(* uv_udp_recv_cb)(uv_udp_t *handle, ssize_t nread, const uv_buf_t *buf, const struct sockaddr *addr, unsigned flags)
void(* uv_udp_send_cb)(uv_udp_send_t *req, int status)
void(* uv_alloc_cb)(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
void(* uv_connect_cb)(uv_connect_t *req, int status)