05-17-2005
You misunderstand. A process can call setrlimit() and reduce the number of open file desriptors allowed by the process. Or it can be reduced for all users.
The kernel on some versions of unix can be reconfigured to allow more than 1024 open file descriptors.
The point: You cannot depend on 1024
7 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to find a way to check the current status of a file. Such as some cron job processes are dependent on the completion of others. if a file is currently being accessed / modified or simply open state I will wait until it is done being processed before attempting the next process on that... (3 Replies)
Discussion started by: Gary Dunn
3 Replies
2. UNIX for Dummies Questions & Answers
What is a file descriptor in Unix??
How to find a file descriptor of a file in Unix??
Does it have anything to do with the Inode numbers?? (3 Replies)
Discussion started by: rahulrathod
3 Replies
3. Shell Programming and Scripting
Hello All,
Im opening a file desciptor in perl and sending data using print CMD "$xyz".
is there a limit to the length of the string that I can give to this CMD at a time. (3 Replies)
Discussion started by: rimser9
3 Replies
4. UNIX for Dummies Questions & Answers
Hi
What the below path contains?
/proc/<pid>/fd (1 Reply)
Discussion started by: siba.s.nayak
1 Replies
5. Shell Programming and Scripting
Hi All,
Thaks for the help in my last thread. I have one more question. I have two files with ldap entries in it. One file contains all the user LDAP parameter entries (26 MB) and other file contains only the user id's that have to be inactivated. Unix script has to read from the file that has... (8 Replies)
Discussion started by: Samingla
8 Replies
6. Shell Programming and Scripting
Hello,
How can i use file descriptor in a script to read 2 files at the same time and extract line 200 from file 1 and line 500 from file 2.
Thanks. (6 Replies)
Discussion started by: LiorAmitai
6 Replies
7. Programming
Hi guys,
I am writing a Makefile with some strange features.
What I have is:
list of files *.efi
list of guids (guid is just a number)
one *.efi file is supposed to be used with one guid, so efi file and guid is a pair.
What I need is:
list of files *.fv
How to make *.fv file... (1 Reply)
Discussion started by: Chrisdot
1 Replies
LEARN ABOUT OPENDARWIN
close
CLOSE(2) BSD System Calls Manual CLOSE(2)
NAME
close -- delete a descriptor
SYNOPSIS
#include <unistd.h>
int
close(int d);
DESCRIPTION
The close() call deletes a descriptor from the per-process object reference table. If this is the last reference to the underlying object,
the object will be deactivated. For example, on the last close of a file the current seek pointer associated with the file is lost; on the
last close of a socket(2) associated naming information and queued data are discarded; on the last close of a file holding an advisory lock
the lock is released (see further flock(2)).
When a process exits, all associated file descriptors are freed, but since there is a limit on active descriptors per processes, the close()
function call is useful when a large quantity of file descriptors are being handled.
When a process forks (see fork(2)), all descriptors for the new child process reference the same objects as they did in the parent before the
fork. If a new process is then to be run using execve(2), the process would normally inherit these descriptors. Most of the descriptors can
be rearranged with dup2(2) or deleted with close() before the execve is attempted, but if some of these descriptors will still be needed if
the execve fails, it is necessary to arrange for them to be closed if the execve succeeds. For this reason, the call ``fcntl(d, F_SETFD,
1)'' is provided, which arranges that a descriptor will be closed after a successful execve; the call ``fcntl(d, F_SETFD, 0)'' restores the
default, which is to not close the descriptor.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the global integer variable errno is set to
indicate the error.
ERRORS
Close() will fail if:
[EBADF] D is not an active descriptor.
[EINTR] An interrupt was received.
SEE ALSO
accept(2), flock(2), open(2), pipe(2), socket(2), socketpair(2), execve(2), fcntl(2)
STANDARDS
Close() conforms to IEEE Std 1003.1-1988 (``POSIX.1'').
4th Berkeley Distribution April 19, 1994 4th Berkeley Distribution