From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 23 07:21:22 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E8A716A4CE for ; Wed, 23 Mar 2005 07:21:22 +0000 (GMT) Received: from mail15.syd.optusnet.com.au (mail15.syd.optusnet.com.au [211.29.132.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 971C943D5F for ; Wed, 23 Mar 2005 07:21:21 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) j2N7LE6W030932 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Wed, 23 Mar 2005 18:21:15 +1100 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])j2N7LD7l041678; Wed, 23 Mar 2005 18:21:14 +1100 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost)j2N7LCFM041677; Wed, 23 Mar 2005 18:21:12 +1100 (EST) (envelope-from pjeremy) Date: Wed, 23 Mar 2005 18:21:12 +1100 From: Peter Jeremy To: Alan Milford Message-ID: <20050323072112.GA41591@cirb503493.alcatel.com.au> References: <42408763.7010106@evilalz.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42408763.7010106@evilalz.net> User-Agent: Mutt/1.4.2i cc: freebsd-hackers@freebsd.org Subject: Re: Process Control X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2005 07:21:22 -0000 On Tue, 2005-Mar-22 21:00:19 +0000, Alan Milford wrote: [Separate per-user limits on foreground and background processes] >The best way I could come up with doing this kernel-side is by watching >a process' P_CONTROLT flag when a process is created (or tries to fork). >If the process had the flag, I assumed it to be foreground, if not, >background. I don't think this will achieve what you want. Consider a standard user shell which will be in the foreground attached to the user's TTY (and therefore have P_CONTROLT). Irrespective of whether the user enters "foo" or "foo&", the shell will call fork(). The "&" just controls what happens _after_ the fork() - if it's a foreground process then the child exec's foo and the parent (normally]) just does a wait(). If it's a background process, the child will (normally) juggle termios TTIN and TTOUT parameters then exec foo, the parent writes another prompt and waits for input. Unfortunately, I can't think of any way to do what you want. -- Peter Jeremy