• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2002-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  *  Test that when pid does not exist, then sigqueue() returns -1
9  *  and errno is set to [ESRCH]
10 
11  */
12 
13 #define _XOPEN_REALTIME 1
14 
15 #include <signal.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <unistd.h>
19 #include <errno.h>
20 #include <sys/types.h>
21 #include "posixtest.h"
22 
main(void)23 int main(void)
24 {
25 	int failure = 0;
26 	union sigval value;
27 	value.sival_int = 0;	/* 0 is just an arbitrary value */
28 
29 	if (-1 == sigqueue(999999, 0, value)) {
30 		if (ESRCH == errno) {
31 			printf("ESRCH error received\n");
32 		} else {
33 			printf
34 			    ("sigqueue() failed on ESRCH but errno not set correctly\n");
35 			failure = 1;
36 		}
37 	} else {
38 		printf("sigqueue() did not return -1 on ESRCH\n");
39 		failure = 1;
40 	}
41 
42 	if (failure) {
43 		return PTS_FAIL;
44 	}
45 	printf("Test PASSED\n");
46 	return PTS_PASS;
47 }
48