All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Miquel van Smoorenburg" <miquels@cistron.nl>
To: linux-kernel@vger.kernel.org
Subject: Re: [patch] generic-pidhash-2.5.36-D4, BK-curr
Date: Thu, 19 Sep 2002 22:29:10 +0000 (UTC)	[thread overview]
Message-ID: <amdj3m$b69$1@ncc1701.cistron.net> (raw)
In-Reply-To: Pine.LNX.4.44.0209191324310.1277-100000@home.transmeta.com

In article <Pine.LNX.4.44.0209191324310.1277-100000@home.transmeta.com>,
Linus Torvalds  <torvalds@transmeta.com> wrote:
>
>On 19 Sep 2002, Kai Henningsen wrote:
>> 
>> On the contrary: it says that this can never happen - the new session has  
>> no controlling terminal, and can't get the old one unless the old session  
>> loses it first.
>
>Hmm.. I read it as "the tty stays with the stale group", which is
>problematic. But if all the places that set a new controlling terminal
>check that it's not already used by some other non-session then I guess 
>we're still ok..

No, it said that if a new session is created the tty stays with
the old session group which is by no means stale.

A session leader cannot create a new session, since the session-id
is the pid of the leader. Only children can create a new session,
and at that point the tty is not the controlling tty of the
_newly created_ session. Ofcourse the original session still
exists, and the tty is still the controlling tty of that session.

Only if the new session leader opens a tty that hasn't been
associated with a session yet will it become the controlling
tty of that session.

So to assocciate a tty with another session, you'll have to
disassociate it with the existing session by a) killing all
processes in the session or b) calling TIOCNOTTY. Then another
session can open it and it will become the controlling tty
of the other session (if it didn't have a controlling tty
yet, that is!)

A session can also steal away a controlling tty from another
session by using TIOCSCTTY (if its root) but the tty will
first be disassociated from the old session and only then
will it become the controlling tty of the stealing session.

See drivers/char/tty_io.c::tiocsctty() for how it loops
over all tasks to do this ..

Mike.


  reply	other threads:[~2002-09-19 22:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.44.0209182101150.27697-100000@localhost.localdomain>
2002-09-19  2:54 ` [patch] generic-pidhash-2.5.36-D4, BK-curr Ingo Molnar
2002-09-19  6:10   ` Linus Torvalds
2002-09-19  9:25     ` Ingo Molnar
2002-09-19 10:59       ` William Lee Irwin III
2002-09-19 15:12         ` Linus Torvalds
2002-09-19 15:21           ` Ingo Molnar
2002-09-19 16:35           ` Andries Brouwer
2002-09-19 16:43             ` Linus Torvalds
2002-09-19 18:54               ` Miquel van Smoorenburg
2002-09-19 19:10               ` Kai Henningsen
2002-09-19 20:32                 ` Linus Torvalds
2002-09-19 22:29                   ` Miquel van Smoorenburg [this message]
2002-09-19 19:38               ` [patch] generic-pidhash-2.5.36-J2, BK-curr Ingo Molnar
2002-09-19 20:21                 ` Christoph Hellwig
2002-09-19 23:32                   ` Dave Jones
2002-09-19 23:46                     ` Ingo Molnar
2002-09-19 21:31                 ` Linus Torvalds
2002-09-19 21:39                   ` Ingo Molnar
2002-09-20  8:27   ` [patch] generic-pidhash-2.5.36-D4, BK-curr Oleg Drokin
2002-09-20  9:40     ` Ingo Molnar
2002-09-20 11:43       ` Oleg Drokin
2002-09-20 12:15         ` Russell King
2002-09-20 16:34         ` Ingo Molnar
2002-09-20 17:11       ` Andrew Morton
2002-09-20 13:03 Hanumanthu. H
  -- strict thread matches above, loose matches on Subject: below --
2002-09-20 13:12 Hanumanthu. H
2002-09-20 13:09 ` Oleg Drokin
2002-09-20 16:47 ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='amdj3m$b69$1@ncc1701.cistron.net' \
    --to=miquels@cistron.nl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.