1 /* 2 * Copyright (c) 2003, Intel Corporation. All rights reserved. 3 * Created by: salwan.searty 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 This program tests the assertion that the signal will be added to the 9 signal mask before its handler is executed. 10 11 */ 12 13 14 #include <signal.h> 15 #include <stdio.h> 16 #include <stdlib.h> 17 #include "posixtest.h" 18 19 int signal_blocked = 0; 20 myhandler(int signo)21void myhandler(int signo) 22 { 23 printf("SIGCHLD called. Inside handler\n"); 24 sigset_t mask; 25 sigprocmask(SIG_SETMASK, NULL, &mask); 26 if (sigismember(&mask, SIGCHLD)) { 27 signal_blocked = 1; 28 } 29 } 30 main(void)31int main(void) 32 { 33 if (sigset(SIGCHLD, myhandler) == SIG_ERR) { 34 perror("Unexpected error while using sigset()"); 35 return PTS_UNRESOLVED; 36 } 37 38 raise(SIGCHLD); 39 40 if (signal_blocked != 1) { 41 printf 42 ("Test FAILED: handler was called even though default was expected\n"); 43 return PTS_FAIL; 44 } 45 return PTS_PASS; 46 } 47