V7/usr/man/man2/close.2
.TH CLOSE 2
.SH NAME
close \- close a file
.SH SYNOPSIS
.B close(fildes)
.PP
.SH DESCRIPTION
Given
a file descriptor such as returned from an
.I open,
.I creat,
.I dup
or
.IR pipe (2)
call,
.I close
closes the associated file.
A close of all files is automatic on
.I exit,
but since
there is a limit on the number of open files per process,
.I close
is necessary for programs which deal with many files.
.PP
Files are closed upon termination of a process, and
certain file descriptors may be closed by
.IR exec (2)
(see
.IR ioctl (2)).
.SH "SEE ALSO"
creat(2), open(2), pipe(2), exec(2), ioctl(2)
.SH DIAGNOSTICS
Zero is returned if a file is closed;
\-1 is returned for an unknown file descriptor.
.SH ASSEMBLER
(close = 6.)
.br
(file descriptor in r0)
.br
.B sys close
.PP