From owner-freebsd-hackers Mon Oct 30 2:53:32 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from starbug.ugh.net.au (starbug.ugh.net.au [203.31.238.37]) by hub.freebsd.org (Postfix) with ESMTP id D907D37B4D7 for ; Mon, 30 Oct 2000 02:53:28 -0800 (PST) Received: by starbug.ugh.net.au (Postfix, from userid 1000) id 8570DA851; Mon, 30 Oct 2000 21:53:27 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by starbug.ugh.net.au (Postfix) with ESMTP id 81E155455; Mon, 30 Oct 2000 20:53:27 +1000 (EST) Date: Mon, 30 Oct 2000 20:53:27 +1000 (EST) From: andrew@ugh.net.au To: Ryan Thompson Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Logging users out In-Reply-To: Message-ID: X-WonK: *wibble* MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 - `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