tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Reparenting processes?



On Sun 10 Jan 2021 at 09:44:18 -0500, Mouse wrote:
> >> This makes me wonder if perhaps login sessions should have their
> >> stdin/stdout/stderr set up on /dev/tty instead of the actual ctty
> >> device.  But if that's done, will the `real' ctty device even be
> >> open?  [...]
> 
> It actually occurs to me that this is a potential problem even today:
> what happens if all the processes in a session close the descriptors
> they have on the ctty, and there are no others lying around in other

or similarly, if they TIOCNOTTY it (although tty(4) tells me it's
obsolete)

> processes, and then one of those processes tries to access /dev/tty?
> It would be an unusual session, true, but there's nothing preventing it
> from happening as far as I can see.  Would the underlying tty driver
> explode upon getting I/O calls when it isn't open, or what?

I think sys/kern/tty_tty.c is the implementation of /dev/tty, and it
seems you get ENXIO. Also each read/write call goes to the *current*
controlling tty, freshly looked up.

> /~\ The ASCII				  Mouse
-Olaf.
-- 
Olaf 'Rhialto' Seibert -- rhialto at falu dot nl
___  Anyone who is capable of getting themselves made President should on
\X/  no account be allowed to do the job.       --Douglas Adams, "THGTTG"

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index