*BSD News Article 51573


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.sprintlink.net!sundog.tiac.net!kolvir.arlington.ma.us!jtk
From: jtk@kolvir.arlington.ma.us (John Kohl)
Newsgroups: comp.unix.bsd.netbsd.misc
Subject: Re: Number of max available file descriptors?
Date: 20 Sep 1995 03:41:29 GMT
Organization: NetBSD Kernel Hackers `R` Us
Lines: 28
Message-ID: <43o2h9$6ob@sundog.tiac.net>
References: <43kj47$2q8@nntp.Stanford.EDU>
	<MICHAELV.95Sep18163106@MindBender.HeadCandy.com>
NNTP-Posting-Host: jtk.tiac.net
In-reply-to: michaelv@MindBender.HeadCandy.com's message of 18 Sep 1995
	23:31:06 GMT

>>>>> "Michael" == Michael L VanLoon <michaelv@MindBender.HeadCandy.com> writes:
In article <MICHAELV.95Sep18163106@MindBender.HeadCandy.com> michaelv@MindBender.HeadCandy.com (Michael L. VanLoon) writes:


Michael> In article <43kj47$2q8@nntp.Stanford.EDU> fangchin@jessica.Stanford.EDU (Chin Fang) writes:
Michael>    One of our heavily used SS2 running SunOS 4.1.3U1B kept running out
Michael>    file descriptors when certain jobs were running.  We fixed it for the
Michael>    time being by hacking the code and adding in a setrlimit() to get
Michael>    the max from SunOS everytime these jobs are run.  

Michael> That is one correct way to fix it.

Just be careful if you raise it above 256 and want to use programs which
call select.

By default, the fd_set type only has enough bits for 256 file
descriptors.  If you pass a higher file descriptor into precompiled code
that wants to diddle fd_set bits, you may end up with trashed memory near
your fd_sets.

This problem is endemic to all modern unices I've run across--anything
in library code which uses fd_set just doesn't work well if you use lots
and lots of file descriptors and ask the library code to manipulate them
for you.

See <sys/types.h>.
-- 
John Kohl <jtk@tiac.net> or <jtk@kolvir.arlington.ma.us>