maxfiles, file table, descriptors, etc...

Terry Lambert tlambert2 at mindspring.com
Sun Apr 20 16:20:32 PDT 2003


"Kevin A. Pieckiel" wrote:
> First, do open sockets (inet or unix) or pipes (via pipe(2)) count
> against kern.maxfiles, kern.maxfilesperproc, and other related limits?

Yes.  And the limits are not runtime settable.

> Second, are there sysctl variables that indicate the size or usage
> of the file table?  Or is this simply indicated by maxfiles (and
> perhaps others)?  Or is there a program that will report this info?

The "lsof" program will report open files.  The "maxfiles" variable
is a limit.  The limit is runtime for files, boot time for sockets.

The value of "kern.openfiles" is valid, but not very useful.


> Third, where is the limit for the number of file descriptors that
> can be open set?  Or is this the same limit as maxfiles, etc?

It's "maxfiles".


> Fourth, is there a difference between an open file and an open
> descriptor?

Not specifically.  Practically, no.

> These questions were spawned from the errors possibly returned by
> pipe(2).  I'm not clear on what the entities and limits are as
> they involve such things as the file table, open files, open
> descriptors, etc.
> 
> Finally, are answers to these questions OS specific, or are they
> part of a standard indicating how such things behave?

They are pretty much OS specific, for the answers.  The questions
aren't.

-- Terry


More information about the freebsd-hackers mailing list