Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
deps: upgrade libuv to a478847
Browse files Browse the repository at this point in the history
The event loop's reference counting scheme in this version of libuv has changed.
Update the libuv bindings to reflect that fact.
  • Loading branch information
bnoordhuis committed May 22, 2012
1 parent a608f65 commit 039fac6
Show file tree
Hide file tree
Showing 85 changed files with 3,508 additions and 1,289 deletions.
8 changes: 4 additions & 4 deletions deps/uv/common.gypi
Expand Up @@ -24,7 +24,7 @@
}],
],
'Optimization': 0, # /Od, no optimization
'MinimalRebuild': 'true',
'MinimalRebuild': 'false',
'OmitFramePointers': 'false',
'BasicRuntimeChecks': 3, # /RTC1
},
Expand Down Expand Up @@ -57,9 +57,6 @@
'OmitFramePointers': 'true',
'EnableFunctionLevelLinking': 'true',
'EnableIntrinsicFunctions': 'true',
'AdditionalOptions': [
'/MP', # compile across multiple CPUs
],
},
'VCLibrarianTool': {
'AdditionalOptions': [
Expand All @@ -84,6 +81,9 @@
'ExceptionHandling': 1, # /EHsc
'SuppressStartupBanner': 'true',
'WarnAsError': 'false',
'AdditionalOptions': [
'/MP', # compile across multiple CPUs
],
},
'VCLibrarianTool': {
},
Expand Down
4 changes: 1 addition & 3 deletions deps/uv/config-unix.mk
Expand Up @@ -29,15 +29,13 @@ CPPFLAGS += -D_FILE_OFFSET_BITS=64

OBJS += src/unix/async.o
OBJS += src/unix/cares.o
OBJS += src/unix/check.o
OBJS += src/unix/core.o
OBJS += src/unix/dl.o
OBJS += src/unix/error.o
OBJS += src/unix/fs.o
OBJS += src/unix/idle.o
OBJS += src/unix/loop.o
OBJS += src/unix/pipe.o
OBJS += src/unix/prepare.o
OBJS += src/unix/poll.o
OBJS += src/unix/process.o
OBJS += src/unix/stream.o
OBJS += src/unix/tcp.o
Expand Down
44 changes: 32 additions & 12 deletions deps/uv/include/uv-private/uv-unix.h
Expand Up @@ -37,6 +37,11 @@
#include <termios.h>
#include <pthread.h>

#if __sun
# include <sys/port.h>
# include <port.h>
#endif

/* Note: May be cast to struct iovec. See writev(2). */
typedef struct {
char* base;
Expand All @@ -45,6 +50,8 @@ typedef struct {

typedef int uv_file;

typedef int uv_os_sock_t;

#define UV_ONCE_INIT PTHREAD_ONCE_INIT

typedef pthread_once_t uv_once_t;
Expand All @@ -57,8 +64,11 @@ typedef gid_t uv_gid_t;
typedef uid_t uv_uid_t;

/* Platform-specific definitions for uv_dlopen support. */
typedef void* uv_lib_t;
#define UV_DYNAMIC /* empty */
typedef struct {
void* handle;
char* errmsg;
} uv_lib_t;

#define UV_HANDLE_TYPE_PRIVATE /* empty */
#define UV_REQ_TYPE_PRIVATE /* empty */
Expand All @@ -71,6 +81,10 @@ typedef void* uv_lib_t;
} inotify_watchers; \
ev_io inotify_read_watcher; \
int inotify_fd;
#elif defined(PORT_SOURCE_FILE)
# define UV_LOOP_PRIVATE_PLATFORM_FIELDS \
ev_io fs_event_watcher; \
int fs_fd;
#else
# define UV_LOOP_PRIVATE_PLATFORM_FIELDS
#endif
Expand All @@ -90,7 +104,10 @@ 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_handle_t* pending_handles; \
ngx_queue_t prepare_handles; \
ngx_queue_t check_handles; \
ngx_queue_t idle_handles; \
UV_LOOP_PRIVATE_PLATFORM_FIELDS

#define UV_REQ_BUFSML_SIZE (4)
Expand Down Expand Up @@ -127,7 +144,7 @@ typedef void* uv_lib_t;
#define UV_HANDLE_PRIVATE_FIELDS \
int fd; \
int flags; \
uv_handle_t* endgame_next; /* that's what uv-win calls it */ \
uv_handle_t* next_pending; \


#define UV_STREAM_PRIVATE_FIELDS \
Expand Down Expand Up @@ -162,22 +179,27 @@ typedef void* uv_lib_t;
const char* pipe_fname; /* strdup'ed */


/* UV_POLL */
#define UV_POLL_PRIVATE_FIELDS \
ev_io io_watcher;


/* UV_PREPARE */ \
#define UV_PREPARE_PRIVATE_FIELDS \
ev_prepare prepare_watcher; \
uv_prepare_cb prepare_cb;
uv_prepare_cb prepare_cb; \
ngx_queue_t queue;


/* UV_CHECK */
#define UV_CHECK_PRIVATE_FIELDS \
ev_check check_watcher; \
uv_check_cb check_cb;
uv_check_cb check_cb; \
ngx_queue_t queue;


/* UV_IDLE */
#define UV_IDLE_PRIVATE_FIELDS \
ev_idle idle_watcher; \
uv_idle_cb idle_cb;
uv_idle_cb idle_cb; \
ngx_queue_t queue;


/* UV_ASYNC */
Expand Down Expand Up @@ -229,6 +251,7 @@ typedef void* uv_lib_t;

#elif defined(__APPLE__) \
|| defined(__FreeBSD__) \
|| defined(__DragonFly__) \
|| defined(__OpenBSD__) \
|| defined(__NetBSD__)

Expand All @@ -239,9 +262,6 @@ typedef void* uv_lib_t;

#elif defined(__sun)

#include <sys/port.h>
#include <port.h>

#ifdef PORT_SOURCE_FILE
# define UV_FS_EVENT_PRIVATE_FIELDS \
ev_io event_watcher; \
Expand Down
57 changes: 52 additions & 5 deletions deps/uv/include/uv-private/uv-win.h
Expand Up @@ -32,9 +32,14 @@
#include <sys/stat.h>

#include "tree.h"
#include "ngx-queue.h"

#define MAX_PIPENAME_LEN 256

#ifndef S_IFLNK
# define S_IFLNK 0xA000
#endif

/*
* Guids and typedefs for winsock extension functions
* Mingw32 doesn't have these :-(
Expand Down Expand Up @@ -128,6 +133,26 @@ typedef int (WSAAPI* LPFN_WSARECVFROM)
LPWSAOVERLAPPED overlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);

#ifndef _NTDEF_
typedef LONG NTSTATUS;
typedef NTSTATUS *PNTSTATUS;
#endif

typedef struct _AFD_POLL_HANDLE_INFO {
HANDLE Handle;
ULONG Events;
NTSTATUS Status;
} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO;

typedef struct _AFD_POLL_INFO {
LARGE_INTEGER Timeout;
ULONG NumberOfHandles;
ULONG Exclusive;
AFD_POLL_HANDLE_INFO Handles[1];
} AFD_POLL_INFO, *PAFD_POLL_INFO;

#define UV_MSAFD_PROVIDER_COUNT 3


/**
* It should be possible to cast uv_buf_t[] to WSABUF[]
Expand All @@ -140,6 +165,8 @@ typedef struct uv_buf_t {

typedef int uv_file;

typedef SOCKET uv_os_sock_t;

typedef HANDLE uv_thread_t;

typedef CRITICAL_SECTION uv_mutex_t;
Expand Down Expand Up @@ -170,16 +197,17 @@ typedef unsigned char uv_uid_t;
typedef unsigned char uv_gid_t;

/* Platform-specific definitions for uv_dlopen support. */
typedef HMODULE uv_lib_t;
#define UV_DYNAMIC FAR WINAPI
typedef struct {
HMODULE handle;
char* errmsg;
} uv_lib_t;

RB_HEAD(uv_timer_tree_s, uv_timer_s);

#define UV_LOOP_PRIVATE_FIELDS \
/* The loop's I/O completion port */ \
HANDLE iocp; \
/* Reference count that keeps the event loop alive */ \
int refs; \
/* The current time according to the event loop. in msecs. */ \
int64_t time; \
/* Tail of a single-linked circular queue of pending reqs. If the queue */ \
Expand All @@ -201,6 +229,9 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
uv_prepare_t* next_prepare_handle; \
uv_check_t* next_check_handle; \
uv_idle_t* next_idle_handle; \
/* This handle holds the peer sockets for the fast variant of uv_poll_t */ \
SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \
/* State used by uv_ares. */ \
ares_channel ares_chan; \
int ares_active_sockets; \
uv_timer_t ares_polling_timer; \
Expand All @@ -218,7 +249,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
UV_ARES_EVENT_REQ, \
UV_ARES_CLEANUP_REQ, \
UV_FS_EVENT_REQ, \
UV_GETADDRINFO_REQ, \
UV_POLL_REQ, \
UV_PROCESS_EXIT, \
UV_PROCESS_CLOSE, \
UV_READ, \
Expand Down Expand Up @@ -281,6 +312,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);

#define UV_STREAM_PRIVATE_FIELDS \
unsigned int reqs_pending; \
int activecnt; \
uv_read_t read_req; \
union { \
struct { uv_stream_connection_fields }; \
Expand Down Expand Up @@ -308,6 +340,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
#define UV_UDP_PRIVATE_FIELDS \
SOCKET socket; \
unsigned int reqs_pending; \
int activecnt; \
uv_req_t recv_req; \
uv_buf_t recv_buffer; \
struct sockaddr_storage recv_from; \
Expand Down Expand Up @@ -368,6 +401,21 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
COORD saved_position; \
WORD saved_attributes;

#define UV_POLL_PRIVATE_FIELDS \
SOCKET socket; \
/* Used in fast mode */ \
SOCKET peer_socket; \
AFD_POLL_INFO afd_poll_info_1; \
AFD_POLL_INFO afd_poll_info_2; \
/* Used in fast and slow mode. */ \
uv_req_t poll_req_1; \
uv_req_t poll_req_2; \
unsigned char submitted_events_1; \
unsigned char submitted_events_2; \
unsigned char mask_events_1; \
unsigned char mask_events_2; \
unsigned char events;

#define UV_TIMER_PRIVATE_FIELDS \
RB_ENTRY(uv_timer_s) tree_entry; \
int64_t due; \
Expand Down Expand Up @@ -400,7 +448,6 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
unsigned int flags;

#define UV_GETADDRINFO_PRIVATE_FIELDS \
struct uv_req_s getadddrinfo_req; \
uv_getaddrinfo_cb getaddrinfo_cb; \
void* alloc; \
wchar_t* node; \
Expand Down

0 comments on commit 039fac6

Please sign in to comment.