Computing.Net > Forums > Unix > file handles on unix

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

file handles on unix

Reply to Message Icon

Name: Tricia
Date: October 18, 2000 at 17:45:06 Pacific
Comment:

I would like to be able to programmatically determine the number of file handles available on the various flavors of unix. This parameter determines the number of open files you can have in one process at one time.



Sponsored Link
Ads by Google

Response Number 1
Name: max
Date: November 2, 2000 at 12:02:16 Pacific
Reply:

The constant NOFILE in defines the maximum number of open files per process.

In the case this constant is not in param.h, type the command :
find /usr/include -name "*.h" -exec grep "NOFILE" {} \; -print

this would tell you in which header to find it. In general, only 20 files can be opened.

This is used by some daemons to close all file descriptors (when they are properly developed). But some of them use the constant _NFILE in instead of NOFILE... which is the maximum number of streams. Since a stream is a file, it depends on what you want to close or open. There is about 100 streams that can be opened. This is under System V.

Some other systems such 4.3BSD give you the getdtablesize() system call in , which returns the number of entries in the file descriptor table for a process (cf richard stevens, unix network programming).


0

Response Number 2
Name: max
Date: November 2, 2000 at 12:05:53 Pacific
Reply:

oooops... didn't print the include files :
NOFILE is in sys/param.h
_NFILE in stdio.h
getdtablesize() in unistd.h

sorry ;)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: file handles on unix

Increasing file handles in UNIX... ? www.computing.net/answers/unix/increasing-file-handles-in-unix-/588.html

file attachments using mail in shells scripts on unix www.computing.net/answers/unix/file-attachments-using-mail-in-shells-scripts-on-unix/1061.html

xcopy on unix www.computing.net/answers/unix/xcopy-on-unix/5364.html