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#define _XOPEN_SOURCE 600 14 15#include <signal.h> 16#include <stdio.h> 17#include <stdlib.h> 18#include "posixtest.h" 19 20int signal_blocked = 0; 21 22void myhandler(int signo) 23{ 24 printf("SIGCHLD called. Inside handler\n"); 25 sigset_t mask; 26 sigprocmask(SIG_SETMASK, NULL, &mask); 27 if (sigismember(&mask, SIGCHLD)) { 28 signal_blocked = 1; 29 } 30} 31 32int main(void) 33{ 34 if (sigset(SIGCHLD, myhandler) == SIG_ERR) { 35 perror("Unexpected error while using sigset()"); 36 return PTS_UNRESOLVED; 37 } 38 39 raise(SIGCHLD); 40 41 if (signal_blocked != 1) { 42 printf 43 ("Test FAILED: handler was called even though default was expected\n"); 44 return PTS_FAIL; 45 } 46 return PTS_PASS; 47} 48