diff options
Diffstat (limited to 'deps/uv/include')
-rw-r--r-- | deps/uv/include/uv-private/tree.h | 14 | ||||
-rw-r--r-- | deps/uv/include/uv-private/uv-unix.h | 15 | ||||
-rw-r--r-- | deps/uv/include/uv-private/uv-win.h | 15 | ||||
-rw-r--r-- | deps/uv/include/uv.h | 78 |
4 files changed, 77 insertions, 45 deletions
diff --git a/deps/uv/include/uv-private/tree.h b/deps/uv/include/uv-private/tree.h index eb05cdcd14..f936416e3d 100644 --- a/deps/uv/include/uv-private/tree.h +++ b/deps/uv/include/uv-private/tree.h @@ -26,10 +26,12 @@ #ifndef UV_TREE_H_ #define UV_TREE_H_ -#if __GNUC__ -# define __unused __attribute__((unused)) -#else -# define __unused +#ifndef UV__UNUSED +# if __GNUC__ +# define UV__UNUSED __attribute__((unused)) +# else +# define UV__UNUSED +# endif #endif /* @@ -381,7 +383,7 @@ struct { \ #define RB_PROTOTYPE(name, type, field, cmp) \ RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) #define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ - RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static) + RB_PROTOTYPE_INTERNAL(name, type, field, cmp, UV__UNUSED static) #define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \ attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ @@ -400,7 +402,7 @@ attr struct type *name##_RB_MINMAX(struct name *, int); \ #define RB_GENERATE(name, type, field, cmp) \ RB_GENERATE_INTERNAL(name, type, field, cmp,) #define RB_GENERATE_STATIC(name, type, field, cmp) \ - RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static) + RB_GENERATE_INTERNAL(name, type, field, cmp, UV__UNUSED static) #define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ attr void \ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ diff --git a/deps/uv/include/uv-private/uv-unix.h b/deps/uv/include/uv-private/uv-unix.h index 798be5e0e7..0137c0c362 100644 --- a/deps/uv/include/uv-private/uv-unix.h +++ b/deps/uv/include/uv-private/uv-unix.h @@ -55,6 +55,9 @@ typedef pthread_rwlock_t uv_rwlock_t; typedef void* uv_lib_t; #define UV_DYNAMIC /* empty */ +#define UV_HANDLE_TYPE_PRIVATE /* empty */ +#define UV_REQ_TYPE_PRIVATE /* empty */ + #if __linux__ # define UV_LOOP_PRIVATE_PLATFORM_FIELDS \ /* RB_HEAD(uv__inotify_watchers, uv_fs_event_s) */ \ @@ -74,7 +77,7 @@ typedef void* uv_lib_t; * sure that we're always calling ares_process. See the warning above the \ * definition of ares_timeout(). \ */ \ - ev_timer timer; \ + uv_timer_t timer; \ /* Poll result queue */ \ eio_channel uv_eio_channel; \ struct ev_loop* ev; \ @@ -82,6 +85,7 @@ typedef void* uv_lib_t; uv_async_t uv_eio_want_poll_notifier; \ uv_async_t uv_eio_done_poll_notifier; \ uv_idle_t uv_eio_poller; \ + uv_handle_t* endgame_handles; \ UV_LOOP_PRIVATE_PLATFORM_FIELDS #define UV_REQ_BUFSML_SIZE (4) @@ -118,7 +122,7 @@ typedef void* uv_lib_t; #define UV_HANDLE_PRIVATE_FIELDS \ int fd; \ int flags; \ - ev_idle next_watcher; + uv_handle_t* endgame_next; /* that's what uv-win calls it */ \ #define UV_STREAM_PRIVATE_FIELDS \ @@ -182,11 +186,6 @@ typedef void* uv_lib_t; ev_timer timer_watcher; \ uv_timer_cb timer_cb; -#define UV_ARES_TASK_PRIVATE_FIELDS \ - int sock; \ - ev_io read_watcher; \ - ev_io write_watcher; - #define UV_GETADDRINFO_PRIVATE_FIELDS \ uv_getaddrinfo_cb cb; \ struct addrinfo* hints; \ @@ -223,7 +222,7 @@ typedef void* uv_lib_t; ev_io read_watcher; \ uv_fs_event_cb cb; -#elif (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) \ +#elif defined(__APPLE__) \ || defined(__FreeBSD__) \ || defined(__OpenBSD__) \ || defined(__NetBSD__) diff --git a/deps/uv/include/uv-private/uv-win.h b/deps/uv/include/uv-private/uv-win.h index 812b274173..baeb3e3627 100644 --- a/deps/uv/include/uv-private/uv-win.h +++ b/deps/uv/include/uv-private/uv-win.h @@ -206,15 +206,21 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); /* Counter to keep track of active udp streams */ \ unsigned int active_udp_streams; +#define UV_HANDLE_TYPE_PRIVATE \ + UV_ARES_EVENT, + #define UV_REQ_TYPE_PRIVATE \ /* TODO: remove the req suffix */ \ + UV_ACCEPT, \ UV_ARES_EVENT_REQ, \ UV_ARES_CLEANUP_REQ, \ + UV_FS_EVENT_REQ, \ UV_GETADDRINFO_REQ, \ UV_PROCESS_EXIT, \ UV_PROCESS_CLOSE, \ + UV_READ, \ UV_UDP_RECV, \ - UV_FS_EVENT_REQ + UV_WAKEUP, #define UV_REQ_PRIVATE_FIELDS \ union { \ @@ -390,13 +396,6 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); uv_handle_t* endgame_next; \ unsigned int flags; -#define UV_ARES_TASK_PRIVATE_FIELDS \ - struct uv_req_s ares_req; \ - SOCKET sock; \ - HANDLE h_wait; \ - WSAEVENT h_event; \ - HANDLE h_close_event; - #define UV_GETADDRINFO_PRIVATE_FIELDS \ struct uv_req_s getadddrinfo_req; \ uv_getaddrinfo_cb getaddrinfo_cb; \ diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 16098845c2..0ede3083d3 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -132,37 +132,46 @@ typedef enum { } uv_err_code; #undef UV_ERRNO_GEN +#define UV_HANDLE_TYPE_MAP(XX) \ + XX(ARES_TASK, ares_task) \ + XX(ASYNC, async) \ + XX(CHECK, check) \ + XX(FS_EVENT, fs_event) \ + XX(IDLE, idle) \ + XX(NAMED_PIPE, pipe) \ + XX(PREPARE, prepare) \ + XX(PROCESS, process) \ + XX(TCP, tcp) \ + XX(TIMER, timer) \ + XX(TTY, tty) \ + XX(UDP, udp) \ + +#define UV_REQ_TYPE_MAP(XX) \ + XX(CONNECT, connect) \ + XX(WRITE, write) \ + XX(SHUTDOWN, shutdown) \ + XX(UDP_SEND, udp_send) \ + XX(FS, fs) \ + XX(WORK, work) \ + XX(GETADDRINFO, getaddrinfo) \ + typedef enum { UV_UNKNOWN_HANDLE = 0, - UV_TCP, - UV_UDP, - UV_NAMED_PIPE, - UV_TTY, +#define XX(uc, lc) UV_##uc, + UV_HANDLE_TYPE_MAP(XX) +#undef XX UV_FILE, - UV_TIMER, - UV_PREPARE, - UV_CHECK, - UV_IDLE, - UV_ASYNC, - UV_ARES_TASK, - UV_ARES_EVENT, - UV_PROCESS, - UV_FS_EVENT + UV_HANDLE_TYPE_PRIVATE + UV_HANDLE_TYPE_MAX } uv_handle_type; typedef enum { UV_UNKNOWN_REQ = 0, - UV_CONNECT, - UV_ACCEPT, - UV_READ, - UV_WRITE, - UV_SHUTDOWN, - UV_WAKEUP, - UV_UDP_SEND, - UV_FS, - UV_WORK, - UV_GETADDRINFO, +#define XX(uc, lc) UV_##uc, + UV_REQ_TYPE_MAP(XX) +#undef XX UV_REQ_TYPE_PRIVATE + UV_REQ_TYPE_MAX } uv_req_type; @@ -374,6 +383,18 @@ struct uv_handle_s { }; /* + * Returns size of various handle types, useful for FFI + * bindings to allocate correct memory without copying struct + * definitions + */ +UV_EXTERN size_t uv_handle_size(uv_handle_type type); + +/* + * Returns size of request types, useful for dynamic lookup with FFI + */ +UV_EXTERN size_t uv_req_size(uv_req_type type); + +/* * Returns 1 if the prepare/check/idle/timer handle has been started, 0 * otherwise. For other handle types this always returns 1. */ @@ -523,6 +544,16 @@ UV_EXTERN int uv_is_writable(uv_stream_t* handle); /* + * Used to determine whether a stream is closing or closed. + * + * N.B. is only valid between the initialization of the handle + * and the arrival of the close callback, and cannot be used + * to validate the handle. + */ +UV_EXTERN int uv_is_closing(uv_handle_t* handle); + + +/* * uv_tcp_t is a subclass of uv_stream_t * * Represents a TCP stream or TCP server. @@ -1501,6 +1532,7 @@ struct uv_loop_s { /* Don't export the private CPP symbols. */ +#undef UV_HANDLE_TYPE_PRIVATE #undef UV_REQ_TYPE_PRIVATE #undef UV_REQ_PRIVATE_FIELDS #undef UV_STREAM_PRIVATE_FIELDS |