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 8e50b6043da7b3221f51b3158033255c9a210d08
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Zinkovsky committed Dec 15, 2011
1 parent de5ba2d commit da3356b
Show file tree
Hide file tree
Showing 37 changed files with 1,887 additions and 33 deletions.
2 changes: 2 additions & 0 deletions deps/uv/.gitignore
Expand Up @@ -7,6 +7,8 @@
*.orig
*.sdf
*.suo
core
vgcore.*
/out/
/build/gyp

Expand Down
1 change: 1 addition & 0 deletions deps/uv/.mailmap
Expand Up @@ -10,3 +10,4 @@ Saúl Ibarra Corretgé <saghul@gmail.com>
Yuki OKUMURA <mjt@cltn.org>
Frank Denis <github@pureftpd.org>
Ryan Emery <seebees@gmail.com>
Yasuhiro Matsumoto <mattn.jp@gmail.com>
2 changes: 2 additions & 0 deletions deps/uv/AUTHORS
Expand Up @@ -36,3 +36,5 @@ Tj Holowaychuk <tj@vision-media.ca>
Shimon Doodkin <helpmepro1@gmail.com>
Ryan Emery <seebees@gmail.com>
Bruce Mitchener <bruce.mitchener@gmail.com>
Maciej Małecki <maciej.malecki@notimplemented.org>
Yasuhiro Matsumoto <mattn.jp@gmail.com>
2 changes: 1 addition & 1 deletion deps/uv/README.md
@@ -1,4 +1,4 @@
# libuv
# libuv [![Build Status](https://secure.travis-ci.org/joyent/libuv.png)](http://travis-ci.org/joyent/libuv)

libuv is a new platform layer for Node. Its purpose is to abstract IOCP on
Windows and libev on Unix systems. We intend to eventually contain all
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/config-mingw.mk
Expand Up @@ -24,7 +24,7 @@ CC = $(PREFIX)gcc
AR = $(PREFIX)ar
E=.exe

CFLAGS=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0501 -Isrc/ares/config_win32
CFLAGS=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0600 -Isrc/ares/config_win32
LINKFLAGS=-lm

CARES_OBJS += src/ares/windows_port.o
Expand Down
1 change: 1 addition & 0 deletions deps/uv/include/uv-private/uv-unix.h
Expand Up @@ -44,6 +44,7 @@ typedef struct {

typedef int uv_file;

typedef pthread_t uv_thread_t;
typedef pthread_mutex_t uv_mutex_t;
typedef pthread_rwlock_t uv_rwlock_t;

Expand Down
6 changes: 5 additions & 1 deletion deps/uv/include/uv-private/uv-win.h
Expand Up @@ -137,10 +137,14 @@ typedef struct uv_buf_t {

typedef int uv_file;

typedef HANDLE uv_thread_t;

typedef CRITICAL_SECTION uv_mutex_t;

typedef union {
SRWLOCK srwlock_;
/* srwlock_ has type SRWLOCK, but not all toolchains define this type in */
/* windows.h. */
void* srwlock_;
struct {
uv_mutex_t read_mutex_;
uv_mutex_t write_mutex_;
Expand Down
74 changes: 74 additions & 0 deletions deps/uv/include/uv.h
Expand Up @@ -177,6 +177,8 @@ typedef struct uv_async_s uv_async_t;
typedef struct uv_getaddrinfo_s uv_getaddrinfo_t;
typedef struct uv_process_s uv_process_t;
typedef struct uv_counters_s uv_counters_t;
typedef struct uv_cpu_info_s uv_cpu_info_t;
typedef struct uv_interface_address_s uv_interface_address_t;
/* Request types */
typedef struct uv_req_s uv_req_t;
typedef struct uv_shutdown_s uv_shutdown_t;
Expand Down Expand Up @@ -212,6 +214,11 @@ UV_EXTERN uv_loop_t* uv_default_loop(void);
*/
UV_EXTERN int uv_run (uv_loop_t*);

/*
* This function polls for new events without blocking.
*/
UV_EXTERN int uv_run_once (uv_loop_t*);

/*
* Manually modify the event loop's reference count. Useful if the user wants
* to have a handle or timeout that doesn't keep the loop alive.
Expand Down Expand Up @@ -369,6 +376,21 @@ UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
UV_EXTERN uv_buf_t uv_buf_init(char* base, size_t len);


/*
* Utility function. Copies up to `size` characters from `src` to `dst`
* and ensures that `dst` is properly NUL terminated unless `size` is zero.
*/
UV_EXTERN size_t uv_strlcpy(char* dst, const char* src, size_t size);

/*
* Utility function. Appends `src` to `dst` and ensures that `dst` is
* properly NUL terminated unless `size` is zero or `dst` does not
* contain a NUL byte. `size` is the total length of `dst` so at most
* `size - strlen(dst) - 1` characters will be copied from `src`.
*/
UV_EXTERN size_t uv_strlcat(char* dst, const char* src, size_t size);


#define UV_STREAM_FIELDS \
/* number of bytes queued for writing */ \
size_t write_queue_size; \
Expand Down Expand Up @@ -1016,7 +1038,48 @@ UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
uv_work_cb work_cb, uv_after_work_cb after_work_cb);


struct uv_cpu_info_s {
char* model;
int speed;
struct uv_cpu_times_s {
uint64_t user;
uint64_t nice;
uint64_t sys;
uint64_t idle;
uint64_t irq;
} cpu_times;
};

struct uv_interface_address_s {
char* name;
int is_internal;
union {
struct sockaddr_in address4;
struct sockaddr_in6 address6;
} address;
};

UV_EXTERN char** uv_setup_args(int argc, char** argv);
UV_EXTERN uv_err_t uv_get_process_title(char* buffer, size_t size);
UV_EXTERN uv_err_t uv_set_process_title(const char* title);
UV_EXTERN uv_err_t uv_resident_set_memory(size_t* rss);
UV_EXTERN uv_err_t uv_uptime(double* uptime);

/*
* This allocates cpu_infos array, and sets count. The array
* is freed using uv_free_cpu_info().
*/
UV_EXTERN uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);

/*
* This allocates addresses array, and sets count. The array
* is freed using uv_free_interface_addresses().
*/
UV_EXTERN uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
int* count);
UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses,
int count);

