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 shall be ignored
9 if the value of the func parameter is SIG_IGN.
10
11 How this program tests this assertion is by setting up a handler
12 "myhandler" for SIGCHLD, and then raising that signal. If the
13 handler_called variable is anything but 1, then fail, otherwise pass.
14
15*/
16
17#include <signal.h>
18#include <stdio.h>
19#include <stdlib.h>
20#include "posixtest.h"
21
22int handler_called = 0;
23
24void myhandler(int signo)
25{
26	printf("SIGCHLD called. Inside handler\n");
27	handler_called = 1;
28}
29
30int main(void)
31{
32	if (signal(SIGCHLD, myhandler) == SIG_ERR) {
33		perror("Unexpected error while using signal()");
34		return PTS_UNRESOLVED;
35	}
36
37	raise(SIGCHLD);
38
39	if (handler_called != 1) {
40		printf
41		    ("Test FAILED: handler was called even though default was expected\n");
42		return PTS_FAIL;
43	}
44	return PTS_PASS;
45}
46