Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

review feedback fixes

  • Loading branch information...
Igor Zinkovsky
Igor Zinkovsky committed Nov 2, 2011
1 parent 31f94db commit 15c4253bb432ba197dacd1c00f4177ab10538225
Showing with 14 additions and 19 deletions.
  1. +0 −2 src/unix/dl.c
  2. +3 −0 src/uv-common.c
  3. +2 −0 src/uv-common.h
  4. +0 −3 src/win/error.c
  5. +0 −5 src/win/internal.h
  6. +8 −8 src/win/process.c
  7. +1 −1 test/test-spawn.c
@@ -26,8 +26,6 @@
#include <errno.h>


static const uv_err_t uv_ok_ = { UV_OK, 0 };

uv_err_t uv_dlopen(const char* filename, uv_lib_t* library) {
void* handle = dlopen(filename, RTLD_LAZY);
if (handle == NULL) {
@@ -48,6 +48,9 @@ uv_buf_t uv_buf_init(char* base, size_t len) {
}


const uv_err_t uv_ok_ = { UV_OK, 0 };


const char* uv_err_name(uv_err_t err) {
switch (err.code) {
case UV_UNKNOWN: return "UNKNOWN";
@@ -48,6 +48,8 @@ void uv_add_ares_handle(uv_loop_t* loop, uv_ares_task_t* handle);

int uv_ares_handles_empty(uv_loop_t* loop);

extern const uv_err_t uv_ok_;

uv_err_code uv_translate_sys_error(int sys_errno);
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);
@@ -30,9 +30,6 @@
#include "internal.h"


const uv_err_t uv_ok_ = { UV_OK, ERROR_SUCCESS };


/*
* Display an error message and abort the event loop.
*/
@@ -286,11 +286,6 @@ void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle);
int uv_parent_pid();


/*
* Error handling
*/
extern const uv_err_t uv_ok_;

void uv_fatal_error(const int errorno, const char* syscall);

uv_err_code uv_translate_sys_error(int sys_errno);
@@ -1062,22 +1062,23 @@ static uv_err_t uv__kill(HANDLE process_handle, int signum) {
if (signum == SIGTERM || signum == SIGKILL) {
/* Kill the process. On Windows, killed processes normally return 1. */
if (TerminateProcess(process_handle, 1)) {
return uv_ok_;
err = uv_ok_;
} else {
return uv__new_sys_error(GetLastError());
err = uv__new_sys_error(GetLastError());
}
} else if (signum == 0) {
/* Health check: is the process still alive? */
if (GetExitCodeProcess(process_handle, &status) &&
status == STILL_ACTIVE) {
return uv_ok_;
err = uv_ok_;
} else {
err.code = UV_EINVAL;
return err;
err = uv__new_sys_error(GetLastError());
}
} else {
err.code = UV_ENOSYS;
}

return uv_ok_;
return err;
}


@@ -1108,8 +1109,7 @@ uv_err_t uv_kill(int pid, int signum) {
PROCESS_QUERY_INFORMATION, FALSE, pid);

if (process_handle == INVALID_HANDLE_VALUE) {
err.code = UV_EINVAL;
return err;
return uv__new_sys_error(GetLastError());
}

err = uv__kill(process_handle, signum);
@@ -72,7 +72,7 @@ static void kill_cb(uv_process_t* process, int exit_status, int term_signal) {
* child process is still alive, not kill it.
*/
err = uv_kill(process->pid, 0);
ASSERT(err.code == UV_EINVAL);
ASSERT(err.code != UV_OK);
}


0 comments on commit 15c4253

Please sign in to comment.
You can’t perform that action at this time.