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 sigset shall return the signal's 9 previous disposition if signal had not been blocked. 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 20 void myhandler(int signo) 21 { 22 printf("SIGUSR1 called. Inside handler\n"); 23 } 24 25 int main(void) 26 { 27 struct sigaction act; 28 act.sa_flags = 0; 29 act.sa_handler = myhandler; 30 sigemptyset(&act.sa_mask); 31 32 if (sigaction(SIGUSR1, &act, 0) != 0) { 33 perror("Unexpected error while using sigaction()"); 34 return PTS_UNRESOLVED; 35 } 36 37 if (sigset(SIGUSR1, SIG_DFL) != myhandler) { 38 printf 39 ("Test FAILED: sigset didn't return myhandler even though it was SIGUSR1's original disposition\n"); 40 return PTS_FAIL; 41 } 42 43 return PTS_PASS; 44 } 45