xref: /csrg-svn/lib/libc/sys/close.2 (revision 20020)
Copyright (c) 1980 Regents of the University of California.
All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.

@(#)close.2 4.1 (Berkeley) 05/09/85

CLOSE 2
C 4
NAME
close - close a file
SYNOPSIS
close(fildes)
DESCRIPTION
Given a file descriptor such as returned from an open, creat, dup or pipe (2) call, close closes the associated file. A close of all files is automatic on exit, but since there is a limit on the number of open files per process, close is necessary for programs which deal with many files.

Files are closed upon termination of a process, and certain high-numbered file descriptors are closed by exec (2), and it is possible to arrange for others to be closed (see FIOCLEX in ioctl (2)).

"SEE ALSO"
creat(2), open(2), pipe(2), exec(2), ioctl(2)
DIAGNOSTICS
Zero is returned if a file is closed; -1 is returned for an unknown file descriptor.
"ASSEMBLER (PDP-11)"
(close = 6.)

(file descriptor in r0)

sys close

BUGS
A file cannot be closed while there are pages which have been vread but not referenced.