about summary refs log tree commit diff
path: root/posix/tst-fork.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-05-29 01:00:03 +0000
committerUlrich Drepper <drepper@redhat.com>2000-05-29 01:00:03 +0000
commit31eb0a91a52a5b67564cf38e79f1f01930a28ed5 (patch)
treebdce53e1495345eb7ee708025c3b7f82772dbf28 /posix/tst-fork.c
parent84838b8ff3dc3f826d6c78e25f4e144adea4babe (diff)
downloadglibc-31eb0a91a52a5b67564cf38e79f1f01930a28ed5.tar.gz
glibc-31eb0a91a52a5b67564cf38e79f1f01930a28ed5.tar.xz
glibc-31eb0a91a52a5b67564cf38e79f1f01930a28ed5.zip
Update.
2000-05-28  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/arm/atomicity.h (compare_and_swap): Return result.
Diffstat (limited to 'posix/tst-fork.c')
-rw-r--r--posix/tst-fork.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/posix/tst-fork.c b/posix/tst-fork.c
index 287fa5ffb5..0bee14fabe 100644
--- a/posix/tst-fork.c
+++ b/posix/tst-fork.c
@@ -38,6 +38,7 @@ main (void)
   char *name;
   int fd;
   pid_t pid;
+  pid_t ppid;
   off_t off;
   int status;
 
@@ -69,10 +70,24 @@ main (void)
   if (off == (off_t) -1 || off != strlen (testdata))
     error (EXIT_FAILURE, errno, "wrong file position");
 
+  /* Get the parent PID.  */
+  ppid = getpid ();
+
   /* Now fork of the process.  */
   pid = fork ();
   if (pid == 0)
     {
+      /* One little test first: the PID must have changed.  */
+      if (getpid () == ppid)
+	error (EXIT_FAILURE, 0, "child and parent have same PID");
+
+      /* Test the `getppid' function.  */
+      pid = getppid ();
+      if (pid == (pid_t) -1 ? errno != ENOSYS : pid != ppid)
+	error (EXIT_FAILURE, 0,
+	       "getppid returned wrong PID (%ld, should be %ld)",
+	       (long int) pid, (long int) ppid);
+
       /* This is the child.  First get the position of the descriptor.  */
       off = lseek (fd, 0, SEEK_CUR);
       if (off == (off_t) -1 || off != strlen (testdata))