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

Commit

Permalink
Upgrade libuv to 60c639f
Browse files Browse the repository at this point in the history
Also remove unused src/stdio_wrap.cc
  • Loading branch information
ry committed Oct 6, 2011
1 parent 4c1d441 commit 311fe73
Show file tree
Hide file tree
Showing 40 changed files with 1,629 additions and 647 deletions.
1 change: 1 addition & 0 deletions deps/uv/.mailmap
Expand Up @@ -7,3 +7,4 @@
San-Tai Hsu <vanilla@fatpipi.com> San-Tai Hsu <vanilla@fatpipi.com>
Isaac Z. Schlueter <i@izs.me> Isaac Z. Schlueter <i@izs.me>
Saúl Ibarra Corretgé <saghul@gmail.com> Saúl Ibarra Corretgé <saghul@gmail.com>
Yuki OKUMURA <mjt@cltn.org>
2 changes: 2 additions & 0 deletions deps/uv/AUTHORS
Expand Up @@ -27,3 +27,5 @@ Pieter Noordhuis <pcnoordhuis@gmail.com>
Marek Jelen <marek@jelen.biz> Marek Jelen <marek@jelen.biz>
Fedor Indutny <fedor.indutny@gmail.com> Fedor Indutny <fedor.indutny@gmail.com>
Saúl Ibarra Corretgé <saghul@gmail.com> Saúl Ibarra Corretgé <saghul@gmail.com>
Felix Geisendörfer <felix@debuggable.com>
Yuki OKUMURA <mjt@cltn.org>
4 changes: 2 additions & 2 deletions deps/uv/Makefile
Expand Up @@ -77,8 +77,8 @@ else
include config-unix.mk include config-unix.mk
endif endif


TESTS=test/echo-server.c test/test-*.c TESTS=test/blackhole-server.c test/echo-server.c test/test-*.c
BENCHMARKS=test/echo-server.c test/dns-server.c test/benchmark-*.c BENCHMARKS=test/blackhole-server.c test/echo-server.c test/dns-server.c test/benchmark-*.c


all: uv.a test/run-tests$(E) test/run-benchmarks$(E) all: uv.a test/run-tests$(E) test/run-benchmarks$(E)


Expand Down
2 changes: 0 additions & 2 deletions deps/uv/include/uv-private/uv-unix.h
Expand Up @@ -91,8 +91,6 @@ typedef int uv_file;




#define UV_STREAM_PRIVATE_FIELDS \ #define UV_STREAM_PRIVATE_FIELDS \
uv_read_cb read_cb; \
uv_alloc_cb alloc_cb; \
uv_connect_t *connect_req; \ uv_connect_t *connect_req; \
uv_shutdown_t *shutdown_req; \ uv_shutdown_t *shutdown_req; \
ev_io read_watcher; \ ev_io read_watcher; \
Expand Down
22 changes: 14 additions & 8 deletions deps/uv/include/uv-private/uv-win.h
Expand Up @@ -98,7 +98,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
struct uv_req_s* next_req; struct uv_req_s* next_req;


#define UV_WRITE_PRIVATE_FIELDS \ #define UV_WRITE_PRIVATE_FIELDS \
/* empty */ int ipc_header;


#define UV_CONNECT_PRIVATE_FIELDS \ #define UV_CONNECT_PRIVATE_FIELDS \
/* empty */ /* empty */
Expand All @@ -120,6 +120,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
UV_REQ_FIELDS \ UV_REQ_FIELDS \
SOCKET accept_socket; \ SOCKET accept_socket; \
char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \ char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \
HANDLE event_handle; \
HANDLE wait_handle; \
struct uv_tcp_accept_s* next_pending; \ struct uv_tcp_accept_s* next_pending; \
} uv_tcp_accept_t; } uv_tcp_accept_t;


Expand All @@ -132,8 +134,6 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);


