On 6/10/23 12:13, Sergey Bugaev wrote:
O_IGNORE_CTTY is not about
acquiring a ctty if you don't yet have one (that never happens
implicitly on the Hurd), but about (re)opening your current ctty.
OK, I'm starting to see the distinction now.
I don't know whether any programs actually care about this ctty
feature. Presumably users care? -- as I understand it, this is
intended to be used with job control in the shell
If so, it's a well-kept secret, as Bash doesn't use O_IGNORE_CTTY.
The only program I know of that uses O_IGNORE_CTTY is Emacs, and it's
for what appears to be relatively minor optimization when it is opening
a file that is a tty. On non-Hurd platforms Emacs instead uses setsid to
remove the controlling tty entirely (since the notion of controlling
terminal doesn't mix well with how Emacs operates).