Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Oct 2000 20:53:27 +1000 (EST)
From:      andrew@ugh.net.au
To:        Ryan Thompson <ryan@sasknow.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Logging users out
Message-ID:  <Pine.BSF.4.21.0010302019270.7801-100000@starbug.ugh.net.au>
In-Reply-To: <Pine.BSF.4.21.0010300200220.86769-100000@ren.sasknow.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Mon, 30 Oct 2000, Ryan Thompson wrote:

> > (b) use tcgetpgrp to get the process group id of the foreground process
> > group on that tty, then with that info use libkvm to find the session
> > leader's pid and send it a SIGHUP
> 
> Why not just kill their controlling shell?

I believe that what I'm doing...the "controlling shell" would be the
session leader. The question is how to get its PID.

> Recall that "background" and "foreground" are shell concepts, not
> properties of any given process.

No they are properties of process groups. Each session can have one
foreground process group and multiple background session groups. The
foreground process group is the one that receives signals and input from
the session's controlling terminal.

> a) Kill the controlling shell.  This will leave some processes behind that

The question is how to get its PID?

> b) kill -<signal> `ps -axo user,pid | grep user | awk '{print $2}'`

I only want to grab those on the one tty but thats an easy enough
modification.

> c) /sbin/halt is pretty much guaranteed to do the trick ;-)

but sadly rather intrusive on other ttys :-)

Thanks for your help,

Andrew



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0010302019270.7801-100000>