From 9121620d4151ee3f94c48c235b72393beb74c20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 30 Oct 2007 21:44:46 +0000 Subject: [PATCH] Added sigsuspend_test, courtesy of Vasilis Kaoutsis - thanks! It currently fails on Haiku. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22777 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/system/kernel/Jamfile | 1 + src/tests/system/kernel/sigsuspend_test.cpp | 34 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/tests/system/kernel/sigsuspend_test.cpp diff --git a/src/tests/system/kernel/Jamfile b/src/tests/system/kernel/Jamfile index 3e12e01131..3bd673a37c 100644 --- a/src/tests/system/kernel/Jamfile +++ b/src/tests/system/kernel/Jamfile @@ -53,6 +53,7 @@ SetSupportedPlatformsForTarget set_area_protection_test1 : $(HAIKU_BEOS_COMPATIBLE_PLATFORMS) ; SimpleTest set_area_protection_test1 : set_area_protection_test1.cpp ; +SimpleTest sigsuspend_test : sigsuspend_test.cpp ; SubInclude HAIKU_TOP src tests system kernel cache ; #SubInclude HAIKU_TOP src tests system kernel disk_device_manager ; diff --git a/src/tests/system/kernel/sigsuspend_test.cpp b/src/tests/system/kernel/sigsuspend_test.cpp new file mode 100644 index 0000000000..a25e8d6b6d --- /dev/null +++ b/src/tests/system/kernel/sigsuspend_test.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + + +void +handler(int signal) +{ + printf( "inside handler()\n" ); +} + + +int +main(int argc, char* argv[]) +{ + struct sigaction signalAction; + sigset_t blockedSignalSet; + + sigfillset(&blockedSignalSet); + sigdelset(&blockedSignalSet, SIGALRM); + + sigemptyset(&signalAction.sa_mask); + signalAction.sa_flags = 0; + signalAction.sa_handler = handler; + sigaction(SIGALRM, &signalAction, NULL); + + fprintf(stdout, "before sigsuspend()\n"); + alarm(2); + sigsuspend(&blockedSignalSet); + fprintf(stdout, "after sigsuspend()\n"); + + return 0; +}