Skip to content

Commit

Permalink
Check syscall result for sigqueue
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser authored and kentonv committed Dec 11, 2018
1 parent 04b5331 commit 18e966c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions c++/src/kj/async-unix-test.c++
Expand Up @@ -99,7 +99,14 @@ TEST(AsyncUnixTest, SignalWithValue) {
union sigval value;
memset(&value, 0, sizeof(value));
value.sival_int = 123;
sigqueue(getpid(), SIGURG, value);
KJ_SYSCALL_HANDLE_ERRORS(sigqueue(getpid(), SIGURG, value)) {
case ENOSYS:
// sigqueue() not supported. Maybe running on WSL.
KJ_LOG(WARNING, "sigqueue() is not implemented by your system; skipping test");
return;
default:
KJ_FAIL_SYSCALL("sigqueue(getpid(), SIGURG, value)", error);
}

siginfo_t info = port.onSignal(SIGURG).wait(waitScope);
EXPECT_EQ(SIGURG, info.si_signo);
Expand Down Expand Up @@ -127,7 +134,14 @@ TEST(AsyncUnixTest, SignalWithPointerValue) {
union sigval value;
memset(&value, 0, sizeof(value));
value.sival_ptr = &port;
sigqueue(getpid(), SIGURG, value);
KJ_SYSCALL_HANDLE_ERRORS(sigqueue(getpid(), SIGURG, value)) {
case ENOSYS:
// sigqueue() not supported. Maybe running on WSL.
KJ_LOG(WARNING, "sigqueue() is not implemented by your system; skipping test");
return;
default:
KJ_FAIL_SYSCALL("sigqueue(getpid(), SIGURG, value)", error);
}

siginfo_t info = port.onSignal(SIGURG).wait(waitScope);
EXPECT_EQ(SIGURG, info.si_signo);
Expand Down

0 comments on commit 18e966c

Please sign in to comment.