Browse Source

Upgrade libuv to 2b7774a

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
05727f6e3e
  1. 3
      deps/uv/include/uv.h
  2. 2
      deps/uv/src/unix/error.c
  3. 11
      deps/uv/src/uv-common.c
  4. 1
      deps/uv/src/uv-common.h
  5. 19
      deps/uv/src/win/process.c
  6. 6
      deps/uv/test/test-spawn.c

3
deps/uv/include/uv.h

@ -116,7 +116,8 @@ typedef enum {
UV_EAISERVICE, UV_EAISERVICE,
UV_EAISOCKTYPE, UV_EAISOCKTYPE,
UV_ESHUTDOWN, UV_ESHUTDOWN,
UV_EEXIST UV_EEXIST,
UV_ESRCH
} uv_err_code; } uv_err_code;
typedef enum { typedef enum {

2
deps/uv/src/unix/error.c

@ -79,6 +79,7 @@ static int uv__translate_lib_error(int code) {
case UV_ENOTCONN: return ENOTCONN; case UV_ENOTCONN: return ENOTCONN;
case UV_EEXIST: return EEXIST; case UV_EEXIST: return EEXIST;
case UV_EHOSTUNREACH: return EHOSTUNREACH; case UV_EHOSTUNREACH: return EHOSTUNREACH;
case UV_ESRCH: return ESRCH;
default: return -1; default: return -1;
} }
@ -112,6 +113,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case EEXIST: return UV_EEXIST; case EEXIST: return UV_EEXIST;
case EHOSTUNREACH: return UV_EHOSTUNREACH; case EHOSTUNREACH: return UV_EHOSTUNREACH;
case EAI_NONAME: return UV_ENOENT; case EAI_NONAME: return UV_ENOENT;
case ESRCH: return UV_ESRCH;
default: return UV_UNKNOWN; default: return UV_UNKNOWN;
} }

11
deps/uv/src/uv-common.c

@ -121,8 +121,7 @@ void uv__set_sys_error(uv_loop_t* loop, int sys_error) {
void uv__set_artificial_error(uv_loop_t* loop, uv_err_code code) { void uv__set_artificial_error(uv_loop_t* loop, uv_err_code code) {
loop->last_err.code = code; loop->last_err = uv__new_artificial_error(code);
loop->last_err.sys_errno_ = 0;
} }
@ -134,6 +133,14 @@ uv_err_t uv__new_sys_error(int sys_error) {
} }
uv_err_t uv__new_artificial_error(uv_err_code code) {
uv_err_t error;
error.code = code;
error.sys_errno_ = 0;
return error;
}
uv_err_t uv_last_error(uv_loop_t* loop) { uv_err_t uv_last_error(uv_loop_t* loop) {
return loop->last_err; return loop->last_err;
} }

1
deps/uv/src/uv-common.h

@ -55,6 +55,7 @@ void uv__set_error(uv_loop_t* loop, uv_err_code code, int sys_error);
void uv__set_sys_error(uv_loop_t* loop, int sys_error); void uv__set_sys_error(uv_loop_t* loop, int sys_error);
void uv__set_artificial_error(uv_loop_t* loop, uv_err_code code); void uv__set_artificial_error(uv_loop_t* loop, uv_err_code code);
uv_err_t uv__new_sys_error(int sys_error); uv_err_t uv__new_sys_error(int sys_error);
uv_err_t uv__new_artificial_error(uv_err_code code);
int uv__tcp_bind(uv_tcp_t* handle, struct sockaddr_in addr); int uv__tcp_bind(uv_tcp_t* handle, struct sockaddr_in addr);
int uv__tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6 addr); int uv__tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6 addr);

19
deps/uv/src/win/process.c

@ -1082,14 +1082,17 @@ static uv_err_t uv__kill(HANDLE process_handle, int signum) {
} }
} else if (signum == 0) { } else if (signum == 0) {
/* Health check: is the process still alive? */ /* Health check: is the process still alive? */
if (GetExitCodeProcess(process_handle, &status) && if (GetExitCodeProcess(process_handle, &status)) {
status == STILL_ACTIVE) { if (status == STILL_ACTIVE) {
err = uv_ok_; err = uv_ok_;
} else {
err = uv__new_artificial_error(UV_ESRCH);
}
} else { } else {
err = uv__new_sys_error(GetLastError()); err = uv__new_sys_error(GetLastError());
} }
} else { } else {
err.code = UV_ENOSYS; err = uv__new_artificial_error(UV_ENOSYS);
} }
return err; return err;
@ -1122,8 +1125,12 @@ uv_err_t uv_kill(int pid, int signum) {
HANDLE process_handle = OpenProcess(PROCESS_TERMINATE | HANDLE process_handle = OpenProcess(PROCESS_TERMINATE |
PROCESS_QUERY_INFORMATION, FALSE, pid); PROCESS_QUERY_INFORMATION, FALSE, pid);
if (process_handle == INVALID_HANDLE_VALUE) { if (process_handle == NULL) {
return uv__new_sys_error(GetLastError()); if (GetLastError() == ERROR_INVALID_PARAMETER) {
return uv__new_artificial_error(UV_ESRCH);
} else {
return uv__new_sys_error(GetLastError());
}
} }
err = uv__kill(process_handle, signum); err = uv__kill(process_handle, signum);

6
deps/uv/test/test-spawn.c

@ -68,11 +68,13 @@ static void kill_cb(uv_process_t* process, int exit_status, int term_signal) {
ASSERT(no_term_signal || term_signal == 15); ASSERT(no_term_signal || term_signal == 15);
uv_close((uv_handle_t*)process, close_cb); uv_close((uv_handle_t*)process, close_cb);
/* Sending signum == 0 should check if the /*
* Sending signum == 0 should check if the
* child process is still alive, not kill it. * child process is still alive, not kill it.
* This process should be dead.
*/ */
err = uv_kill(process->pid, 0); err = uv_kill(process->pid, 0);
ASSERT(err.code != UV_OK); ASSERT(err.code == UV_ESRCH);
} }

Loading…
Cancel
Save