.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 high-numbered file descriptors are closed by .IR exec (2). .SH "SEE ALSO" creat(2), open(2), pipe(2), exec(2) .SH DIAGNOSTICS Zero is returned if a file is closed; \-1 is returned for an unknown file descriptor. .SH "ASSEMBLER (PDP-11)" (close = 6.) .br (file descriptor in r0) .br .B sys close .PP .SH BUGS A file cannot be closed while there are pages which have been .I vread but not referenced.