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
This commit is contained in:
Axel Dörfler 2007-10-30 21:44:46 +00:00
parent 6e927a5fc0
commit 9121620d41
2 changed files with 35 additions and 0 deletions

View File

@ -53,6 +53,7 @@ SetSupportedPlatformsForTarget set_area_protection_test1
: $(HAIKU_BEOS_COMPATIBLE_PLATFORMS) ; : $(HAIKU_BEOS_COMPATIBLE_PLATFORMS) ;
SimpleTest set_area_protection_test1 : set_area_protection_test1.cpp ; 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 cache ;
#SubInclude HAIKU_TOP src tests system kernel disk_device_manager ; #SubInclude HAIKU_TOP src tests system kernel disk_device_manager ;

View File

@ -0,0 +1,34 @@
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>
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;
}