1 /* 2 * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. 3 * Created by: rusty.lynch REMOVE-THIS AT intel DOT com 4 * This file is licensed under the GPL license. For the full content 5 * of this license, see the COPYING file at the top level of this 6 * source tree. 7 8 Test case for assertion #5 of the sigaction system call that verifies 9 setting the SA_INFO bit in the signal mask for SIGHUP will result 10 in sa_sigaction identifying the signal-catching function. 11 */ 12 13 14 #include <signal.h> 15 #include <stdio.h> 16 #include <stdlib.h> 17 #include <sys/wait.h> 18 #include <unistd.h> 19 #include "posixtest.h" 20 21 static volatile int handler_called; 22 handler(int signo PTS_ATTRIBUTE_UNUSED,siginfo_t * info PTS_ATTRIBUTE_UNUSED,void * context PTS_ATTRIBUTE_UNUSED)23static void handler(int signo PTS_ATTRIBUTE_UNUSED, 24 siginfo_t *info PTS_ATTRIBUTE_UNUSED, 25 void *context PTS_ATTRIBUTE_UNUSED) 26 { 27 handler_called = 1; 28 } 29 main(void)30int main(void) 31 { 32 struct sigaction act; 33 34 act.sa_sigaction = handler; 35 act.sa_flags = SA_SIGINFO; 36 sigemptyset(&act.sa_mask); 37 sigaddset(&act.sa_mask, SIGSTOP); 38 if (sigaction(SIGHUP, &act, 0) == -1) { 39 printf("Unexpected error while attempting to setup test " 40 "pre-conditions\n"); 41 return PTS_UNRESOLVED; 42 } 43 44 if (raise(SIGHUP) == -1) { 45 printf("Unexpected error while attempting to setup test " 46 "pre-conditions\n"); 47 return PTS_UNRESOLVED; 48 } 49 50 if (handler_called) { 51 printf("Test PASSED\n"); 52 return PTS_PASS; 53 } 54 55 printf("Test FAILED\n"); 56 return PTS_FAIL; 57 } 58