* On Linux, the epoll_pwait2 function has been added. It is similar to
epoll_wait with the difference the timeout has nanoseconds resolution.
-* The functions posix_spawnattr_tcsetpgrp_np and posix_spawnattr_tcgetpgrp_np
- have been added, enabling posix_spawn and posix_spawnp to set the
- controlling terminal in the new process in a race free manner. These
- functions are GNU extensions.
+* The function posix_spawn_file_actions_addtcsetpgrp_np has been added,
+ enabling posix_spawn and posix_spawnp to set the controlling terminal in
+ the new process in a race free manner. This function is a GNU extension.
* Source fortification (_FORTIFY_SOURCE) level 3 is now available for
applications compiling with glibc and gcc 12 and later. Level 3 leverages
spawn_faction_addopen spawn_faction_adddup2 spawn_valid_fd \
spawn_faction_addchdir spawn_faction_addfchdir \
spawn_faction_addclosefrom \
+ spawn_faction_addtcsetpgrp_np \
spawnattr_init spawnattr_destroy \
spawnattr_getdefault spawnattr_setdefault \
spawnattr_getflags spawnattr_setflags \
spawnattr_getpgroup spawnattr_setpgroup spawn spawnp spawni \
spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
- spawnattr_tcgetpgrp spawnattr_tcsetpgrp \
posix_madvise \
get_child_max sched_cpucount sched_cpualloc sched_cpufree \
streams-compat \
posix_spawn_file_actions_addclosefrom_np;
}
GLIBC_2.35 {
- posix_spawnattr_tcgetpgrp_np;
- posix_spawnattr_tcsetpgrp_np;
+ posix_spawn_file_actions_addtcsetpgrp_np;
}
GLIBC_PRIVATE {
__libc_fork; __libc_pread; __libc_pwrite;
sigset_t __ss;
struct sched_param __sp;
int __policy;
- int __ctty_fd;
- int __pad[15];
+ int __pad[16];
} posix_spawnattr_t;
#ifdef __USE_GNU
# define POSIX_SPAWN_USEVFORK 0x40
# define POSIX_SPAWN_SETSID 0x80
-# define POSIX_SPAWN_TCSETPGROUP 0x100
#endif
__restrict __schedparam)
__THROW __nonnull ((1, 2));
-#ifdef __USE_GNU
-/* Make the spawned process the foreground process group on the terminal
- associated with FD (which must be a controlling terminal, and still be
- associated with its session). */
-extern int posix_spawnattr_tcsetpgrp_np (posix_spawnattr_t *__attr, int fd)
- __THROW __nonnull ((1));
-
-/* Return the associated terminal FD in the attribute structure. */
-extern int posix_spawnattr_tcgetpgrp_np (const posix_spawnattr_t *
- __restrict __attr, int *fd)
- __THROW __nonnull ((1, 2));
-#endif
-
/* Initialize data structure for file attribute for `spawn' call. */
extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *
__file_actions)
int __from)
__THROW __nonnull ((1));
+/* Add an action to set the process group of the forground process group
+ associated with the terminal TCFD. */
+extern int
+posix_spawn_file_actions_addtcsetpgrp_np (posix_spawn_file_actions_t *,
+ int __tcfd)
+ __THROW __nonnull ((1));
+
#endif
__END_DECLS
--- /dev/null
+/* Add tcsetpgrp to the file action list for posix_spawn.
+ Copyright (C) 2022 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <spawn.h>
+#include <unistd.h>
+#include <spawn_int.h>
+
+int
+__posix_spawn_file_actions_addtcsetpgrp_np (posix_spawn_file_actions_t
+ *file_actions, int tcfd)
+{
+ struct __spawn_action *rec;
+
+ if (!__spawn_valid_fd (tcfd))
+ return EBADF;
+
+ /* Allocate more memory if needed. */
+ if (file_actions->__used == file_actions->__allocated
+ && __posix_spawn_file_actions_realloc (file_actions) != 0)
+ /* This can only mean we ran out of memory. */
+ return ENOMEM;
+
+ /* Add the new value. */
+ rec = &file_actions->__actions[file_actions->__used];
+ rec->tag = spawn_do_tcsetpgrp;
+ rec->action.setpgrp_action.fd = tcfd;
+
+ /* Account for the new entry. */
+ ++file_actions->__used;
+
+ return 0;
+}
+weak_alias (__posix_spawn_file_actions_addtcsetpgrp_np,
+ posix_spawn_file_actions_addtcsetpgrp_np)
case spawn_do_dup2:
case spawn_do_fchdir:
case spawn_do_closefrom:
+ case spawn_do_tcsetpgrp:
/* No cleanup required. */
break;
}
spawn_do_chdir,
spawn_do_fchdir,
spawn_do_closefrom,
+ spawn_do_tcsetpgrp
} tag;
union
{
int from;
} closefrom_action;
+ struct
+ {
+ int fd;
+ } setpgrp_action;
} action;
};
| POSIX_SPAWN_SETSCHEDPARAM \
| POSIX_SPAWN_SETSCHEDULER \
| POSIX_SPAWN_SETSID \
- | POSIX_SPAWN_USEVFORK \
- | POSIX_SPAWN_TCSETPGROUP)
+ | POSIX_SPAWN_USEVFORK)
/* Store flags in the attribute structure. */
int
+++ /dev/null
-/* Get the controlling terminal option.
- Copyright (C) 2022 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
- <https://www.gnu.org/licenses/>. */
-
-#include <spawn.h>
-
-int
-posix_spawnattr_tcgetpgrp_np (const posix_spawnattr_t *attr, int *fd)
-{
- *fd = attr->__ctty_fd;
- return 0;
-}
+++ /dev/null
-/* Set the controlling terminal option.
- Copyright (C) 2022 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
- <https://www.gnu.org/licenses/>. */
-
-#include <spawn.h>
-
-int
-posix_spawnattr_tcsetpgrp_np (posix_spawnattr_t *attr, int fd)
-{
- attr->__ctty_fd = fd;
- return 0;
-}
#include <support/check.h>
#include <support/xunistd.h>
#include <sys/wait.h>
+#include <stdlib.h>
static int
-handle_restart (const char *argv1)
+handle_restart (const char *argv1, const char *argv2)
{
- int fd = xopen (_PATH_TTY, O_RDONLY, 0600);
-
/* If process group is not changed (POSIX_SPAWN_SETPGROUP), then check
the creating process one, otherwise check against the process group
itself. */
TEST_VERIFY (pgid != pgrp);
}
- TEST_COMPARE (tcgetpgrp (fd), pgrp);
+ char *endptr;
+ long int tcfd = strtol (argv2, &endptr, 10);
+ if (*endptr != '\0' || tcfd > INT_MAX)
+ FAIL_EXIT1 ("invalid file descriptor name: %s", argv2);
+ if (tcfd != -1)
+ {
+ TEST_COMPARE (fcntl (tcfd, F_GETFD), -1);
+ TEST_COMPARE (errno, EBADF);
+ }
+ int fd = xopen (_PATH_TTY, O_RDONLY, 0600);
+ TEST_COMPARE (tcgetpgrp (fd), pgrp);
xclose (fd);
+
return 0;
}
static void
run_subprogram (int argc, char *argv[], const posix_spawnattr_t *attr,
+ const posix_spawn_file_actions_t *actions, int tcfd,
int exp_err)
{
short int flags;
bool setpgrp = flags & POSIX_SPAWN_SETPGROUP;
char *spargv[9];
+ TEST_VERIFY_EXIT (((argc - 1) + 4) < array_length (spargv));
char pgrp[INT_STRLEN_BOUND (pid_t)];
+ char tcfdstr[INT_STRLEN_BOUND (int)];
int i = 0;
for (; i < argc - 1; i++)
snprintf (pgrp, sizeof pgrp, "%d", getpgrp ());
spargv[i++] = pgrp;
}
+ snprintf (tcfdstr, sizeof tcfdstr, "%d", tcfd);
+ spargv[i++] = tcfdstr;
spargv[i] = NULL;
- TEST_VERIFY_EXIT (i < array_length (spargv));
pid_t pid;
- TEST_COMPARE (posix_spawn (&pid, argv[1], NULL, attr, spargv, environ),
+ TEST_COMPARE (posix_spawn (&pid, argv[1], actions, attr, spargv, environ),
exp_err);
if (exp_err != 0)
return;
*/
if (restart)
- return handle_restart (argv[1]);
+ return handle_restart (argv[1], argv[2]);
- int tcfd = xopen (_PATH_TTY, O_RDONLY, 0600);
+ int tcfd = open64 (_PATH_TTY, O_RDONLY, 0600);
+ if (tcfd == -1)
+ {
+ if (errno == ENXIO)
+ FAIL_UNSUPPORTED ("terminal not available, skipping test");
+ FAIL_EXIT1 ("open64 (\"%s\", 0x%x, 0600): %m", _PATH_TTY, O_RDONLY);
+ }
- /* Check getters and setters. */
+ /* Check setting the controlling terminal without changing the group. */
{
posix_spawnattr_t attr;
TEST_COMPARE (posix_spawnattr_init (&attr), 0);
- TEST_COMPARE (posix_spawnattr_tcsetpgrp_np (&attr, tcfd), 0);
+ posix_spawn_file_actions_t actions;
+ TEST_COMPARE (posix_spawn_file_actions_init (&actions), 0);
+ TEST_COMPARE (posix_spawn_file_actions_addtcsetpgrp_np (&actions, tcfd),
+ 0);
- int fd;
- TEST_COMPARE (posix_spawnattr_tcgetpgrp_np (&attr, &fd), 0);
- TEST_COMPARE (tcfd, fd);
+ run_subprogram (argc, argv, &attr, &actions, -1, 0);
}
- /* Check setting the controlling terminal without changing the group. */
+ /* Check setting both the controlling terminal and the create a new process
+ group. */
{
posix_spawnattr_t attr;
TEST_COMPARE (posix_spawnattr_init (&attr), 0);
- TEST_COMPARE (posix_spawnattr_setflags (&attr, POSIX_SPAWN_TCSETPGROUP),
+ TEST_COMPARE (posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETPGROUP), 0);
+ posix_spawn_file_actions_t actions;
+ TEST_COMPARE (posix_spawn_file_actions_init (&actions), 0);
+ TEST_COMPARE (posix_spawn_file_actions_addtcsetpgrp_np (&actions, tcfd),
0);
- TEST_COMPARE (posix_spawnattr_tcsetpgrp_np (&attr, tcfd), 0);
- run_subprogram (argc, argv, &attr, 0);
+ run_subprogram (argc, argv, &attr, &actions, -1, 0);
}
- /* Check setting both the controlling terminal and the create a new process
- group. */
+ /* Same as before, but check if the addclose file actions closes the terminal
+ file descriptor. */
{
posix_spawnattr_t attr;
TEST_COMPARE (posix_spawnattr_init (&attr), 0);
- TEST_COMPARE (posix_spawnattr_setflags (&attr, POSIX_SPAWN_TCSETPGROUP
- | POSIX_SPAWN_SETPGROUP),
+ TEST_COMPARE (posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETPGROUP), 0);
+ posix_spawn_file_actions_t actions;
+ TEST_COMPARE (posix_spawn_file_actions_init (&actions), 0);
+ TEST_COMPARE (posix_spawn_file_actions_addtcsetpgrp_np (&actions, tcfd),
0);
- TEST_COMPARE (posix_spawnattr_setpgroup (&attr, 0), 0);
- TEST_COMPARE (posix_spawnattr_tcsetpgrp_np (&attr, tcfd), 0);
+ TEST_COMPARE (posix_spawn_file_actions_addclose (&actions, tcfd), 0);
- run_subprogram (argc, argv, &attr, 0);
+ run_subprogram (argc, argv, &attr, &actions, tcfd, 0);
}
/* Trying to set the controlling terminal after a setsid incurs in a ENOTTY
{
posix_spawnattr_t attr;
TEST_COMPARE (posix_spawnattr_init (&attr), 0);
- TEST_COMPARE (posix_spawnattr_setflags (&attr, POSIX_SPAWN_TCSETPGROUP
- | POSIX_SPAWN_SETSID), 0);
- TEST_COMPARE (posix_spawnattr_tcsetpgrp_np (&attr, tcfd), 0);
+ TEST_COMPARE (posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSID), 0);
+ posix_spawn_file_actions_t actions;
+ TEST_COMPARE (posix_spawn_file_actions_init (&actions), 0);
+ TEST_COMPARE (posix_spawn_file_actions_addtcsetpgrp_np (&actions, tcfd),
+ 0);
- run_subprogram (argc, argv, &attr, ENOTTY);
+ run_subprogram (argc, argv, &attr, &actions, -1, ENOTTY);
}
xclose (tcfd);
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 close_range F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
if (!err && (flags & POSIX_SPAWN_SETPGROUP) != 0)
err = __proc_setpgrp (proc, new_pid, attrp->__pgrp);
- /* Set the controlling terminal. */
- if (!err && (flags & POSIX_SPAWN_TCSETPGROUP) != 0)
- {
- pid_t pgrp;
- /* Check if it is possible to avoid an extra syscall. */
- if ((attrp->__flags & POSIX_SPAWN_SETPGROUP) != 0 && attrp->__pgrp != 0)
- pgrp = attrp->__pgrp;
- else
- err = __proc_getpgrp (proc, new_pid, &pgrp);
- if (!err)
- err = __tcsetpgrp (attrp->__ctty_fd, pgrp);
- }
-
/* Set the effective user and group IDs. */
if (!err && (flags & POSIX_SPAWN_RESETIDS) != 0)
{
case spawn_do_closefrom:
err = do_closefrom (action->action.closefrom_action.from);
break;
+
+ case spawn_do_tcsetpgrp:
+ {
+ pid_t pgrp;
+ /* Check if it is possible to avoid an extra syscall. */
+ if ((attrp->__flags & POSIX_SPAWN_SETPGROUP)
+ != 0 && attrp->__pgrp != 0)
+ pgrp = attrp->__pgrp;
+ else
+ err = __proc_getpgrp (proc, new_pid, &pgrp);
+ if (!err)
+ err = __tcsetpgrp (action->action.setpgrp_action.fd, pgrp);
+ }
}
if (err)
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_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
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_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
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_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
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 posix_spawn_file_actions_adddup2 F
GLIBC_2.35 posix_spawn_file_actions_addfchdir_np F
GLIBC_2.35 posix_spawn_file_actions_addopen F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 posix_spawn_file_actions_destroy F
GLIBC_2.35 posix_spawn_file_actions_init F
GLIBC_2.35 posix_spawnattr_destroy F
GLIBC_2.35 posix_spawnattr_setschedpolicy F
GLIBC_2.35 posix_spawnattr_setsigdefault F
GLIBC_2.35 posix_spawnattr_setsigmask F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
GLIBC_2.35 posix_spawnp F
GLIBC_2.35 ppoll F
GLIBC_2.35 prctl F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 _IO_fprintf F
GLIBC_2.4 _IO_printf F
GLIBC_2.4 _IO_sprintf F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
&& __setpgid (0, attr->__pgrp) != 0)
goto fail;
- /* Set the controlling terminal. */
- if ((attr->__flags & POSIX_SPAWN_TCSETPGROUP) != 0)
- {
- /* Check if it is possible to avoid an extra syscall. */
- pid_t pgrp = (attr->__flags & POSIX_SPAWN_SETPGROUP) != 0
- && attr->__pgrp != 0
- ? attr->__pgrp : __getpgid (0);
- if (__tcsetpgrp (attr->__ctty_fd, pgrp) != 0)
- goto fail;
- }
-
/* Set the effective user and group IDs. */
if ((attr->__flags & POSIX_SPAWN_RESETIDS) != 0
&& (local_seteuid (__getuid ()) != 0
if (r != 0 && !__closefrom_fallback (lowfd, false))
goto fail;
} break;
+
+ case spawn_do_tcsetpgrp:
+ {
+ /* Check if it is possible to avoid an extra syscall. */
+ pid_t pgrp = (attr->__flags & POSIX_SPAWN_SETPGROUP) != 0
+ && attr->__pgrp != 0
+ ? attr->__pgrp : __getpgid (0);
+ if (__tcsetpgrp (action->action.setpgrp_action.fd, pgrp) != 0)
+ goto fail;
+ }
}
}
}
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F
GLIBC_2.35 __memcmpeq F
GLIBC_2.35 _dl_find_object F
GLIBC_2.35 epoll_pwait2 F
-GLIBC_2.35 posix_spawnattr_tcgetpgrp_np F
-GLIBC_2.35 posix_spawnattr_tcsetpgrp_np F
+GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F