12c28215423293e443469a07ae7011135d058b671Garrett Cooper/*
20dc076565f772bb1953209fb69ea150b494aaa40robbiew * Copyright (c) 2002-3, Intel Corporation. All rights reserved.
30dc076565f772bb1953209fb69ea150b494aaa40robbiew * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
40dc076565f772bb1953209fb69ea150b494aaa40robbiew * This file is licensed under the GPL license.  For the full content
52c28215423293e443469a07ae7011135d058b671Garrett Cooper * of this license, see the COPYING file at the top level of this
60dc076565f772bb1953209fb69ea150b494aaa40robbiew * source tree.
70dc076565f772bb1953209fb69ea150b494aaa40robbiew
80dc076565f772bb1953209fb69ea150b494aaa40robbiew *  Test that the killpg() function shall return -1 on failure.
90dc076565f772bb1953209fb69ea150b494aaa40robbiew
100dc076565f772bb1953209fb69ea150b494aaa40robbiew */
110dc076565f772bb1953209fb69ea150b494aaa40robbiew
120dc076565f772bb1953209fb69ea150b494aaa40robbiew#define _XOPEN_SOURCE 600
130dc076565f772bb1953209fb69ea150b494aaa40robbiew
140dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <signal.h>
150dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <stdio.h>
160dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <stdlib.h>
170dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <unistd.h>
180dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <errno.h>
190dc076565f772bb1953209fb69ea150b494aaa40robbiew#include "posixtest.h"
200dc076565f772bb1953209fb69ea150b494aaa40robbiew
21a96844a33d5e503ab7b1a0a54c854a590b8b3edeCyril Hrubisint main(void)
220dc076565f772bb1953209fb69ea150b494aaa40robbiew{
230dc076565f772bb1953209fb69ea150b494aaa40robbiew	int pgrp;
240dc076565f772bb1953209fb69ea150b494aaa40robbiew
25354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao	if ((pgrp = getpgrp()) == -1) {
260dc076565f772bb1953209fb69ea150b494aaa40robbiew		printf("Could not get process group number\n");
270dc076565f772bb1953209fb69ea150b494aaa40robbiew		return PTS_UNRESOLVED;
280dc076565f772bb1953209fb69ea150b494aaa40robbiew	}
290dc076565f772bb1953209fb69ea150b494aaa40robbiew
30354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao	if (killpg(pgrp, -1) != -1) {
31354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao		printf
32354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao		    ("Test FAILED: killpg did not return -1 even though it was passed an invalid signal number.");
330dc076565f772bb1953209fb69ea150b494aaa40robbiew		return PTS_FAIL;
340dc076565f772bb1953209fb69ea150b494aaa40robbiew	}
350dc076565f772bb1953209fb69ea150b494aaa40robbiew
360dc076565f772bb1953209fb69ea150b494aaa40robbiew	printf("Test PASSED\n");
370dc076565f772bb1953209fb69ea150b494aaa40robbiew	return PTS_PASS;
38ec6edca7aa42b6affd989ef91b5897f96795e40fChris Dearman}
39