#define UV_STREAM_PRIVATE_FIELDS \ #define UV_STREAM_PRIVATE_FIELDS \
unsigned int reqs_pending; \ unsigned int reqs_pending; \
uv_alloc_cb alloc_cb; \
uv_read_cb read_cb; \
uv_req_t read_req; \ uv_req_t read_req; \
union { \ union { \
struct { uv_stream_connection_fields }; \ struct { uv_stream_connection_fields }; \
Expand All @@ -142,10 +142,12 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);


#define uv_tcp_server_fields \ #define uv_tcp_server_fields \
uv_tcp_accept_t* accept_reqs; \ uv_tcp_accept_t* accept_reqs; \
uv_tcp_accept_t* pending_accepts; uv_tcp_accept_t* pending_accepts; \
LPFN_ACCEPTEX func_acceptex;


#define uv_tcp_connection_fields \ #define uv_tcp_connection_fields \
uv_buf_t read_buffer; uv_buf_t read_buffer; \
LPFN_CONNECTEX func_connectex;


#define UV_TCP_PRIVATE_FIELDS \ #define UV_TCP_PRIVATE_FIELDS \
SOCKET socket; \ SOCKET socket; \
Expand All @@ -166,11 +168,15 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
uv_alloc_cb alloc_cb; uv_alloc_cb alloc_cb;


#define uv_pipe_server_fields \ #define uv_pipe_server_fields \
uv_pipe_accept_t accept_reqs[4]; \ uv_pipe_accept_t accept_reqs[4]; \
uv_pipe_accept_t* pending_accepts; uv_pipe_accept_t* pending_accepts;


#define uv_pipe_connection_fields \ #define uv_pipe_connection_fields \
uv_timer_t* eof_timer; uv_timer_t* eof_timer; \
uv_write_t ipc_header_write_req; \
int ipc_pid; \
uint64_t remaining_ipc_rawdata_bytes; \
WSAPROTOCOL_INFOW* pending_socket_info;


#define UV_PIPE_PRIVATE_FIELDS \ #define UV_PIPE_PRIVATE_FIELDS \
HANDLE handle; \ HANDLE handle; \
Expand Down
215 changes: 117 additions & 98 deletions deps/uv/include/uv.h
Expand Up @@ -41,6 +41,96 @@ extern "C" {
typedef intptr_t ssize_t; typedef intptr_t ssize_t;
#endif #endif


#if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
# include "uv-private/uv-unix.h"
#else
# include "uv-private/uv-win.h"
#endif

/* Expand this list if necessary. */
typedef enum {
UV_UNKNOWN = -1,
UV_OK = 0,
UV_EOF,
UV_EACCESS,
UV_EAGAIN,
UV_EADDRINUSE,
UV_EADDRNOTAVAIL,
UV_EAFNOSUPPORT,
UV_EALREADY,
UV_EBADF,
UV_EBUSY,
UV_ECONNABORTED,
UV_ECONNREFUSED,
UV_ECONNRESET,
UV_EDESTADDRREQ,
UV_EFAULT,
UV_EHOSTUNREACH,
UV_EINTR,
UV_EINVAL,
UV_EISCONN,
UV_EMFILE,
UV_EMSGSIZE,
UV_ENETDOWN,
UV_ENETUNREACH,
UV_ENFILE,
UV_ENOBUFS,
UV_ENOMEM,
UV_ENONET,
UV_ENOPROTOOPT,
UV_ENOTCONN,
UV_ENOTSOCK,
UV_ENOTSUP,
UV_ENOENT,
UV_EPIPE,
UV_EPROTO,
UV_EPROTONOSUPPORT,
UV_EPROTOTYPE,
UV_ETIMEDOUT,
UV_ECHARSET,
UV_EAIFAMNOSUPPORT,
UV_EAINONAME,
UV_EAISERVICE,
UV_EAISOCKTYPE,
UV_ESHUTDOWN,
UV_EEXIST
} uv_err_code;

typedef enum {
UV_UNKNOWN_HANDLE = 0,
UV_TCP,
UV_UDP,
UV_NAMED_PIPE,
UV_TTY,
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;

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,
UV_REQ_TYPE_PRIVATE
} uv_req_type;



typedef struct uv_loop_s uv_loop_t; typedef struct uv_loop_s uv_loop_t;
typedef struct uv_ares_task_s uv_ares_task_t; typedef struct uv_ares_task_s uv_ares_task_t;
typedef struct uv_err_s uv_err_t; typedef struct uv_err_s uv_err_t;
Expand Down Expand Up @@ -69,12 +159,6 @@ typedef struct uv_fs_s uv_fs_t;
typedef struct uv_fs_event_s uv_fs_event_t; typedef struct uv_fs_event_s uv_fs_event_t;
typedef struct uv_work_s uv_work_t; typedef struct uv_work_s uv_work_t;


#if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
# include "uv-private/uv-unix.h"
#else
# include "uv-private/uv-win.h"
#endif



/* /*
* This function must be called before any other functions in libuv. * This function must be called before any other functions in libuv.
Expand Down Expand Up @@ -121,6 +205,13 @@ int64_t uv_now(uv_loop_t*);
*/ */
typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size); typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size);
typedef void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, uv_buf_t buf); typedef void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, uv_buf_t buf);
/*
* Just like the uv_read_cb except that if the pending parameter is true
* then you can use uv_accept() to pull the new handle into the process.
* If no handle is pending then pending will be UV_UNKNOWN_HANDLE.
*/
typedef void (*uv_read2_cb)(uv_pipe_t* pipe, ssize_t nread, uv_buf_t buf,
uv_handle_type pending);
typedef void (*uv_write_cb)(uv_write_t* req, int status); typedef void (*uv_write_cb)(uv_write_t* req, int status);
typedef void (*uv_connect_cb)(uv_connect_t* req, int status); typedef void (*uv_connect_cb)(uv_connect_t* req, int status);
typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status); typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status);
Expand Down Expand Up @@ -149,89 +240,6 @@ typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, const char* filename,
int events, int status); int events, int status);




