From 6289d28d3c4e56f34830cfb011c31271ef850418 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Thu, 27 Jan 2022 10:11:30 -0300 Subject: posix: Replace posix_spawnattr_tc{get,set}pgrp_np with posix_spawn_file_actions_addtcsetpgrp_np The posix_spawnattr_tcsetpgrp_np works on a file descriptor (the controlling terminal), so it would make more sense to actually fit it on the file actions API. Also, POSIX_SPAWN_TCSETPGROUP is not really required since it is implicit by the presence of tcsetpgrp file action. The posix/tst-spawn6.c is also fixed when TTY can is not present. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- sysdeps/mach/hurd/i386/libc.abilist | 3 +-- sysdeps/mach/hurd/spawni.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'sysdeps/mach/hurd') diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 4467aeb720..4dc87e9061 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -2288,8 +2288,7 @@ GLIBC_2.34 timespec_getres F 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 diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c index bccdd013bf..f19b688411 100644 --- a/sysdeps/mach/hurd/spawni.c +++ b/sysdeps/mach/hurd/spawni.c @@ -390,19 +390,6 @@ retry: 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) { @@ -643,6 +630,19 @@ retry: 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) -- cgit 1.4.1