Subject: Re: can't fork but what's short?
To: None <current-users@NetBSD.ORG>
From: Simon J. Gerraty <sjg@zen.void.oz.au>
List: current-users
Date: 04/20/1995 23:59:57
I wrote...

> Several times today fork has failed due to some anonymous resource
> shortage. But there are only 17 pty's in use, 74 processes running,
> and pstat et al suggest no shortages:

As some kind folk pointed out - firing up csh and typing 'limit'
revealed that I was only allowed 40 processes.

Ok, I finally got some time to have a look around and found that
MAXUPROC is set via CHILD_MAX (defined in sys/syslimits.h)  but short
of editing that file there seems no way to modify MAXUPROC.

I figured I'd rather be able to configure it in my kernel config
(if not on the fly...)  so a simple #ifndef in syslimits.h and:

options		CHILD_MAX="(maxproc / 2)"	# sets MAXUPROC

in my config and I'm now allowed 500+ processes.

Here are the diffs for those who feel a bit cramped...

===================================================================
RCS file: /local/src/master/usr.src/sys/sys/syslimits.h,v
retrieving revision 1.1.1.1
diff -c -b -r1.1.1.1 syslimits.h
*** syslimits.h	1995/04/13 04:37:12	1.1.1.1
--- syslimits.h	1995/04/20 11:53:48
***************
*** 37,43 ****
--- 37,45 ----
  
  #if !defined(_ANSI_SOURCE)
  #define	ARG_MAX		 (256 * 1024)	/* max bytes for an exec function */
+ #ifndef CHILD_MAX
  #define	CHILD_MAX		   40	/* max simultaneous processes */
+ #endif
  #define	LINK_MAX		32767	/* max file link count */
  #define	MAX_CANON		  255	/* max bytes in term canon input line */
  #define	MAX_INPUT		  255	/* max bytes in terminal input */