/* Expand this list if necessary. */
typedef enum {
UV_UNKNOWN = -1,
UV_OK = 0,
UV_EOF,
UV_EACCESS,
UV_EAGAIN,
UV_EADDRINUSE,
UV_EADDRNOTAVAIL,
UV_EAFNOSUPPORT,
UV_EALREADY,
UV_EBADF,
UV_EBUSY,
UV_ECONNABORTED,
UV_ECONNREFUSED,
UV_ECONNRESET,
UV_EDESTADDRREQ,
UV_EFAULT,
UV_EHOSTUNREACH,
UV_EINTR,
UV_EINVAL,
UV_EISCONN,
UV_EMFILE,
UV_EMSGSIZE,
UV_ENETDOWN,
UV_ENETUNREACH,
UV_ENFILE,
UV_ENOBUFS,
UV_ENOMEM,
UV_ENONET,
UV_ENOPROTOOPT,
UV_ENOTCONN,
UV_ENOTSOCK,
UV_ENOTSUP,
UV_ENOENT,
UV_EPIPE,
UV_EPROTO,
UV_EPROTONOSUPPORT,
UV_EPROTOTYPE,
UV_ETIMEDOUT,
UV_ECHARSET,
UV_EAIFAMNOSUPPORT,
UV_EAINONAME,
UV_EAISERVICE,
UV_EAISOCKTYPE,
UV_ESHUTDOWN,
UV_EEXIST
} uv_err_code;

typedef enum {
UV_UNKNOWN_HANDLE = 0,
UV_TCP,
UV_UDP,
UV_NAMED_PIPE,
UV_TTY,
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;

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,
UV_REQ_TYPE_PRIVATE
} uv_req_type;


