From f22163c233d4a9dedfe38ebb18a1a414cd25ba62 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 13 May 2013 20:06:25 +0200 Subject: [PATCH 1/8] darwin: fix ios build, don't require ApplicationServices --- src/unix/darwin-proctitle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 */ } From 55c150abfc11ad6c23674c196ed914db0f942224 Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Mon, 13 May 2013 15:48:32 -0700 Subject: [PATCH 2/8] build: only set soname on shared object builds --- config-unix.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config-unix.mk b/config-unix.mk index 10e8b6cb..347d9d77 100644 --- a/config-unix.mk +++ b/config-unix.mk @@ -151,7 +151,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.10 +SO_LDFLAGS = -Wl,-soname,libuv.so.0.10 endif RUNNER_LDFLAGS += $(LDFLAGS) @@ -161,7 +161,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 \ From 0564ee4a66956df1f3e0294e02296158e984d728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 17 Apr 2013 00:33:25 +0200 Subject: [PATCH 3/8] test, sunos: disable process_title test Disable unit test failing due to missing implementation of uv_(set|get)_process_title for Sun OS (SmartOS). Based on discussion with @tjfontaine, such implementation is difficult if possible at all and it won't be done anytime soon. Thus there is no point in keeping the failing test around. --- test/test-process-title.c | 4 ++++ 1 file changed, 4 insertions(+) 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 } From 11e6613e6260d95c8cf11bf89a2759c24649319a Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 14 May 2013 14:39:58 -0700 Subject: [PATCH 4/8] 2013.05.15, Version 0.10.6 (Stable) 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) --- AUTHORS | 1 + ChangeLog | 29 +++++++++++++++++++++++++++++ src/version.c | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index bfffbbba..6f9b605f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -82,3 +82,4 @@ Brian Mazza Nils Maier Nicholas Vavilov Miroslav Bajtoš +Elliot Saba diff --git a/ChangeLog b/ChangeLog index e8ea646d..3f1411d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2013.05.15, Version 0.10.6 (Stable) + +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.04.24, Version 0.10.5 (Stable), 6595a7732c52eb4f8e57c88655f72997a8567a67 Changes since version 0.10.4: diff --git a/src/version.c b/src/version.c index 5dbc3625..75a5677b 100644 --- a/src/version.c +++ b/src/version.c @@ -35,7 +35,7 @@ #define UV_VERSION_MAJOR 0 #define UV_VERSION_MINOR 10 #define UV_VERSION_PATCH 6 -#define UV_VERSION_IS_RELEASE 0 +#define UV_VERSION_IS_RELEASE 1 #define UV_VERSION ((UV_VERSION_MAJOR << 16) | \ From 1fd10deec4de70ec3c13765948ec2726a0023c23 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 14 May 2013 14:40:01 -0700 Subject: [PATCH 5/8] Now working on v0.10.7 --- ChangeLog | 2 +- src/version.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f1411d6..eb8bcc51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2013.05.15, Version 0.10.6 (Stable) +2013.05.15, Version 0.10.6 (Stable), 11e6613e6260d95c8cf11bf89a2759c24649319a Changes since version 0.10.5: diff --git a/src/version.c b/src/version.c index 75a5677b..9e6e0dbb 100644 --- a/src/version.c +++ b/src/version.c @@ -34,8 +34,8 @@ #define UV_VERSION_MAJOR 0 #define UV_VERSION_MINOR 10 -#define UV_VERSION_PATCH 6 -#define UV_VERSION_IS_RELEASE 1 +#define UV_VERSION_PATCH 7 +#define UV_VERSION_IS_RELEASE 0 #define UV_VERSION ((UV_VERSION_MAJOR << 16) | \ From 415f4d3e4c7ac25abf723eed3f5b40e63e045785 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 14 May 2013 16:48:03 -0700 Subject: [PATCH 6/8] windows: kill child processes when the parent dies This makes Windows behave just like Unix. This does not affect processes that are spawned with the UV_PROCESS_DETACHED flag set. --- src/win/process.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) 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]; From 028baaf0846b686a81e992cb2f2f5a9b8e841fcf Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 14 May 2013 16:50:19 -0700 Subject: [PATCH 7/8] 2013.05.15, Version 0.10.7 (Stable) Changes since version 0.10.6: * windows: kill child processes when the parent dies (Bert Belder) --- ChangeLog | 7 +++++++ src/version.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eb8bcc51..3eed9f16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013.05.15, Version 0.10.7 (Stable) + +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: diff --git a/src/version.c b/src/version.c index 9e6e0dbb..cb77c176 100644 --- a/src/version.c +++ b/src/version.c @@ -35,7 +35,7 @@ #define UV_VERSION_MAJOR 0 #define UV_VERSION_MINOR 10 #define UV_VERSION_PATCH 7 -#define UV_VERSION_IS_RELEASE 0 +#define UV_VERSION_IS_RELEASE 1 #define UV_VERSION ((UV_VERSION_MAJOR << 16) | \ From 13496e9c1ab905af0c43a3dda7bdec7dca73d1b3 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 14 May 2013 16:50:22 -0700 Subject: [PATCH 8/8] Now working on v0.10.8 --- ChangeLog | 2 +- src/version.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3eed9f16..aa1f5d9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2013.05.15, Version 0.10.7 (Stable) +2013.05.15, Version 0.10.7 (Stable), 028baaf0846b686a81e992cb2f2f5a9b8e841fcf Changes since version 0.10.6: diff --git a/src/version.c b/src/version.c index cb77c176..9c523311 100644 --- a/src/version.c +++ b/src/version.c @@ -34,8 +34,8 @@ #define UV_VERSION_MAJOR 0 #define UV_VERSION_MINOR 10 -#define UV_VERSION_PATCH 7 -#define UV_VERSION_IS_RELEASE 1 +#define UV_VERSION_PATCH 8 +#define UV_VERSION_IS_RELEASE 0 #define UV_VERSION ((UV_VERSION_MAJOR << 16) | \