[Toybox] [PATCH] setsid: document -w.

Rob Landley rob at landley.net
Fri Jan 10 21:45:37 PST 2020


On 1/10/20 6:17 PM, enh via Toybox wrote:
> -w was added recently. The change in behavior so we now always fork
> means that it's needed in more cases too: other implementations of
> setsid(1) only fork if getpgrp() != getpid(). This broke a script, which
> is what made me notice the missing help.

I can change how it works? But I thought the point is it wanted a _new_ session
leader. (You'd have to exec setsid in order to inherit the previous session
leader, is this a common thing to do? Otherwise you get a new pid...)

> This seems to have been an accidental change, and is contrary to what
> the util-linux setsid(1) man page says: "The command calls fork(2) if
> already a process group leader.  Otherwise, it executes a program
> in the current process", but whether we change our behavior or not, we
> should document the new option.

My logic was "you just ran a new command, it has a new pid, that's the common
case". If "exec setsid" is the common case, I can add another test? (Does mksh
setsid() children after fork() by default?)

Sorry, I'm unclear on what "success" looks like here with some of the stranger
inputs.

Rob



More information about the Toybox mailing list