Messages in this thread | | | From | Malcolm Beattie <> | Subject | Re: Problems raising fd limits in 1.3.78-1.3.80 | Date | Wed, 3 Apr 1996 10:27:12 +0100 (BST) |
| |
Stephen Tweedie writes: > (we probably don't want to change > the fd table size dynamically on existing processes).
OSF/1 does this as follows:
struct file *uf_ofile[NOFILE_IN_U];/* file structs of open files */ char uf_pofile[NOFILE_IN_U]; /* per-process flags of open files */ int uf_lastfile; /* high-water mark of uf_ofile */ /* * If greater than NOFILE_IN_U file descriptors are allocated, * uf_ofile_of and uf_pofile_of are used to reference the KALLOC'ed * buffers which store the additional entries. */ u_int uf_of_count; struct file **uf_ofile_of; /* Pointer to KALLOC'ed buffer */ char *uf_pofile_of; /* Pointer to KALLOC'ed buffer */
NOFILE_IN_U is 64 so you have 64 descriptors available directly in the struct utask. Further ones (up to a configurable systemwide max of default 4096) are dynamically allocated in chunks and hang off of_ofile_of. uf_pofile[] and uf_ofile handle per-file flags by having one char for each file rather than the bit field that Linux uses even at kernel level in struct files_struct. OSF/1 <sys/select.h> says /* * Select uses bit masks of file descriptors in longs. * These macros manipulate such bit fields (the filesystem macros use chars). * FD_SETSIZE may be defined by the user, but the default here is equal * to OPEN_MAX_SYSTEM in param.h since that defines the absolute maximum * number of file descriptors that a process can open. */ /* We don't really want to include all of limits.h to get the real value of this, so we leave this ugly constant here */ #define NBBY 8 /* number of bits in a byte */ #define MAX_NOFILE 4096 #ifndef FD_SETSIZE #define FD_SETSIZE MAX_NOFILE #endif
so the default is for 4096 bits but the programmer can set FD_SETSIZE manually if desperate for a smaller fd_set.
--Malcolm
-- Malcolm Beattie <mbeattie@sable.ox.ac.uk> Unix Systems Programmer Oxford University Computing Services
| |