• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 verifies that sigpause() returns -1 and sets errno to EINVAL
9  if passed an invalid signal number.
10 
11  */
12 
13 #define _XOPEN_SOURCE 600
14 
15 #include <pthread.h>
16 #include <stdio.h>
17 #include <signal.h>
18 #include <errno.h>
19 #include <unistd.h>
20 #include "posixtest.h"
21 
22 #define SIGTOTEST SIGABRT
23 
24 #if 0 && defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
25 int main(void)
26 {
27 	printf("Function definition doesn't match POSIX definition "
28 	       "and preceded POSIX definition; interface is obsolete\n");
29 	return PTS_UNSUPPORTED;
30 }
31 #else
main(void)32 int main(void)
33 {
34 	int return_value = 0;
35 	int result;
36 
37 	return_value = sigpause(-1);
38 	if (return_value == -1) {
39 		if (errno == EINVAL) {
40 			printf("Test PASSED: sigpause returned -1 and "
41 			       "set errno to EINVAL\n");
42 			result = 0;
43 		} else {
44 			printf("Test FAILED: sigpause did not set errno "
45 			       "to EINVAL\n");
46 			result = 1;
47 		}
48 	} else {
49 		printf("Test FAILED: sigpause did not return -1\n");
50 		if (errno == EINVAL)
51 			printf("Test FAILED: sigpause did not set errno "
52 			       "to EINVAL\n");
53 		result = 1;
54 	}
55 
56 	if (result == 2)
57 		return PTS_UNRESOLVED;
58 	if (result == 1)
59 		return PTS_FAIL;
60 
61 	printf("Test PASSED\n");
62 	return PTS_PASS;
63 }
64 #endif
65