Index: build/jam/OptionalTestPackages
===================================================================
--- build/jam/OptionalTestPackages	(revision 25719)
+++ build/jam/OptionalTestPackages	(working copy)
@@ -55,6 +55,9 @@
 	# add signal posix tests
 	AddFilesToHaikuImage home posixtestsuite conformance interfaces kill
 		: kill_2-1 ;
+	AddFilesToHaikuImage home posixtestsuite conformance interfaces killpg
+		: killpg_1-1 killpg_1-2 killpg_2-1 killpg_4-1 killpg_5-1 killpg_6-1
+		  killpg_8-1 ;
 	AddFilesToHaikuImage home posixtestsuite conformance interfaces sighold
 		: sighold_1-1 sighold_2-1 sighold_3-core-buildonly ;
 	AddFilesToHaikuImage home posixtestsuite conformance interfaces sigignore
@@ -64,6 +67,8 @@
 		: sigprocmask_8-1 sigprocmask_8-2 sigprocmask_8-3 sigprocmask_12-1 ;
 	AddFilesToHaikuImage home posixtestsuite conformance interfaces sigrelse
 		: sigrelse_1-1 sigrelse_2-1 sigrelse_3-core-buildonly ;
+	AddFilesToHaikuImage home posixtestsuite conformance interfaces sigpause
+		: sigpause_1-1 sigpause_1-2 sigpause_2-1 sigpause_3-1 sigpause_4-1 ;
 	AddFilesToHaikuImage home posixtestsuite conformance interfaces signal
 		: signal_1-1 signal_2-1 signal_3-1 signal_5-1 signal_6-1 signal_7-1 ;
 	AddFilesToHaikuImage home posixtestsuite conformance interfaces sigset
Index: src/tests/system/libroot/posix/posixtestsuite/run_posix_tests.sh
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/run_posix_tests.sh	(revision 25719)
+++ src/tests/system/libroot/posix/posixtestsuite/run_posix_tests.sh	(working copy)
@@ -82,6 +82,15 @@
 	echo "kill()"
 	conformance/interfaces/kill/kill_2-1
 	echo ""
+	echo "killpg()"
+	conformance/interfaces/killpg/killpg_1-1
+	conformance/interfaces/killpg/killpg_1-2
+	conformance/interfaces/killpg/killpg_2-1
+	conformance/interfaces/killpg/killpg_4-1
+	conformance/interfaces/killpg/killpg_5-1
+	conformance/interfaces/killpg/killpg_6-1
+	conformance/interfaces/killpg/killpg_8-1
+	echo ""
 	echo "sighold()"
 	conformance/interfaces/sighold/sighold_1-1
 	conformance/interfaces/sighold/sighold_2-1
@@ -114,6 +123,13 @@
 	conformance/interfaces/sigrelse/sigrelse_3-core-buildonly 3
 	conformance/interfaces/sigrelse/sigrelse_3-core-buildonly 4
 	echo ""
