1 /*
2  * Copyright (c) 2002-3, 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 the killpg() function shall set errno to EINVAL if it is
9     passed an invalid signal number
10 
11  */
12 
13 #define _XOPEN_SOURCE 600
14 
15 #include <signal.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <unistd.h>
19 #include <errno.h>
20 #include "posixtest.h"
21 
main(void)22 int main(void)
23 {
24 	int pgrp;
25 
26 	if ((pgrp = getpgrp()) == -1) {
27 		printf("Could not get process group number\n");
28 		return PTS_UNRESOLVED;
29 	}
30 
31 	if (killpg(pgrp, -1) != -1) {
32 		printf
33 		    ("killpg did not return -1 even though it was passed an invalid signal number.");
34 		return PTS_UNRESOLVED;
35 	}
36 
37 	if (errno != EINVAL) {
38 		printf
39 		    ("killpg did not set errno to EINVAL even though it was passed an invalid signal number.");
40 		return PTS_FAIL;
41 	}
42 
43 	printf("Test PASSED\n");
44 	return PTS_PASS;
45 }
46