about summary refs log tree commit diff
path: root/posix/spawn.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-01-27 10:11:30 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-02-02 08:34:16 -0300
commit6289d28d3c4e56f34830cfb011c31271ef850418 (patch)
tree32d0c4d7af2c5a6a9d293a1ea05eb0d45313e450 /posix/spawn.h
parent3f35e7d193b7ff098467996ebf85b19c41d6d86e (diff)
downloadglibc-6289d28d3c4e56f34830cfb011c31271ef850418.tar.gz
glibc-6289d28d3c4e56f34830cfb011c31271ef850418.tar.xz
glibc-6289d28d3c4e56f34830cfb011c31271ef850418.zip
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 <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'posix/spawn.h')
-rw-r--r--posix/spawn.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/posix/spawn.h b/posix/spawn.h
index 7779020250..c4a81227b0 100644
--- a/posix/spawn.h
+++ b/posix/spawn.h
@@ -34,8 +34,7 @@ typedef struct
   sigset_t __ss;
   struct sched_param __sp;
   int __policy;
-  int __ctty_fd;
-  int __pad[15];
+  int __pad[16];
 } posix_spawnattr_t;
 
 
@@ -60,7 +59,6 @@ typedef struct
 #ifdef __USE_GNU
 # define POSIX_SPAWN_USEVFORK		0x40
 # define POSIX_SPAWN_SETSID		0x80
-# define POSIX_SPAWN_TCSETPGROUP	0x100
 #endif
 
 
@@ -168,19 +166,6 @@ extern int posix_spawnattr_setschedparam (posix_spawnattr_t *__restrict __attr,
 					  __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)
@@ -235,6 +220,13 @@ posix_spawn_file_actions_addclosefrom_np (posix_spawn_file_actions_t *,
 					  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