Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Mar 2005 18:21:12 +1100
From:      Peter Jeremy <PeterJeremy@optushome.com.au>
To:        Alan Milford <alz@evilalz.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Process Control
Message-ID:  <20050323072112.GA41591@cirb503493.alcatel.com.au>
In-Reply-To: <42408763.7010106@evilalz.net>
References:  <42408763.7010106@evilalz.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050323072112.GA41591>