• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2002, Intel Corporation. All rights reserved.
3  * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
4  *
5  * Created by:  julie.n.fleischer REMOVE-THIS AT intel DOT com
6  * This file is licensed under the GPL license.  For the full content
7  * of this license, see the COPYING file at the top level of this
8  * source tree.
9  *
10  * Test that sigaddset() will add signo to the set signal set.
11  * Test steps:
12  * 1)  Initialize an empty or full signal set.
13  * 2)  Add the SIGALRM signal to the empty signal set.
14  * 3)  Verify that SIGALRM is a member of the signal set.
15  */
16 #include <stdio.h>
17 #include <signal.h>
18 #include "posixtest.h"
19 
main(void)20 int main(void)
21 {
22 	sigset_t signalset;
23 
24 	if (sigemptyset(&signalset) == -1) {
25 		perror("sigemptyset failed -- test aborted");
26 		return PTS_UNRESOLVED;
27 	}
28 
29 	if (sigaddset(&signalset, SIGALRM) == 0) {
30 		if (sigismember(&signalset, SIGALRM) == 1) {
31 			printf("Test PASSED: sigaddset added signal\n");
32 			return PTS_PASS;
33 		}
34 		printf("sigaddset returned, sigmember failed\n");
35 		return PTS_FAIL;
36 	}
37 
38 	printf("sigaddset failed\n");
39 	return PTS_FAIL;
40 }
41