Process Control
Peter Jeremy
PeterJeremy at optushome.com.au
Tue Mar 22 23:21:22 PST 2005
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
More information about the freebsd-hackers
mailing list