supporting terminal ownership assignment (tcsetpgrp()) in posix_spawn

Godmar Back godmar@gmail.com
Thu Jun 3 13:58:06 GMT 2021


I've recently been playing with posix_spawn() and noticed that it lacks
support for assigning terminal ownership (as would be done via
tcsetpgrp()). As a consequence, it cannot be used for job control shells
when starting jobs in the foreground [1].

IBM's implementation of spawn [2] for zOS supports SPAWN_SETTCPGRP for this
reason.

Even though the POSIX spec states "Future Directions: None" I came across
this Austin group issue [3] which proposes to add a way to set the child
process's session id, and which appears to have been accepted in 2016. This
is an example of evolution of posix_spawn.

Is anyone aware of efforts to add something similar to POSIX, and more
specifically, to Linux?

If the current implementation of posix_spawn is library based (I'm guessing
it is) then there would be nothing to prevent Linux from adding additional
flags, just like QNX or Blackberry have already done ([3]).

 - Godmar

[1]
https://github.com/fish-shell/fish-shell/commit/5e371e8fe7cbdecd87678d50d06c12851213776e
[2]
https://www.ibm.com/docs/en/zos/2.2.0?topic=functions-spawn-spawnp-spawn-new-process
[3] https://www.austingroupbugs.net/view.php?id=1044


More information about the Libc-help mailing list