From owner-freebsd-questions Thu Apr 25 15:55:39 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA17613 for questions-outgoing; Thu, 25 Apr 1996 15:55:39 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id PAA17598 for ; Thu, 25 Apr 1996 15:55:34 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id PAA25666; Thu, 25 Apr 1996 15:50:44 -0700 From: Terry Lambert Message-Id: <199604252250.PAA25666@phaeton.artisoft.com> Subject: Re: Limit of number of open files for a process? To: trig@netlink.co.uk (Christiaan Keet) Date: Thu, 25 Apr 1996 15:50:44 -0700 (MST) Cc: freebsd-questions@FreeBSD.ORG In-Reply-To: from "Christiaan Keet" at Apr 25, 96 07:12:06 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > Is there a limit to the number of open files that one process can have at > any one time? > > I'm just switching over to FreeBSD from Linux where I experienced this > problem in that it limits you to 256 open files per process :( > Can this limit be set in FreeBSD? And if so... what is the top limit? Yes. There is a hard limit and there is a soft limit. The soft limit can be changed by using the "limit" or "unlimit" or other shell-specific command, since the program inherits the value from the shell (process) from which it is run. The Hard limit (and soft limit defaults, for daemons, etc.) require you to recompile the kernel after modifying header files. NB: the header file limits are there for a reason for most limits, like physical page table entries and fixed size kernel structure; the per process open file table limit is there because the BASH shell starts at the end of limit space and works back to avoid fd collisions instead of Doing The Right Thing and changing the fd used to open the shell script file *when* the collision actually occurs. Read /sys/i386/conf/LINT for details. The top limit is limited by memory. NB2: If you are using buffered I/O (stdio's 'f' functions, like "fopen" instead of "open", "fread" instead of "read", etc.), stdio has traditionally been limited to using 256 file descriptors. This is why most server programs do *not* use stdio. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.