struct uv_err_s { struct uv_err_s {
/* read-only */ /* read-only */
uv_err_code code; uv_err_code code;
Expand Down Expand Up @@ -330,6 +338,9 @@ uv_buf_t uv_buf_init(char* base, size_t len);
#define UV_STREAM_FIELDS \ #define UV_STREAM_FIELDS \
/* number of bytes queued for writing */ \ /* number of bytes queued for writing */ \
size_t write_queue_size; \ size_t write_queue_size; \
uv_alloc_cb alloc_cb; \
uv_read_cb read_cb; \
uv_read2_cb read2_cb; \
/* private */ \ /* private */ \
UV_STREAM_PRIVATE_FIELDS UV_STREAM_PRIVATE_FIELDS


Expand All @@ -338,8 +349,8 @@ uv_buf_t uv_buf_init(char* base, size_t len);
* *
* uv_stream is an abstract class. * uv_stream is an abstract class.
* *
* uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t, uv_tty_t * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t, uv_tty_t, and
* and soon uv_file_t. * soon uv_file_t.
*/ */
struct uv_stream_s { struct uv_stream_s {
UV_HANDLE_FIELDS UV_HANDLE_FIELDS
Expand Down Expand Up @@ -375,13 +386,12 @@ int uv_read_start(uv_stream_t*, uv_alloc_cb alloc_cb, uv_read_cb read_cb);


int uv_read_stop(uv_stream_t*); int uv_read_stop(uv_stream_t*);


typedef enum { /*
UV_STDIN = 0, * Extended read methods for receiving handles over a pipe. The pipe must be
UV_STDOUT, * initialized with ipc == 1.
UV_STDERR */
} uv_std_type; int uv_read2_start(uv_stream_t*, uv_alloc_cb alloc_cb, uv_read2_cb read_cb);


uv_stream_t* uv_std_handle(uv_loop_t*, uv_std_type type);


/* /*
* Write data to stream. Buffers are written in order. Example: * Write data to stream. Buffers are written in order. Example:
Expand All @@ -404,10 +414,14 @@ uv_stream_t* uv_std_handle(uv_loop_t*, uv_std_type type);
int uv_write(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], int bufcnt, int uv_write(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], int bufcnt,
uv_write_cb cb); uv_write_cb cb);


int uv_write2(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], int bufcnt,
uv_stream_t* send_handle, uv_write_cb cb);

/* uv_write_t is a subclass of uv_req_t */ /* uv_write_t is a subclass of uv_req_t */
struct uv_write_s { struct uv_write_s {
UV_REQ_FIELDS UV_REQ_FIELDS
uv_write_cb cb; uv_write_cb cb;
uv_stream_t* send_handle;
uv_stream_t* handle; uv_stream_t* handle;
UV_WRITE_PRIVATE_FIELDS UV_WRITE_PRIVATE_FIELDS
}; };
Expand Down Expand Up @@ -648,9 +662,14 @@ struct uv_pipe_s {
UV_HANDLE_FIELDS UV_HANDLE_FIELDS
UV_STREAM_FIELDS UV_STREAM_FIELDS
UV_PIPE_PRIVATE_FIELDS UV_PIPE_PRIVATE_FIELDS
int ipc; /* non-zero if this pipe is used for passing handles */
}; };


int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle); /*
* Initialize a pipe. The last argument is a boolean to indicate if
* this pipe will be used for handle passing between processes.
*/
int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc);


/* /*
* Opens an existing file descriptor or HANDLE as a pipe. * Opens an existing file descriptor or HANDLE as a pipe.
Expand Down
7 changes: 0 additions & 7 deletions deps/uv/src/unix/core.c
Expand Up @@ -790,10 +790,3 @@ size_t uv__strlcpy(char* dst, const char* src, size_t size) {


return src - org; return src - org;
} }


uv_stream_t* uv_std_handle(uv_loop_t* loop, uv_std_type type) {
assert(0 && "implement me");
return NULL;
}

0 comments on commit 311fe73

Please sign in to comment.