djm408@tijc02.UUCP (03/11/87)
My company is working on a product that could run out of file descriptors. We are using System V Release 2.2. We would like to increase the number of file descriptors available to each process. I looked through the source code and determined that the file descriptor table is an array 'NOFILE' in size. NOFILE is set to 20 in /usr/include/sys/param.h. If we recompile the kernel with NOFILE set to say 40, how would we be affecting the rest of the system? What subtle (or not so subtle) problems would we create in doing this? Has anybody done this before? Thanx in advance for any reponses. David J. Marks M. S. 3520 Texas Instruments Erwin Highway P. O. Drawer 1255 Johnson City, TN 37605-1255 mcnc!rti-sel!tijc02!djm408
henry@utzoo.UUCP (Henry Spencer) (03/17/87)
> ... If we recompile the kernel with > NOFILE set to say 40, how would we be affecting the rest of the system? Unless SVR2.2 has added something interesting, which I doubt but can't quickly check on, the kernel won't be hurt. An awful lot of programs want to close all file descriptors and have the number "20" wired in, either as a named constant from param.h or simply a literal number. If all the code you write that actually uses those extra descriptors is careful to always close them before doing an exec(), shouldn't be much of a problem. -- "We must choose: the stars or Henry Spencer @ U of Toronto Zoology the dust. Which shall it be?" {allegra,ihnp4,decvax,pyramid}!utzoo!henry
rml@hpfcdc.UUCP (03/26/87)
> If we recompile the kernel with > NOFILE set to say 40, how would we be affecting the rest of the system? What > subtle (or not so subtle) problems would we create in doing this? You need to recompile not only the kernel but various utilities (ps, debuggers, fuser, possibly others) that include <sys/user.h> or have other dependencies on NOFILE. If you want to be able to use stdio with more than 20 files, you'll need to recompile it. > Answer: Ack! > > I am not sure about system V but I always store my > file descripters in a single (int). This means > that my software can handle only 32 file descripters. Then this code is not portable. Many implementations allow more than 32 file descriptors. > As I recall, 4.2 also used 5 bits for the file descriptor in an > important place, which is why changing the number was a problem. Actually the 5 bit representation was only for the unimplemented file-mapping feature. Select did use a 32-bit int as a file descriptor mask in 4.2, and this was changed in 4.3. Bob Lenk {ihnp4, hplabs}!hpfcla!rml