On Thu, 19 Sep 2002, Andries Brouwer wrote:
> > Which means that if the tty is going away, it has to be removed from _all_
> > tasks, not just from the one session that happened to be the most recent
> > one.
> [POSIX 1003.1-2001]
Gaah. Good that somebody else has the energy to actually read the
standards instead of just trying to desperately remember some dusty
> The controlling terminal is inherited by a child process during a fork()
> function call. A process relinquishes its controlling terminal when it creates
> a new session with the setsid() function; other processes remaining in the
> old session that had this terminal as their controlling terminal continue
> to have it.
Well, that certainly clinches the fact that the controlling terminal _can_
and does continue to be hold by processes outside the current session
I suspect that to handle controlling terminals efficiently (ie without
iterating over all tasks), the "current->tty" thing needs to be expanded
with a linked list of processes sharing the tty or something (probably
with the head of the list being in the tty structure itself).
On the other hand, I don't think it necessarily is a problem to walk all
threads either - the controlling terminal changes should be rare, and this
is O(n) rather than some quadratic or other behaviour.
Anyway, that seems to make Ingo's patch wrong for this case at least.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to email@example.com
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon Sep 23 2002 - 22:00:26 EST