/*
* File System Methods.
Expand Down Expand Up @@ -1254,12 +1317,19 @@ UV_EXTERN uv_err_t uv_dlclose(uv_lib_t library);
*/
UV_EXTERN uv_err_t uv_dlsym(uv_lib_t library, const char* name, void** ptr);

/*
* The mutex functions return 0 on success, -1 on error
* (unless the return type is void, of course).
*/
UV_EXTERN int uv_mutex_init(uv_mutex_t* handle);
UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle);
UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle);
UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle);
UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle);

/*
* Same goes for the read/write lock functions.
*/
UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock);
UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock);
UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock);
Expand All @@ -1269,6 +1339,10 @@ UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock);
UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock);
UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock);

UV_EXTERN int uv_thread_create(uv_thread_t *tid,
void (*entry)(void *arg), void *arg);
UV_EXTERN int uv_thread_join(uv_thread_t *tid);

/* the presence of these unions force similar struct layout */
union uv_any_handle {
uv_tcp_t tcp;
Expand Down
12 changes: 9 additions & 3 deletions deps/uv/src/unix/core.c
Expand Up @@ -202,6 +202,12 @@ int uv_run(uv_loop_t* loop) {
}


int uv_run_once(uv_loop_t* loop) {
ev_run(loop->ev, EVRUN_NOWAIT);
return 0;
}


void uv__handle_init(uv_loop_t* loop, uv_handle_t* handle,
uv_handle_type type) {
loop->counters.handle_init++;
Expand Down Expand Up @@ -317,8 +323,8 @@ int64_t uv_now(uv_loop_t* loop) {
}


void uv__req_init(uv_req_t* req) {
/* loop->counters.req_init++; */
void uv__req_init(uv_loop_t* loop, uv_req_t* req) {
loop->counters.req_init++;
req->type = UV_UNKNOWN_REQ;
}

Expand Down Expand Up @@ -658,7 +664,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
return -1;
}

uv__req_init((uv_req_t*)handle);
uv__req_init(loop, (uv_req_t*)handle);
handle->type = UV_GETADDRINFO;
handle->loop = loop;
handle->cb = cb;
Expand Down
1 change: 1 addition & 0 deletions deps/uv/src/unix/cygwin.c
Expand Up @@ -72,6 +72,7 @@ int uv_fs_event_init(uv_loop_t* loop,
const char* filename,
uv_fs_event_cb cb,
int flags) {
loop->counters.fs_event_init++;
uv__set_sys_error(loop, ENOSYS);
return -1;
}
Expand Down

0 comments on commit da3356b

Please sign in to comment.