+	echo "sigpause()"
+	conformance/interfaces/sigpause/sigpause_1-1
+	conformance/interfaces/sigpause/sigpause_1-2
+	conformance/interfaces/sigpause/sigpause_2-1
+	conformance/interfaces/sigpause/sigpause_3-1
+	conformance/interfaces/sigpause/sigpause_4-1
+	echo ""
 	echo "signal()"
 	conformance/interfaces/signal/signal_1-1
 	conformance/interfaces/signal/signal_2-1
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/1-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/1-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/1-1.c	(revision 0)
@@ -0,0 +1,87 @@
+/*   
+ * Copyright (c) 2003, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ This program verifies that sigpause() removes sig from the signal mask.
+
+ Steps:
+ 1. From the main() function, create a new thread. Give the new thread a
+    a second to set up for receiving a signal, and to suspend itself using
+    sigpause().
+ 2. Have main() send the signal indicated by SIGTOTEST to the new thread, 
+    using pthread_kill(). After doing this, give the new thread a second 
+    to get to the signal handler.
+ 3. In the main() thread, if the handler_called variable wasn't set to 1,
+    then the test has failed, else it passed.
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <pthread.h>
+#include <stdio.h>
+#include <signal.h>
+#include <errno.h>
+#include <unistd.h>
+#include "posixtest.h"
+
+#define SIGTOTEST SIGABRT
+
+int handler_called = 0;
+
+void handler() {
+	/* printf("signal was called\n"); */
+	handler_called = 1;
+	return;
+}
+
+void *a_thread_func()
+{
+	struct sigaction act;
+	act.sa_flags = 0;
+	act.sa_handler = handler;
+	sigemptyset(&act.sa_mask);
+	sigaction(SIGTOTEST, &act, 0);
+	sighold(SIGTOTEST);
+	sigpause(SIGTOTEST);
+	return NULL;
+}
+
+int main()
+{
+	pthread_t new_th;
+
+	if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0)
+	{
+		printf("%ssigpause_1-1:%s               "
+			"%sFAILED: Error creating thread: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	sleep(1);
+
+	if(pthread_kill(new_th, SIGTOTEST) != 0) 
+	{
+		printf("%ssigpause_1-1:%s               "
+			"%sFAILED: Couldn't send signal to thread: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	sleep(1);
+
+	if(handler_called != 1) {
+		printf("%ssigpause_1-1:%s               "
+			"%sFAILED: signal wasn't removed from signal mask: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_FAIL;
+	}
+
+	printf("%ssigpause_1-1:%s               %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;	
+}
+
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/1-2.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/1-2.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/1-2.c	(revision 0)
@@ -0,0 +1,97 @@
+/*   
+ * Copyright (c) 2003, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ This program verifies that sigpause() suspends the calling process
+ until it receives a signal.
+
+ Steps:
+ 1. From the main() function, create a new thread. Give the new thread a
+    a second to set up for receiving a signal, and to suspend itself using
+    sigpause().
+ 2. For about ten seconds, keep checking from main() that the "returned" 
+    variable hasn't been set yet. If it has, that means that sigpause
+    returned even before a signal was sent to it, thus FAIL the test.
+ 3. After the ten seconds, send the new thread a signal using pthread_kill, 
+    and verify that "returned" has now been set to 1, meaning that the
+    sigpause returned from suspension.
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <pthread.h>
+#include <stdio.h>
+#include <signal.h>
+#include <errno.h>
+#include <unistd.h>
+#include "posixtest.h"
+
+#define SIGTOTEST SIGABRT
+
+int returned = 0;
+
+void handler() {
+	/* printf("sigpause_1-2: signal was called\n"); */
+	return;
+}
+
+void *a_thread_func()
+{
+	struct sigaction act;
+	act.sa_flags = 0;
+	act.sa_handler = handler;
+	sigemptyset(&act.sa_mask);
+	sigaction(SIGTOTEST, &act, 0);
+	sigpause(SIGTOTEST);
+	returned = 1;
+	return NULL;
+}
+
+int main()
+{
+	pthread_t new_th;
+	int i;
+
+	if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0)
+	{
+		printf("%ssigpause_1-2:%s               "
+			"%sFAILED: Error creating thread: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	for (i=0; i<2; i++) {
+		sleep(1);
+		if (returned == 1) {
+			printf("%ssigpause_1-2:%s               "
+			"%sFAILED: sigpause returned before it received a signal: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+			return PTS_FAIL;
+		}
+	}
+
+	if(pthread_kill(new_th, SIGTOTEST) != 0) 
+	{
+		printf("%ssigpause_1-2:%s               "
+			"%sFAILED: Couldn't send signal to thread: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	sleep(1);
+
+	if(returned != 1) {
+		printf("%ssigpause_1-2:%s               "
+			"%sFAILED: signal was sent, but sigpause never returned: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_FAIL;
+	}
+
+	printf("%ssigpause_1-2:%s               %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;	
+}
+
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/2-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/2-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/2-1.c	(revision 0)
@@ -0,0 +1,127 @@
+/*   
+ * Copyright (c) 2003, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ This program verifies that sigpause() restores sig to the signal mask before
+ returning.
+
+ Steps:
+ 1. From the main() function, create a new thread. Give the new thread a
+    a second to set up for receiving a signal, add SIGTOTEST to its signal 
+    mask and to suspend itself using sigpause(SIGTOTEST).
+ 2. Have main() send the signal indicated by SIGTOTEST to the new thread, 
+    using pthread_kill(), and using the concept of semaphores, have the main()
+ 3. Once the new thread returns from sigpause, have the new thread raise 
+    SIGTOTEST. At this point, SIGTOTEST should be restored to the signal mask, so the
+    signal handler should not be called yet, and the signal should be pending.
+    If it is not, set the variable return_value to 1, indicating a test failure.
+ 4. Now, from the new thread, set sem back to INMAIN to allow main to continue running.
+ 5. The PTS exit code that main() will return with will depend on the value of
+    return_value:
+	PTS_UNRESOLVED if return value is 2
+	PTS_PASS if return value is 0
+	PTS_FAIL if return value is 1
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <pthread.h>
+#include <stdio.h>
+#include <signal.h>
+#include <errno.h>
+#include <unistd.h>
+#include "posixtest.h"
+
+#define SIGTOTEST SIGABRT
+#define INMAIN 0
+#define INTHREAD 1
+
+int handler_called = 0;
+int return_value = 2;
+int sem = INMAIN;
+
+void handler() {
+	/* printf("sigpause_2-1: signal was called\n"); */
+	handler_called = 1;
+	return;
+}
+
+void *a_thread_func()
+{
+	struct sigaction act;
+	sigset_t pendingset;
+
+	act.sa_flags = 0;
+	act.sa_handler = handler;
+	sigemptyset(&act.sa_mask);
+	sigaction(SIGTOTEST, &act, 0);
+	sighold(SIGTOTEST);
+
+	if ((sigpause(SIGTOTEST) != -1) || (errno != EINTR)) {
+		printf("%ssigpause_2-1:%s               "
+			"%sFAILED: sigpause didn't return -1 and/or didn't set errno correctly: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return_value = 2;
+		return NULL;
+	}
+
+	sleep(1);
+
+	raise (SIGTOTEST);
+	sigpending(&pendingset);
+	if (sigismember(&pendingset, SIGTOTEST) == 1) {
+		/* printf("sigpause_2-1: Test PASSED: signal mask was restored when sigpause returned.\n"); */
+		return_value = 0;
+	}
+	
+	sem = INMAIN;
+	return NULL;
+}
+
+int main()
+{
+	pthread_t new_th;
+
+	if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0)
+	{
+		printf("%ssigpause_2-1:%s               "
+			"%sFAILED: Error creating thread: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	sleep(1);
+
+	if(pthread_kill(new_th, SIGTOTEST) != 0)
+	{
+		printf("%ssigpause_2-1:%s               "
+			"%sFAILED: Couldn't send signal to thread: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	sem = INTHREAD;
+	while (sem == INTHREAD)
+		sleep(1);
+	
+	if(handler_called != 1) {
+		printf("%ssigpause_2-1:%s               "
+			"%sFAILED: signal wasn't removed from signal mask: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	if (return_value != 0) {
+		if (return_value == 1)
+			return PTS_FAIL;
+		if (return_value == 2)
+			return PTS_UNRESOLVED;
+		return PTS_UNRESOLVED;
+	}
+	
+	printf("%ssigpause_2-1:%s               %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;	
+}
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/3-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/3-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/3-1.c	(revision 0)
@@ -0,0 +1,115 @@
+/*   
+ * Copyright (c) 2003, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ This program verifies that sigpause() returns -1 and sets errno to EINTR
+ when it returns.
+
+ Steps:
+ 1. From the main() function, create a new thread. Give the new thread a
+    a second to set up for receiving a signal, and to suspend itself using
+    sigpause().
+ 2. From the main() thread, send signal to new thread to make sigpause return.
+ 3. Verify that sigpause returns -1 and sets errno to EINTR.
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <pthread.h>
+#include <stdio.h>
+#include <signal.h>
+#include <errno.h>
+#include <unistd.h>
+#include "posixtest.h"
+
+#define SIGTOTEST SIGABRT
+#define INTHREAD 0
+#define INMAIN 1
+
+int result = 2;
+int sem = INMAIN;
+
+void handler() {
+	/* printf("signal was called\n"); */
+	return;
+}
+
+void *a_thread_func()
+{
+	int return_value = 0;
+	struct sigaction act;
+	act.sa_flags = 0;
+	act.sa_handler = handler;
+	sigemptyset(&act.sa_mask);
+	sigaction(SIGTOTEST, &act, 0);
+	return_value = sigpause(SIGTOTEST);
+	if (return_value == -1) {
+		if (errno == EINTR) {
+			/* printf ("Test PASSED: sigpause returned -1 and set errno to EINTR\n"); */
+			result = 0;
+		} else {
+			printf("%ssigpause_3-1:%s               "
+				"%sFAILED: sigpause did not set errno to EINTR: %s%s\n",
+				boldOn, boldOff, red, strerror(errno), normal);
+			result = 1;
+		}
+	} else {
+		if (errno == EINTR) {
+			printf("%ssigpause_3-1:%s               "
+			"%sFAILED: sigpause did not return -1: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		}
+		printf("%ssigpause_3-1:%s               "
+			"%sFAILED: sigpause did not set errno to EINTR: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		printf("%ssigpause_3-1:%s               "
+			"%sFAILED: sigpause did not return -1: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		result = 1;
+
+	}
+	sem = INMAIN;
+	return NULL;
+}
+
+int main()
+{
+	pthread_t new_th;
+
+	if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0)
+	{
+		printf("%ssigpause_3-1:%s               "
+			"%sFAILED: Error creating thread: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	sleep(1);
+
+	if(pthread_kill(new_th, SIGTOTEST) != 0) 
+	{
+		printf("%ssigpause_3-1:%s               "
+			"%sFAILED: Couldn't send signal to thread: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		return PTS_UNRESOLVED;
+	}
+
+	sem = INTHREAD;
+	while (sem == INTHREAD)
+		sleep(1);
+
+	if(result == 2) {
+		return PTS_UNRESOLVED;
+	}
+	if(result == 1) {
+		return PTS_FAIL;
+	}
+
+	printf("%ssigpause_3-1:%s               %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;	
+}
+
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/4-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/4-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/4-1.c	(revision 0)
@@ -0,0 +1,62 @@
+/*   
+ * Copyright (c) 2003, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ This program verifies that sigpause() returns -1 and sets errno to EINVAL
+ if passed an invalid signal number.
+
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <pthread.h>
+#include <stdio.h>
+#include <signal.h>
+#include <errno.h>
+#include <unistd.h>
+#include "posixtest.h"
+
+#define SIGTOTEST SIGABRT
+
+int main()
+{
+	int return_value = 0;
+        int result;
+
+	return_value = sigpause(-1);
+	if (return_value == -1) {
+		if (errno == EINVAL) {
+			/* printf ("sigpause_4-1: Test PASSED: sigpause returned -1 and set errno to EINVAL\n"); */
+			result = 0;
+		} else {
+			printf("%ssigpause_4-1:%s               "
+				"%sFAILED: sigpause did not set errno to EINVAL: %s%s\n",
+				boldOn, boldOff, red, strerror(errno), normal);
+			result = 1;
+		}
+	} else {
+		printf("%ssigpause_4-1:%s               "
+			"%sFAILED: sigpause did not return -1: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		if (errno == EINVAL) {
+			printf("%ssigpause_4-1:%s               "
+			"%sFAILED: sigpause did not set errno to EINVAL: %s%s\n",
+			boldOn, boldOff, red, strerror(errno), normal);
+		}
+		result = 1;
+	}
+
+        if(result == 2) {
+                return PTS_UNRESOLVED;
+        }
+        if(result == 1) {
+                return PTS_FAIL;
+        }
+
+	printf("%ssigpause_4-1:%s               %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;
+}
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/Jamfile
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/Jamfile	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/Jamfile	(revision 0)
@@ -0,0 +1,9 @@
+SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigpause ;
+
+SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ;
+
+SimpleTest sigpause_1-1 : 1-1.c ;
+SimpleTest sigpause_1-2 : 1-2.c ;
+SimpleTest sigpause_2-1 : 2-1.c ;
+SimpleTest sigpause_3-1 : 3-1.c ;
+SimpleTest sigpause_4-1 : 4-1.c ;
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/assertions.xml
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/assertions.xml	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigpause/assertions.xml	(revision 0)
@@ -0,0 +1,19 @@
+<assertions>
+  <assertion id="1" tag="ref:XSH6:41956:41957 pt:XSI">
+    The sigpause() function shall remove sig from the signal mask of 
+    the calling process and suspend the calling process until it
+    receives a signal
+  </assertion>
+  <assertion id="2" tag="ref:XSH6:41957:41958 pt:XSI">
+    The sigpause() function shall restore the signal
+    mask of the calling process to its original state before it returns.
+  </assertion>
+  <assertion id="3" tag="ref:XSH6:41968:41969 pt:XSI">
+    Execution shall be suspended by sigpause() function until 
+    a signal is received, after which it shall return -1 and set errno to 
+    [EINTR].
+  </assertion>
+  <assertion id="4" tag="ref:XSH6:41974:41974 pt:XSI">
+    If the sig argument is an illegal signal number, then errno will be set to [EINVAL].
+  </assertion>
+</assertions>
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-1.c	(revision 0)
@@ -0,0 +1,64 @@
+/*   
+ * Copyright (c) 2002-3, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ *  Test that the killpg() function shall send signal sig to the process 
+    group specified by prgp.
+    Steps:
+ *  1. Set up a signal handler for the signal that says we have caught the
+ *     signal.
+ *  2. Call killpg on the current process group id, raising the signal.
+ *  3. If signal handler was called, test passed.
+
+ */
+
+#define _XOPEN_SOURCE 600
+#define SIGTOTEST SIGCHLD
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "posixtest.h"
+
+void handler(int signo)
+{
+	/* printf("Caught signal being tested!\n"); */
+	printf("%skillpg_1-1:%s                 %sPASSED%s\n", boldOn, boldOff, green, normal);
+	exit(0);
+}
+
+int main()
+{
+	int pgrp;
+	struct sigaction act;
+
+	act.sa_handler=handler;
+	act.sa_flags=0;
+	if (sigemptyset(&act.sa_mask) == -1) {
+		perror("killpg_1-1: Error calling sigemptyset\n");
+		return PTS_UNRESOLVED;
+	}
+	if (sigaction(SIGTOTEST, &act, 0) == -1) {
+		perror("killpg_1-1: Error calling sigaction\n");
+		return PTS_UNRESOLVED;
+	}
+
+ 	if ((pgrp = getpgrp()) == -1) {
+		printf("killpg_1-1: Could not get process group number\n");
+		return PTS_UNRESOLVED;
+	}
+
+ 	if (killpg(pgrp, SIGTOTEST) != 0) {
+		printf("killpg_1-1: Could not raise signal being tested\n");
+		return PTS_UNRESOLVED;
+	}
+
+	printf("killpg_1-1: Should have exited from signal handler\n");
+	printf("killpg_1-1: Test FAILED\n");
+	return PTS_FAIL;
+}
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-2.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-2.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-2.c	(revision 0)
@@ -0,0 +1,90 @@
+/*   
+ * Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ *   Steps:
+ *  1) Fork a child process.
+ *  2) In the parent process, call killpg with signal SIGTOTEST for the 
+ *     process group id of the child. Have the parent ignore such a signal
+ *     incase the process group id of the parent is the same as process
+ *     group id of the child.
+ *  In the child,
+ *    3) Wait for signal SIGTOTEST.
+ *    4) Return 1 if SIGTOTEST is found.  Return 0 otherwise.
+ *  5) In the parent, return success if 1 was returned from child.
+ *
+ */
+
+#define _XOPEN_SOURCE 600
+#define SIGTOTEST SIGUSR1
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include "posixtest.h"
+
+void myhandler (int signo) {
+	exit(1);
+}
+
+int main()
+{
+	int child_pid, child_pgid;
+
+	if ((child_pid = fork()) == 0) {
+		/* child here */
+		struct sigaction act;
+		act.sa_handler=myhandler;
+		act.sa_flags=0;
+		sigemptyset(&act.sa_mask);
+		sigaction(SIGTOTEST, &act, 0);
+
+		/* change child's process group id */
+		setpgrp();
+
+		sigpause(SIGABRT);
+
+		return 0;
+	} else {
+		/* parent here */
+		int i;
+		sigignore(SIGTOTEST);
+
+		sleep(1);
+		if ((child_pgid = getpgid(child_pid)) == -1) {
+			printf("killpg_1-2: Could not get pgid of child\n");
+			return PTS_UNRESOLVED;
+		}
+
+
+		if (killpg(child_pgid, SIGTOTEST) != 0) {
+			printf("killpg_1-2: Could not raise signal being tested\n");
+			return PTS_UNRESOLVED;
+		}
+
+		if (wait(&i) == -1) {
+			perror("killpg_1-2: Error waiting for child to exit\n");
+			return PTS_UNRESOLVED;
+		}
+
+		if (WEXITSTATUS(i)) {
+			/* printf("Child exited normally\n"); */
+			printf("%skillpg_1-2:%s                 %sPASSED%s\n", boldOn, boldOff, green, normal);
+			return PTS_PASS;
+		} else {
+			printf("killpg_1-2: Child did not exit normally.\n");
+			printf("killpg_1-2: Test FAILED\n");
+			return PTS_FAIL;
+		}
+	}
+
+	printf("killpg_1-2: Should have exited from parent\n");
+	printf("killpg_1-2: Test FAILED\n");
+	return PTS_FAIL;
+}
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/2-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/2-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/2-1.c	(revision 0)
@@ -0,0 +1,30 @@
+/*   
+ * Copyright (c) 2003, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ Call killpg on the current process with 0 as the signal number. If killpg
+ returns success, then we pass.
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "posixtest.h"
+
+int main()
+{
+	if (killpg(getpgrp(), 0) != 0) {
+		printf("killpg_2-1: Could not call killpg with sig = 0\n");
+		return PTS_FAIL;
+	}
+
+	printf("%skillpg_2-1:%s                 %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;
+}
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/4-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/4-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/4-1.c	(revision 0)
@@ -0,0 +1,37 @@
+/*   
+ * Copyright (c) 2002-3, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ *  Test that the killpg() function shall return 0 upon success.
+
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "posixtest.h"
+
+int main()
+{
+	int pgrp;
+
+ 	if ((pgrp = getpgrp()) == -1) {
+		printf("killpg_4-1: Could not get process group number\n");
+		return PTS_UNRESOLVED;
+	}
+
+ 	if (killpg(pgrp, 0) != 0) {
+		printf("killpg_4-1: killpg did not return success.\n");
+		return PTS_UNRESOLVED;
+	}
+
+	printf("%skillpg_4-1:%s                 %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;
+}
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/5-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/5-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/5-1.c	(revision 0)
@@ -0,0 +1,48 @@
+/*   
+ * Copyright (c) 2002-3, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ *  Test that the killpg() function shall return -1 on failure.
+
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include "posixtest.h"
+
+#if 0
+void handler(int signo)
+{
+	printf("Caught signal being tested!\n");
+	printf("Test PASSED\n");
+	exit(0);
+}
+#endif
+
+
+int main()
+{
+	int pgrp;
+
+ 	if ((pgrp = getpgrp()) == -1) {
+		printf("killpg_5-1: Could not get process group number\n");
+		return PTS_UNRESOLVED;
+	}
+
+ 	if (killpg(pgrp, -1) != -1) {
+		printf("killpg_5-1: Test FAILED: killpg did not return -1 even though it was passed an invalid signal number.");
+		return PTS_FAIL;
+	}
+
+	printf("%skillpg_5-1:%s                 %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;
+}
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/6-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/6-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/6-1.c	(revision 0)
@@ -0,0 +1,44 @@
+/*   
+ * Copyright (c) 2002-3, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ *  Test that the killpg() function shall set errno to EINVAL if it is 
+    passed an invalid signal number
+
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include "posixtest.h"
+
+int main()
+{
+	int pgrp;
+
+ 	if ((pgrp = getpgrp()) == -1) {
+		printf("killpg_6-1: Could not get process group number\n");
+		return PTS_UNRESOLVED;
+	}
+
+ 	if (killpg(pgrp, -1) != -1) {
+		printf("killpg_6-1: killpg did not return -1 even though it was passed an invalid signal number.");
+		return PTS_UNRESOLVED;
+	}
+
+	if (errno != EINVAL) {
+		printf("killpg_6-1: killpg did not set errno to EINVAL even though it was passed an invalid signal number.");
+		return PTS_FAIL;
+	}
+
+	printf("%skillpg_6-1:%s                 %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;
+}
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/8-1.c
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/8-1.c	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/8-1.c	(revision 0)
@@ -0,0 +1,38 @@
+/*   
+ * Copyright (c) 2002-3, Intel Corporation. All rights reserved.
+ * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
+ * This file is licensed under the GPL license.  For the full content
+ * of this license, see the COPYING file at the top level of this 
+ * source tree.
+
+ *  Test that the killpg() function shall set errno to ESRCH if it is 
+    passed an invalid process group number
+
+ */
+
+#define _XOPEN_SOURCE 600
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include "posixtest.h"
+
+int main()
+{
+
+ 	if (killpg(999999, 0) != -1) {
+		printf("killpg_8-1: killpg did not return -1 even though it was passed an invalid process group id.");
+		return PTS_UNRESOLVED;
+	}
+
+	if (errno != ESRCH) {
+		printf("killpg_8-1: killpg did not set errno to ESRCH even though it was passed an invalid signal number.");
+		return PTS_FAIL;
+	}
+
+	printf("%skillpg_8-1:%s                 %sPASSED%s\n", boldOn, boldOff, green, normal);
+	return PTS_PASS;
+}
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/Jamfile
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/Jamfile	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/Jamfile	(revision 0)
@@ -0,0 +1,11 @@
+SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces killpg ;
+
+SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ;
+
+SimpleTest killpg_1-1 : 1-1.c ;
+SimpleTest killpg_1-2 : 1-2.c ;
+SimpleTest killpg_2-1 : 2-1.c ;
+SimpleTest killpg_4-1 : 4-1.c ;
+SimpleTest killpg_5-1 : 5-1.c ;
+SimpleTest killpg_6-1 : 6-1.c ;
+SimpleTest killpg_8-1 : 8-1.c ;
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/assertions.xml
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/assertions.xml	(revision 0)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/assertions.xml	(revision 0)
@@ -0,0 +1,33 @@
+<assertions>
+  <assertion id="1" tag="ref:XSH6:22101:22101 pt:XSI">
+The killpg () function sends the signal sig to the process 
+group pgrp.
+  </assertion>
+  <assertion id="2" tag="ref:XSH6:22102:22102 pt:XSI">
+killpg(pgrp, sig) is equivalent to kill(-pgrp, sig), when pgrp is greater than 1,
+  </assertion>
+  <assertion id="3" tag="ref:XSH6:22102:22103 pt:XSI">
+The behavior of killpg ( ) is undefined if pgrp is less than or equal to 1.
+  </assertion>
+  <assertion id="4" tag="ref:XSH6:22105:22105 pt:XSI">
+killpg returns 0 upon successful completion. 
+  </assertion>
+  <assertion id="5" tag="ref:XSH6:22105:22106 pt:XSI">
+killpg returns -1, upon unsuccessful completion.
+  </assertion>
+  <assertion id="6" tag="ref:XSH6:22009:22009 pt:XSI">
+errno shall be set to EINVAL, when tThe value of the sig argument is an 
+invalid or unsupported signal 
+number.
+  </assertion>
+  <assertion id="7" tag="ref:XSH6:22010:22011 pt:XSI">
+errno shall be set to EPERM, when the process does not have permission to 
+send the signal to any 
+receiving process.
+  </assertion>
+  <assertion id="8" tag="ref:XSH6:22012:22013 pt:XSI">
+errno shall be set to ESRCH, when no process or process group can be found 
+corresponding to that specified by pid.
+  </assertion>
+</assertions>
+
Index: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile
===================================================================
--- src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile	(revision 25719)
+++ src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile	(working copy)
@@ -3,6 +3,7 @@
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces difftime ;
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces fork ;
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces kill ;
+SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces killpg ;
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_key_create ;
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_key_delete ;
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_getspecific ;
@@ -15,3 +16,4 @@
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces signal ;
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigset ;
 SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigsuspend ;
+SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigpause ;
