close(2) close(2)
NAME
close - close a file descriptor
SYNOPSIS
int close (fildes)
int fildes;
DESCRIPTION
fildes is a file descriptor obtained from a creat, open,
dup, fcntl, pipe, or socket system call. close closes the
file descriptor indicated by fildes. A close of all files
is automatic on exit, but since there is a 20 open file
limit on the number of open files per process, close is
necessary for programs which deal with many files. All
outstanding record locks owned by the process (on the file
indicated by fildes) are removed.
[EBADF] close will fail if fildes is not a valid open
file descriptor.
RETURN VALUE
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned and errno is set to
indicate the error.
SEE ALSO
creat(2), dup(3), exec(2), fcntl(2), open(2), pipe(2),
socket(2N).
Page 1 (last mod. 1/14/87)