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