From owner-freebsd-questions Mon Oct 28 02:25:10 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id CAA17767 for questions-outgoing; Mon, 28 Oct 1996 02:25:10 -0800 (PST) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id CAA17762 for ; Mon, 28 Oct 1996 02:25:00 -0800 (PST) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id KAA01270; Mon, 28 Oct 1996 10:53:28 +0100 From: Luigi Rizzo Message-Id: <199610280953.KAA01270@labinfo.iet.unipi.it> Subject: Re: String space limit? To: dg@root.com Date: Mon, 28 Oct 1996 10:53:27 +0100 (MET) Cc: csubl@csv.warwick.ac.uk, questions@FreeBSD.ORG In-Reply-To: <199610270648.XAA10943@root.com> from "David Greenman" at Oct 26, 96 11:47:59 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > >I've been adding a lot of stuff to my X start up script, and I've strted > > getting 'cat: No such process' errors, followed by '/kernel: execve: failed > > to allocate string space'. The cat: errors are from a shell script called > > several times at startup and occasionally later. The script seems to work > > later on - I must be running out of some temporary resource, but my shell > > limits all seem OK and I've set maxusers 30 (I'm not sure exactly how many > > processes that is, but I've had over 100.) > > > >So what eactly am I running out of, and how can I get rid of the errors? > > You should always mention which version of FreeBSD the problem pertains > to. The failure you're seeing is caused by more than 16 processes trying > to exec simultaneously and running out of a kernel resource because of it. > This failure case was eliminated in FreeBSD 2.1.5 (by adding code to block > the process until the resource becomes available), so I would guess that > you're using FreeBSD 2.1.0 or earlier. I have to fix this on a system, and cannot upgrade to 2.1.5R. I have looked at the diffs between 1.21.4.1 (2.1R) and 1.21.4.6 (I believe it is 2.1.5R). Looks like much of the difference comes from a renaming of variables; other than that, the code looks simpler. Since I am not too familiar with kernel functions, would the following work ? --- src/sys/kern/kern_exec.c 1995/08/31 10:00:43 1.21.4.1 +++ src/sys/kern/kern_exec.c 1996/06/04 02:11:37 1.21.4.6 /* * Allocate temporary demand zeroed space for argument and * environment strings */ - iparams->stringbase = (char *)vm_map_min(exec_map); - error = vm_map_find(exec_map, NULL, 0, (vm_offset_t *)&iparams->stringbase, - ARG_MAX, TRUE); - if (error) { - log(LOG_WARNING, "execve: failed to allocate string space\n"); - return (error); - } - + iparams->stringbase = (char *)kmem_alloc_wait(exec_map, ARG_MAX); if (!iparams->stringbase) { error = ENOMEM; goto exec_fail; } Thanks Luigi ==================================================================== Luigi Rizzo Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it Universita' di Pisa tel: +39-50-568533 via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 http://www.iet.unipi.it/~luigi/ ====================================================================