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 SIGUSR2 will result 10 in sa_sigaction identifying the signal-catching function. 11*/ 12 13#define _XOPEN_SOURCE 600 14 15#include <signal.h> 16#include <stdio.h> 17#include <stdlib.h> 18#include <sys/wait.h> 19#include <unistd.h> 20#include "posixtest.h" 21 22int handler_called = 0; 23 24void handler(int signo, siginfo_t * info, void *context) 25{ 26 handler_called = 1; 27} 28 29int main(void) 30{ 31 struct sigaction act; 32 33 act.sa_sigaction = handler; 34 act.sa_flags = SA_SIGINFO; 35 sigemptyset(&act.sa_mask); 36 sigaddset(&act.sa_mask, SIGSTOP); 37 if (sigaction(SIGUSR2, &act, 0) == -1) { 38 printf("Unexpected error while attempting to setup test " 39 "pre-conditions\n"); 40 return PTS_UNRESOLVED; 41 } 42 43 if (raise(SIGUSR2) == -1) { 44 printf("Unexpected error while attempting to setup test " 45 "pre-conditions\n"); 46 return PTS_UNRESOLVED; 47 } 48 49 if (handler_called) { 50 printf("Test PASSED\n"); 51 return PTS_PASS; 52 } 53 54 printf("Test FAILED\n"); 55 return PTS_FAIL; 56} 57