diff --git a/AUTHORS b/AUTHORS index 1562f4a6..90b3235b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -85,3 +85,4 @@ Kristian Evensen Nils Maier Nicholas Vavilov Miroslav Bajtoš +Elliot Saba diff --git a/ChangeLog b/ChangeLog index 2d8bfb48..83cf376d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +2013.05.15, Version 0.10.7 (Stable), 028baaf0846b686a81e992cb2f2f5a9b8e841fcf + +Changes since version 0.10.6: + +* windows: kill child processes when the parent dies (Bert Belder) + + +2013.05.15, Version 0.10.6 (Stable), 11e6613e6260d95c8cf11bf89a2759c24649319a + +Changes since version 0.10.5: + +* stream: fix osx select hack (Fedor Indutny) + +* stream: fix small nit in select hack, add test (Fedor Indutny) + +* build: link with libkvm on openbsd (Ben Noordhuis) + +* stream: use harder sync restrictions for osx-hack (Fedor Indutny) + +* unix: fix EMFILE error handling (Ben Noordhuis) + +* darwin: fix unnecessary include headers (Daisuke Murase) + +* darwin: rename darwin-getproctitle.m (Ben Noordhuis) + +* build: convert predefined $PLATFORM to lower case (Elliot Saba) + +* build: set soname in shared library (Ben Noordhuis) + +* build: make `make test` link against .a again (Ben Noordhuis) + +* darwin: fix ios build, don't require ApplicationServices (Ben Noordhuis) + +* build: only set soname on shared object builds (Timothy J. Fontaine) + + 2013.05.11, Version 0.11.2 (Unstable), 3fba0bf65f091b91a9760530c05c6339c658d88b Changes since version 0.11.1: diff --git a/config-unix.mk b/config-unix.mk index 778fbc6e..67aaa140 100644 --- a/config-unix.mk +++ b/config-unix.mk @@ -144,7 +144,7 @@ endif ifneq (darwin,$(PLATFORM)) # Must correspond with UV_VERSION_MAJOR and UV_VERSION_MINOR in src/version.c -LDFLAGS += -Wl,-soname,libuv.so.0.11 +SO_LDFLAGS = -Wl,-soname,libuv.so.0.11 endif RUNNER_LDFLAGS += $(LDFLAGS) @@ -154,7 +154,7 @@ libuv.a: $(OBJS) libuv.$(SOEXT): override CFLAGS += -fPIC libuv.$(SOEXT): $(OBJS:%.o=%.pic.o) - $(CC) -shared -o $@ $^ $(LDFLAGS) + $(CC) -shared -o $@ $^ $(LDFLAGS) $(SO_LDFLAGS) include/uv-private/uv-unix.h: \ include/uv-private/uv-bsd.h \ diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c index e6c85905..c3171a61 100644 --- a/src/unix/darwin-proctitle.c +++ b/src/unix/darwin-proctitle.c @@ -18,11 +18,18 @@ * IN THE SOFTWARE. */ -#include -#include +#include + +#if !TARGET_OS_IPHONE +# include +# include +#endif int uv__set_process_title(const char* title) { +#if TARGET_OS_IPHONE + return -1; +#else typedef CFTypeRef (*LSGetCurrentApplicationASNType)(void); typedef OSStatus (*LSSetApplicationInformationItemType)(int, CFTypeRef, @@ -76,4 +83,5 @@ int uv__set_process_title(const char* title) { NULL); return (err == noErr) ? 0 : -1; +#endif /* !TARGET_OS_IPHONE */ } diff --git a/src/win/process.c b/src/win/process.c index c5649d3a..8ef420e6 100644 --- a/src/win/process.c +++ b/src/win/process.c @@ -45,6 +45,36 @@ typedef struct env_var { #define E_V(str) { str "=", L##str, sizeof(str), 0, 0 } +static HANDLE uv_global_job_handle_; +static uv_once_t uv_global_job_handle_init_guard_ = UV_ONCE_INIT; + + +static void uv__init_global_job_handle() { + SECURITY_ATTRIBUTES attr; + JOBOBJECT_EXTENDED_LIMIT_INFORMATION info; + + memset(&attr, 0, sizeof attr); + attr.bInheritHandle = FALSE; + + memset(&info, 0, sizeof info); + info.BasicLimitInformation.LimitFlags = + JOB_OBJECT_LIMIT_BREAKAWAY_OK | + JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK | + JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION | + JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + + uv_global_job_handle_ = CreateJobObjectW(&attr, NULL); + if (uv_global_job_handle_ == NULL) + uv_fatal_error(GetLastError(), "CreateJobObjectW"); + + if (!SetInformationJobObject(uv_global_job_handle_, + JobObjectExtendedLimitInformation, + &info, + sizeof info)) + uv_fatal_error(GetLastError(), "SetInformationJobObject"); +} + + static uv_err_t uv_utf8_to_utf16_alloc(const char* s, WCHAR** ws_ptr) { int ws_len, r; WCHAR* ws; @@ -908,6 +938,15 @@ int uv_spawn(uv_loop_t* loop, uv_process_t* process, process->process_handle = info.hProcess; process->pid = info.dwProcessId; + /* If the process isn't spawned as detached, assign to the global job */ + /* object so windows will kill it when the parent process dies. */ + if (!(options.flags & UV_PROCESS_DETACHED)) { + uv_once(&uv_global_job_handle_init_guard_, uv__init_global_job_handle); + + if (!AssignProcessToJobObject(uv_global_job_handle_, info.hProcess)) + uv_fatal_error(GetLastError(), "AssignProcessToJobObject"); + } + /* Set IPC pid to all IPC pipes. */ for (i = 0; i < options.stdio_count; i++) { const uv_stdio_container_t* fdopt = &options.stdio[i]; diff --git a/test/test-process-title.c b/test/test-process-title.c index 5bf5db9f..c870abd1 100644 --- a/test/test-process-title.c +++ b/test/test-process-title.c @@ -42,8 +42,12 @@ static void set_title(const char* title) { TEST_IMPL(process_title) { +#if defined(__sun) + RETURN_SKIP("uv_(get|set)_process_title is not implemented."); +#else /* Check for format string vulnerabilities. */ set_title("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"); set_title("new title"); return 0; +#endif }