about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-09-13 18:41:48 +0000
committerUlrich Drepper <drepper@redhat.com>2005-09-13 18:41:48 +0000
commita9f43ef464f71b0d379524b2a6294092332c9a30 (patch)
tree5a682a9fdb0d47bd7b19a1693740261a35586521
parent2ac057a06948dc0ca13e7f13dc4b1dd0fd122d0e (diff)
downloadglibc-a9f43ef464f71b0d379524b2a6294092332c9a30.tar.gz
glibc-a9f43ef464f71b0d379524b2a6294092332c9a30.tar.xz
glibc-a9f43ef464f71b0d379524b2a6294092332c9a30.zip
(__spawni): Automatically recognize some more cases when we can use vfork.
-rw-r--r--sysdeps/posix/spawni.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
index 69106c480e..27699f4df8 100644
--- a/sysdeps/posix/spawni.c
+++ b/sysdeps/posix/spawni.c
@@ -1,5 +1,5 @@
 /* Guts of POSIX spawn interface.  Generic POSIX.1 version.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -81,7 +81,15 @@ __spawni (pid_t *pid, const char *file,
   short int flags = attrp == NULL ? 0 : attrp->__flags;
 
   /* Generate the new process.  */
-  if (flags & POSIX_SPAWN_USEVFORK)
+  if ((flags & POSIX_SPAWN_USEVFORK) != 0
+      /* If no major work is done, allow using vfork.  Note that we
+	 might perform the path searching.  But this would be done by
+	 a call to execvp(), too, and such a call must be OK according
+	 to POSIX.  */
+      || ((flags & (POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF
+		    | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER
+		    | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_RESETIDS)) == 0
+	  && file_actions == NULL))
     new_pid = __vfork ();
   else
     new_pid = __fork ();