diff options
author | Bartosz Sosnowski <bartosz@janeasystems.com> | 2017-11-21 14:35:36 +0100 |
---|---|---|
committer | Bartosz Sosnowski <bartosz@janeasystems.com> | 2017-12-07 14:00:05 +0100 |
commit | 890eedaf59cea75faaa6a14b4248a472dcadb831 (patch) | |
tree | 6ab91056fe1f79048f74063ceaa77d9ea7c3b679 /test/test-signal.c | |
parent | c73e73c8743cc664460a8ae173f034481d94323f (diff) | |
download | libuv-890eedaf59cea75faaa6a14b4248a472dcadb831.tar.gz libuv-890eedaf59cea75faaa6a14b4248a472dcadb831.zip |
win, process: uv_kill improvements
Maps pid 0 to the current process, simulating Linux kill sending signal
to the process group.
Adds detection of invalid signals. If the signum is invalid - below 0
or NSIG or above – UV_EINVAL will be returned instead of UV_ENOSYS.
PR-URL: https://github.com/libuv/libuv/pull/1642
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/test-signal.c')
-rw-r--r-- | test/test-signal.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test-signal.c b/test/test-signal.c index 9a881510..c2ce5ec0 100644 --- a/test/test-signal.c +++ b/test/test-signal.c @@ -22,6 +22,26 @@ #include "uv.h" #include "task.h" +#ifndef _WIN32 +#include <unistd.h> +#endif + +TEST_IMPL(kill_invalid_signum) { + uv_pid_t pid; + + pid = uv_os_getpid(); + + ASSERT(uv_kill(pid, -1) == UV_EINVAL); +#ifdef _WIN32 + /* NSIG is not available on all platforms. */ + ASSERT(uv_kill(pid, NSIG) == UV_EINVAL); +#endif + ASSERT(uv_kill(pid, 4096) == UV_EINVAL); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + /* For Windows we test only signum handling */ #ifdef _WIN32 static void signum_test_cb(uv_signal_t* handle, int signum) { |