Help with limiting the number of user Processes

George Robbins grr at cbmvax.UUCP
Tue Nov 21 16:16:53 AEST 1989


In article <122 at cutmcvax.OZ> craig at cutmcvax.oz (Craig Farrell) writes:
> 
>  Dear Ultrix'ers,
> 
> 	Thankyou for all the replies on limiting the number of processes
> a user process can have, however just changing MAXUPROC is not enough.
> We would like to be able to restrict the processes on a per-user basis,
> so some people can fork off as many processes as the like while others
> can be restricted to a particular number of processes. 

You neglect to mention whether or not you have source.  If you are willing
to have the decision based on something simple like having the maxuprc
limit not apply to users with gid < 100 or with even uids or some other
kludge, the changes are trivial. 

Go to the module /sys/src/sys/kern_fork.c and in the routine fork1() find
a line that looks something like:  (i.e. has a reference to maxuprc)

	if (p2==NULL || (u.u_uid!=0 && (p2==procNPROC-1 || a>maxuprc))) {

and change the "a>maxuproc" to something like "(a>maxuproc && u.u_gid>=100)"

A more sophisticate approach would be to look a the list of groups that
the user belongs to and use the presence of group 13 or something similar
to indicate whether the limit applies, since this would be more dynamic.

If you don't have source, you can still patch the routine fork1, but this
get's a bit more painful.

-- 
George Robbins - now working for,	uucp: {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr at uunet.uu.net
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)



More information about the Comp.unix.ultrix mailing list