]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
posix: New function posix_spawn_file_actions_addfchdir_np [BZ #17405]
authorFlorian Weimer <fweimer@redhat.com>
Fri, 7 Dec 2018 14:00:04 +0000 (15:00 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 7 Dec 2018 15:04:05 +0000 (16:04 +0100)
Along with posix_spawn_file_actions_addchdir,
posix_spawn_file_actions_addfchdir is the subject of a change proposal
for POSIX: <http://austingroupbugs.net/view.php?id=1208>

38 files changed:
ChangeLog
NEWS
posix/Makefile
posix/Versions
posix/spawn.h
posix/spawn_faction_addfchdir.c [new file with mode: 0644]
posix/spawn_faction_destroy.c
posix/spawn_int.h
posix/tst-spawn-chdir.c
sysdeps/mach/hurd/i386/libc.abilist
sysdeps/posix/spawni.c
sysdeps/unix/sysv/linux/aarch64/libc.abilist
sysdeps/unix/sysv/linux/alpha/libc.abilist
sysdeps/unix/sysv/linux/arm/libc.abilist
sysdeps/unix/sysv/linux/hppa/libc.abilist
sysdeps/unix/sysv/linux/i386/libc.abilist
sysdeps/unix/sysv/linux/ia64/libc.abilist
sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
sysdeps/unix/sysv/linux/microblaze/libc.abilist
sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
sysdeps/unix/sysv/linux/nios2/libc.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
sysdeps/unix/sysv/linux/sh/libc.abilist
sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
sysdeps/unix/sysv/linux/spawni.c
sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist

index e8cb048d08ecff6d2e5cfc0700b75956cea199ab..0de80afabaa026ad1d2f13a8def28b2852203fc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,71 @@
+2018-12-07  Florian Weimer  <fweimer@redhat.com>
+
+       [BZ #17405]
+       * posix/Makefile (routines): Add spawn_faction_addfchdir.
+       * posix/Versions (GLIBC_2.29): Export
+       posix_spawn_file_actions_addfchdir_np.
+       * posix/spawn.h (posix_spawn_file_actions_addfchdir_np): Declare.
+       * posix/spawn_faction_destroy.c
+       (__posix_spawn_file_actions_destroy): Handle spawn_do_fchdir.
+       * posix/spawn_int.h (struct __spawn_action): Add spawn_do_fchdir
+       and the field action.fchdir_action.
+       * posix/tst-spawn-chdir.c (add_chdir): New function.
+       (do_test): Add do_fchdir loop.  Call add_chdir.
+       * sysdeps/posix/spawni.c (__spawni_child): Handle spawn_do_fchdir.
+       * sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
+       * sysdeps/mach/hurd/i386/libc.abilist (GLIBC_2.29): Add
+       posix_spawn_file_actions_addfchdir_np.
+       * sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+       (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+       (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+       (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+       (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+       (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+       (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+       (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
+       (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.29): Likewise.
+       * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.29):
+       Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.29):
+       Likewise.
+
 2018-12-06  Joseph Myers  <joseph@codesourcery.com>
 
        * manual/texinfo.tex: Update to version 2018-09-21.20 with
diff --git a/NEWS b/NEWS
index 8483dcf4928ce5f1b8a9f05b1b4a9eb6d51796a2..f338c32e92011fbcb613320168057fd646ab1427 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -30,10 +30,12 @@ Major new features:
   HTM state is saved and restore lazily (the state being saved even when the
   process actually does not use HTM).
 
-* The posix_spawn_file_actions_addchdir_np function has been added,
-  enabling posix_spawn and posix_spawnp to run the new process in a
-  different directory.  This is a GNU extension and similar to the
-  Solaris function of the same name.
+* The functions posix_spawn_file_actions_addchdir_np and
+  posix_spawn_file_actions_addfchdir_np have been added, enabling
+  posix_spawn and posix_spawnp to run the new process in a different
+  directory.  These functions are GNU extensions.  The function
+  posix_spawn_file_actions_addchdir_np is similar to the Solaris function
+  of the same name.
 
 * The popen and system do not run atfork handlers anymore (BZ#17490).
   Although it is a possible POSIX violation, the POSIX rationale in
index a8fb1e183908dc9d7a5ecf26238b227ff6a5ea54..d5a6844c88ef5f05725dcb164c1bb3db2bd0c73a 100644 (file)
@@ -55,7 +55,7 @@ routines :=                                                                 \
        pread pwrite pread64 pwrite64                                         \
        spawn_faction_init spawn_faction_destroy spawn_faction_addclose       \
        spawn_faction_addopen spawn_faction_adddup2 spawn_valid_fd            \
-       spawn_faction_addchdir                                                \
+       spawn_faction_addchdir spawn_faction_addfchdir                        \
        spawnattr_init spawnattr_destroy                                      \
        spawnattr_getdefault spawnattr_setdefault                             \
        spawnattr_getflags spawnattr_setflags                                 \
index 56ab921562e4aacdc613d440d63be4629c96d3c8..ad693ae9a776b099d8029ca44293993e079b90f5 100644 (file)
@@ -139,6 +139,7 @@ libc {
   }
   GLIBC_2.29 {
     posix_spawn_file_actions_addchdir_np;
+    posix_spawn_file_actions_addfchdir_np;
   }
   GLIBC_PRIVATE {
     __libc_fork; __libc_pread; __libc_pwrite;
index c84ee4bf72722f40d02cdb82f491b7ddc3a3c23c..8c40b4d28b811fad470235319d702810cf4101a0 100644 (file)
@@ -190,6 +190,12 @@ extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
    affects the subsequent file actions.  */
 extern int posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t *,
                                                 const char *__path) __THROW;
+
+/* Add an action changing the directory to FD during spawn.  This
+   affects the subsequent file actions.  FD is not duplicated and must
+   be open when the file action is executed.  */
+extern int posix_spawn_file_actions_addfchdir_np (posix_spawn_file_actions_t *,
+                                                 int __fd) __THROW;
 #endif
 
 __END_DECLS
diff --git a/posix/spawn_faction_addfchdir.c b/posix/spawn_faction_addfchdir.c
new file mode 100644 (file)
index 0000000..6f069df
--- /dev/null
@@ -0,0 +1,46 @@
+/* Add a directory change to a file action list for posix_spawn.
+   Copyright (C) 2000-2018 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <spawn.h>
+#include <string.h>
+
+#include "spawn_int.h"
+
+int
+posix_spawn_file_actions_addfchdir_np (posix_spawn_file_actions_t *actions,
+                                       int fd)
+{
+  struct __spawn_action *rec;
+
+  /* Allocate more memory if needed.  */
+  if (actions->__used == actions->__allocated
+      && __posix_spawn_file_actions_realloc (actions) != 0)
+    /* This can only mean we ran out of memory.  */
+    return ENOMEM;
+
+  /* Add the new value.  */
+  rec = &actions->__actions[actions->__used];
+  rec->tag = spawn_do_fchdir;
+  rec->action.fchdir_action.fd = fd;
+
+  /* Account for the new entry.  */
+  ++actions->__used;
+
+  return 0;
+}
index 05ca9dc13b97603da7695862a1b37cea69a7ce50..da172a894ebc9ace0f10f18df4a5addda8dcd2da 100644 (file)
@@ -38,6 +38,7 @@ __posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
          break;
        case spawn_do_close:
        case spawn_do_dup2:
+       case spawn_do_fchdir:
          /* No cleanup required.  */
          break;
        }
index 9db35553c20c19015547991ab1c82f54d9317e30..0d0e438ff6e126b1eaa01e6a6ae0a61a4ea7ba44 100644 (file)
@@ -31,6 +31,7 @@ struct __spawn_action
     spawn_do_dup2,
     spawn_do_open,
     spawn_do_chdir,
+    spawn_do_fchdir,
   } tag;
 
   union
@@ -55,6 +56,10 @@ struct __spawn_action
     {
       char *path;
     } chdir_action;
+    struct
+    {
+      int fd;
+    } fchdir_action;
   } action;
 };
 
index dc14f2059b98611ce01acb27e47b9d19bf998376..8f447955c13c5111a4aea3c4d91a499cc43309ed 100644 (file)
 #include <errno.h>
 #include <fcntl.h>
 #include <spawn.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <support/check.h>
 #include <support/support.h>
 #include <support/temp_file.h>
+#include <support/test-driver.h>
 #include <support/xstdio.h>
 #include <support/xunistd.h>
 #include <unistd.h>
@@ -64,6 +66,24 @@ get_pwd_program (void)
   FAIL_EXIT1 ("cannot find pwd program");
 }
 
+/* Adds chdir operations to ACTIONS, using PATH.  If DO_FCHDIR, use
+   the open function and TMPFD to emulate chdir using fchdir.  */
+static void
+add_chdir (posix_spawn_file_actions_t *actions, const char *path,
+           bool do_fchdir, int tmpfd)
+{
+  if (do_fchdir)
+    {
+      TEST_COMPARE (posix_spawn_file_actions_addopen
+                    (actions, tmpfd, path, O_DIRECTORY | O_RDONLY, 0), 0);
+      TEST_COMPARE (posix_spawn_file_actions_addfchdir_np
+                    (actions, tmpfd), 0);
+      TEST_COMPARE (posix_spawn_file_actions_addclose (actions, tmpfd), 0);
+    }
+  else
+    TEST_COMPARE (posix_spawn_file_actions_addchdir_np (actions, path), 0);
+}
+
 static int
 do_test (void)
 {
@@ -87,103 +107,109 @@ do_test (void)
   int iteration = 0;
   for (int do_spawnp = 0; do_spawnp < 2; ++do_spawnp)
     for (int do_overwrite = 0; do_overwrite < 2; ++do_overwrite)
-      {
-        ++iteration;
-        printf ("info: iteration=%d do_spawnp=%d do_overwrite=%d\n",
-                iteration, do_spawnp, do_overwrite);
-
-        /* The "pwd" program runs in this directory.  */
-        char *iteration_directory = xasprintf ("%s/%d", directory, iteration);
-        add_temp_file (iteration_directory);
-        xmkdir (iteration_directory, 0777);
-
-        /* This file receives output from "pwd".  */
-        char *output_file_path
-          = xasprintf ("%s/output-file", iteration_directory);
-        add_temp_file (output_file_path);
-
-        /* This subdirectory is used for chdir ordering checks.  */
-        char *subdir_path = xasprintf ("%s/subdir", iteration_directory);
-        add_temp_file (subdir_path);
-        xmkdir (subdir_path, 0777);
-
-        /* Also used for checking the order of actions.  */
-        char *probe_file_path
-          = xasprintf ("%s/subdir/probe-file", iteration_directory);
-        add_temp_file (probe_file_path);
-        TEST_COMPARE (access (probe_file_path, F_OK), -1);
-        TEST_COMPARE (errno, ENOENT);
-
-        /* This symbolic link is used in a relative path with
-           posix_spawn.  */
-        char *pwd_symlink_path
-          = xasprintf ("%s/subdir/pwd-symlink", iteration_directory);
-        xsymlink (get_pwd_program (), pwd_symlink_path);
-        add_temp_file (pwd_symlink_path);
-
-        posix_spawn_file_actions_t actions;
-        TEST_COMPARE (posix_spawn_file_actions_init (&actions), 0);
-        TEST_COMPARE (posix_spawn_file_actions_addchdir_np
-                      (&actions, subdir_path), 0);
-        TEST_COMPARE (posix_spawn_file_actions_addopen
-                      (&actions, 3, /* Arbitrary unused descriptor.  */
-                       "probe-file",
-                       O_WRONLY | O_CREAT | O_EXCL, 0777), 0);
-        TEST_COMPARE (posix_spawn_file_actions_addclose (&actions, 3), 0);
-        /* Run the actual in iteration_directory.  */
-        TEST_COMPARE (posix_spawn_file_actions_addchdir_np (&actions, ".."), 0);
-        TEST_COMPARE (posix_spawn_file_actions_addopen
-                      (&actions, STDOUT_FILENO, "output-file",
-                       O_WRONLY | O_CREAT | O_EXCL, 0777), 0);
-
-        /* Check that posix_spawn_file_actions_addchdir_np made a copy
-           of the path.  */
-        if (do_overwrite)
-          subdir_path[0] = '\0';
-
-        char *const argv[] = { (char *) "pwd", NULL };
-        char *const envp[] = { NULL } ;
-        pid_t pid;
-        if (do_spawnp)
-          TEST_COMPARE (posix_spawnp (&pid, "pwd", &actions,
-                                      NULL, argv, envp), 0);
-        else
-          TEST_COMPARE (posix_spawn (&pid, "subdir/pwd-symlink", &actions,
-                                     NULL, argv, envp), 0);
-        TEST_VERIFY (pid > 0);
-        int status;
-        xwaitpid (pid, &status, 0);
-        TEST_COMPARE (status, 0);
-
-        /* Check that the current directory did not change.  */
+      for (int do_fchdir = 0; do_fchdir < 2; ++do_fchdir)
         {
-          char *cwd = get_current_dir_name ();
-          if (cwd == NULL)
-            FAIL_EXIT1 ("get_current_dir_name: %m");
-          TEST_COMPARE_BLOB (original_cwd, strlen (original_cwd),
-                             cwd, strlen (cwd));
-          free (cwd);
+          /* This subtest does not make sense for fchdir.  */
+          if (do_overwrite && do_fchdir)
+            continue;
+
+          ++iteration;
+          if (test_verbose > 0)
+            printf ("info: iteration=%d do_spawnp=%d do_overwrite=%d"
+                    " do_fchdir=%d\n",
+                    iteration, do_spawnp, do_overwrite, do_fchdir);
+
+          /* The "pwd" program runs in this directory.  */
+          char *iteration_directory = xasprintf ("%s/%d", directory, iteration);
+          add_temp_file (iteration_directory);
+          xmkdir (iteration_directory, 0777);
+
+          /* This file receives output from "pwd".  */
+          char *output_file_path
+            = xasprintf ("%s/output-file", iteration_directory);
+          add_temp_file (output_file_path);
+
+          /* This subdirectory is used for chdir ordering checks.  */
+          char *subdir_path = xasprintf ("%s/subdir", iteration_directory);
+          add_temp_file (subdir_path);
+          xmkdir (subdir_path, 0777);
+
+          /* Also used for checking the order of actions.  */
+          char *probe_file_path
+            = xasprintf ("%s/subdir/probe-file", iteration_directory);
+          add_temp_file (probe_file_path);
+          TEST_COMPARE (access (probe_file_path, F_OK), -1);
+          TEST_COMPARE (errno, ENOENT);
+
+          /* This symbolic link is used in a relative path with
+             posix_spawn.  */
+          char *pwd_symlink_path
+            = xasprintf ("%s/subdir/pwd-symlink", iteration_directory);
+          xsymlink (get_pwd_program (), pwd_symlink_path);
+          add_temp_file (pwd_symlink_path);
+
+          posix_spawn_file_actions_t actions;
+          TEST_COMPARE (posix_spawn_file_actions_init (&actions), 0);
+          add_chdir (&actions, subdir_path, do_fchdir, 4);
+          TEST_COMPARE (posix_spawn_file_actions_addopen
+                        (&actions, 3, /* Arbitrary unused descriptor.  */
+                         "probe-file",
+                         O_WRONLY | O_CREAT | O_EXCL, 0777), 0);
+          TEST_COMPARE (posix_spawn_file_actions_addclose (&actions, 3), 0);
+          /* Run the actual in iteration_directory.  */
+          add_chdir (&actions, "..", do_fchdir, 5);
+          TEST_COMPARE (posix_spawn_file_actions_addopen
+                        (&actions, STDOUT_FILENO, "output-file",
+                         O_WRONLY | O_CREAT | O_EXCL, 0777), 0);
+
+          /* Check that posix_spawn_file_actions_addchdir_np made a copy
+             of the path.  */
+          if (do_overwrite)
+            subdir_path[0] = '\0';
+
+          char *const argv[] = { (char *) "pwd", NULL };
+          char *const envp[] = { NULL } ;
+          pid_t pid;
+          if (do_spawnp)
+            TEST_COMPARE (posix_spawnp (&pid, "pwd", &actions,
+                                        NULL, argv, envp), 0);
+          else
+            TEST_COMPARE (posix_spawn (&pid, "subdir/pwd-symlink", &actions,
+                                       NULL, argv, envp), 0);
+          TEST_VERIFY (pid > 0);
+          int status;
+          xwaitpid (pid, &status, 0);
+          TEST_COMPARE (status, 0);
+
+          /* Check that the current directory did not change.  */
+          {
+            char *cwd = get_current_dir_name ();
+            if (cwd == NULL)
+              FAIL_EXIT1 ("get_current_dir_name: %m");
+            TEST_COMPARE_BLOB (original_cwd, strlen (original_cwd),
+                               cwd, strlen (cwd));
+            free (cwd);
+          }
+
+
+          /* Check the output from "pwd".  */
+          {
+            char *pwd = read_one_line (output_file_path);
+            TEST_COMPARE_BLOB (iteration_directory, strlen (iteration_directory),
+                               pwd, strlen (pwd));
+            free (pwd);
+          }
+
+          /* This file must now exist.  */
+          TEST_COMPARE (access (probe_file_path, F_OK), 0);
+
+          TEST_COMPARE (posix_spawn_file_actions_destroy (&actions), 0);
+          free (pwd_symlink_path);
+          free (probe_file_path);
+          free (subdir_path);
+          free (output_file_path);
         }
 
-
-        /* Check the output from "pwd".  */
-        {
-          char *pwd = read_one_line (output_file_path);
-          TEST_COMPARE_BLOB (iteration_directory, strlen (iteration_directory),
-                             pwd, strlen (pwd));
-          free (pwd);
-        }
-
-        /* This file must now exist.  */
-        TEST_COMPARE (access (probe_file_path, F_OK), 0);
-
-        TEST_COMPARE (posix_spawn_file_actions_destroy (&actions), 0);
-        free (pwd_symlink_path);
-        free (probe_file_path);
-        free (subdir_path);
-        free (output_file_path);
-      }
-
   free (directory);
 
   return 0;
index f3993cf994bea8d3f68abe95b31b3bd89c89462d..dd3cf6f9f266544e0c9d2ea7c25ed84250f5a5e7 100644 (file)
@@ -2040,6 +2040,7 @@ GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
 GLIBC_2.29 _hurd_port_move F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index c02171cc61e8ec0c09bf8a174d4e784d8cdeaf7f..73d51e6cbe28eec981a3122b414de612ac1890e8 100644 (file)
@@ -214,6 +214,11 @@ __spawni_child (void *arguments)
              if (__chdir (action->action.chdir_action.path) != 0)
                goto fail;
              break;
+
+           case spawn_do_fchdir:
+             if (__fchdir (action->action.fchdir_action.fd) != 0)
+               goto fail;
+             break;
            }
        }
     }
index e66c741d046cdce2edaf1e605fae2ce160b6f18a..8763e7b6188ab740166a1301f9276f3a97649dab 100644 (file)
@@ -2139,3 +2139,4 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
index 8df162fe9993a1d54b58bf3c06b83f1caaad6689..c7dfef32d63b9a07834152d0a5a99f5aaaa0b90b 100644 (file)
@@ -2034,6 +2034,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index 43c804f9dc7fa9d25fdcdf99f2fe5d75f5181914..a306d13a0f4beb201da1fdc32d7c5b8ab453f3b3 100644 (file)
@@ -124,6 +124,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
index 88b01c2e7598d0e8815fb4e1ef3af7fcaf18b92d..4285936c2cc8ba98318ce570a7862d7f3380f2a5 100644 (file)
@@ -1881,6 +1881,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index 6d02f31612b233bf291da4c56374b8a0f6927b46..d19039919217085a98376898b94fa98904fac2fa 100644 (file)
@@ -2046,6 +2046,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index 424971261197fdfa625caf562d8c2abf763556f6..918daeb3483ad5e91f85ded2ce2f34916525bfe4 100644 (file)
@@ -1915,6 +1915,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index d47b808862f4b02a416f8b717cc99a1451793ea4..c9e534cf8bcdbebedab06cb5ec0553227e7d5cae 100644 (file)
@@ -125,6 +125,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0x98
 GLIBC_2.4 _IO_2_1_stdin_ D 0x98
index d5e38308be84b567793139d4222a1bdbbab22c07..c8e70be87672af1eb9fc91f0a9eedff0b298c66b 100644 (file)
@@ -1990,6 +1990,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index 8596b843990d3cfd990138e48994e9de7c989c27..e356ec6d33e3d778fc825ebae3b17226bf81b1f0 100644 (file)
@@ -2131,3 +2131,4 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
index 88e0f896d59f59d66dc915b67cf95bae751a4780..3154251d25d7ce3f9f2fa9b6d05bb6d00b24904c 100644 (file)
@@ -1968,6 +1968,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index aff7462c34683c4f7a2812887b6f9fc41949ab6d..e9445adf1451acf2fe2fd2523406fbcea7c1b948 100644 (file)
@@ -1966,6 +1966,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index 71d82444aa9c9319dd3a8a24744aa4bdad19b26c..4043077bc39fa610c8f31740a2459535f0c7272a 100644 (file)
@@ -1974,6 +1974,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index de6c53d293d14b82231486c0cf7ec557e47e765c..e47cb434dcd1d380ce67f5e9774637a3a2f8e3f4 100644 (file)
@@ -1969,6 +1969,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index e724bab9fb2dff4bbf821e3cd15d5133ef255e91..024c55f29ec43fc52970e580d561030a7e29f93a 100644 (file)
@@ -2172,3 +2172,4 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
index e9ecbccb715b5b6cc8bae72c1cce8a9db88220f6..5c26044f5ee6b3676cb48a7c11b93ff8902b7293 100644 (file)
@@ -1994,6 +1994,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index da83ea602838ff1d8a1ada394a6a9d638813f049..a12e7b670890367805c5326280e5f5cb46cc099c 100644 (file)
@@ -1998,6 +1998,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index 4535b40d1516dbcf89a1b7fa666a13c49fc07495..939978e2af2c914cdf9324e740279e38ac7fe323 100644 (file)
@@ -2229,3 +2229,4 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
index 65725de4f0aecce602fd95f199953811f9504f4c..82f5aeed339100db1f9828cc0eb9c6f61939c114 100644 (file)
@@ -124,6 +124,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 _Exit F
 GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
 GLIBC_2.3 _IO_2_1_stdin_ D 0xe0
index bbb3c4a8e71843cc80ad4ca77c180c0f797df55c..9e7c904d2cfdad3981a8e131cd4285bfaea3aee4 100644 (file)
@@ -2101,3 +2101,4 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
index e85ac2a1787080c33f9c100156ba4b07a650a0c9..f4a52b543af10a859f69b52d61c31d554c583cb1 100644 (file)
@@ -2003,6 +2003,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index d56931022cf4d67f2bf17f4b49f2a5f65f234d4f..8d8a4035bb758d71144e2dcd207be93f3978d58e 100644 (file)
@@ -1909,6 +1909,7 @@ GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __fentry__ F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index ff939a15c4c40f9529414591184243258023e904..5c055558422f574df837a571a24b11f2013842eb 100644 (file)
@@ -1885,6 +1885,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index 64fa9e10a554921f6f4b9de81186d88a44cd1cd2..4d4e972d588ffbcf394ef05da52108751aa61535 100644 (file)
@@ -1997,6 +1997,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index db909d150607a684a5cc8e1fe37f99c03167aaad..96ad7b83258df891ac2904ddeb1fb0bae046c97e 100644 (file)
@@ -1938,6 +1938,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index dbb6cdd5f0d5ec247de5cbf37161d387a37ba514..a93382f19a91bf22bf000ec00b6ab5739b72e91e 100644 (file)
@@ -263,6 +263,11 @@ __spawni_child (void *arguments)
              if (__chdir (action->action.chdir_action.path) != 0)
                goto fail;
              break;
+
+           case spawn_do_fchdir:
+             if (__fchdir (action->action.fchdir_action.fd) != 0)
+               goto fail;
+             break;
            }
        }
     }
index 3b175f104b2a7632b5c8001e8de833a780534d82..52e65c50206a76558e9c357e9b9d38873c43dde0 100644 (file)
@@ -1896,6 +1896,7 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
index 1b57710477464aeb4c0d2229b79d4b769c206c31..dccc15bb67d158fcfc6da6dfa6cb1773d6f0a461 100644 (file)
@@ -2147,3 +2147,4 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
+GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F