Subject: Re: kern_fork.c - off by two error ???
To: None <peter@wonderland.org>
From: Wolfgang Solfrank <ws@tools.de>
List: current-users
Date: 02/21/1994 21:29:25
> OK, I have stared at this for ages, and it lookes like the "+" should
> be a "-". Or will someone expain I should see the pattern. It's like
> one of those dot stereorams :-)
> 
> >From kern/kern_fork.c:
> 
> 	/*
> 	 * Although process entries are dynamically entries,
> 	 * we still keep a global limit on the maximum number
> 	 * we will create.  Don't allow a nonprivileged user
> 	 * to exceed its current limit or to bring us within one
> 	 * of the global limit; don't let root exceed the limit.
> 	 * nprocs is the current number of processes,
> 	 * maxproc is the limit.
> 	 */
> 	if ((nprocs >= maxproc && uid != 0)
> 	    || nprocs >= maxproc + 1) {
> 				 ^--------- shouldn't this be "-" ???
> 		tablefull("proc");
> 		return (EAGAIN);
> 	}
> 
> I really have tried to work this out before posting, so I think I may
> be right...
> -- 
> Peter Galbavy				e-mail: P.Galbavy@wonderland.org
> Wonderland				  work: P.Galbavy@micromuse.co.uk
> 
> 	  "And you will know exactly who you are, forever,
> 		by knowing what it is that you love."
> 

If you substitute a "-" the part before the "||" would be superfluous
alltogether.

What the code does, is allow atmost maxproc processes for any user with
uid != 0, but allow one more  process for the superuser.

Hope this helps,
--
ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) +49-228-985800

------------------------------------------------------------------------------