PERFORCE change 156887 for review

Robert Watson rwatson at FreeBSD.org
Thu Jan 29 13:11:33 PST 2009


http://perforce.freebsd.org/chv.cgi?CH=156887

Change 156887 by rwatson at rwatson_freebsd_capabilities on 2009/01/29 21:10:55

	Test pdfork, pdgetpid, pdkill in capability mode.

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_syscalls.c#4 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_syscalls.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$P4: //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_syscalls.c#3 $");
+__FBSDID("$P4: //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_syscalls.c#4 $");
 
 #include <sys/param.h>
 #include <sys/capability.h>
@@ -186,9 +186,6 @@
 	pid = fork();
 	if (pid >= 0) {
 		if (pid == 0) {
-			/*
-			 * Not much to be done except print...
-			 */
 			exit(0);
 		} else if (pid > 0) {
 			warnx("test_syscalls:fork succeeded");
@@ -324,6 +321,23 @@
 		close(fd);
 	}
 
+	pid = pdfork(&fd);
+	if (pid < 0)
+		warn("test_syscalls:pdfork %d", errno);
+	else if (pid == 0) {
+		sleep(1);
+		exit(0);
+	} else {
+		if (pdgetpid(fd, &wpid) == 0) {
+			if (pid != wpid)
+				warnx("test_syscalls:pdgetpid wrong pid");
+		} else
+			warn("test_syscalls:pdgetpid %d", errno);
+		if (pdkill(fd, 0) < 0)
+			warn("test_syscalls:pdkill %d", errno);
+		close(fd);
+	}
+
 	if (pipe(fd2) == 0) {
 		close(fd2[0]);
 		close(fd2[1]);


More information about the p4-projects mailing list