mirror of https://gitee.com/openkylin/qemu.git
Add small testcase for ordinary signals.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3998 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
4f400ab520
commit
cbdbb7713d
|
@ -114,6 +114,7 @@ TESTCASES += check_mapbrk.ctst
|
|||
TESTCASES += check_mmap1.ctst
|
||||
TESTCASES += check_mmap2.ctst
|
||||
TESTCASES += check_mmap3.ctst
|
||||
TESTCASES += check_sigalrm.ctst
|
||||
TESTCASES += check_time1.ctst
|
||||
TESTCASES += check_time2.ctst
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAGIC (0xdeadbeef)
|
||||
|
||||
int s = 0;
|
||||
void sighandler(int sig)
|
||||
{
|
||||
s = MAGIC;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int p;
|
||||
|
||||
p = getpid();
|
||||
signal(SIGALRM, sighandler);
|
||||
kill(p, SIGALRM);
|
||||
if (s != MAGIC)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
printf ("passed\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue