Commit | Line | Data |
---|---|---|
5ffa3a26 BJ |
1 | .TH CLOSE 2 |
2 | .SH NAME | |
3 | close \- close a file | |
4 | .SH SYNOPSIS | |
5 | .B close(fildes) | |
6 | .PP | |
7 | .SH DESCRIPTION | |
8 | Given | |
9 | a file descriptor such as returned from an | |
10 | .I open, | |
11 | .I creat, | |
12 | .I dup | |
13 | or | |
14 | .IR pipe (2) | |
15 | call, | |
16 | .I close | |
17 | closes the associated file. | |
18 | A close of all files is automatic on | |
19 | .I exit, | |
20 | but since | |
21 | there is a limit on the number of open files per process, | |
22 | .I close | |
23 | is necessary for programs which deal with many files. | |
24 | .PP | |
25 | Files are closed upon termination of a process, and | |
26 | certain high-numbered file descriptors are closed by | |
27 | .IR exec (2). | |
28 | .SH "SEE ALSO" | |
29 | creat(2), open(2), pipe(2), exec(2) | |
30 | .SH DIAGNOSTICS | |
31 | Zero is returned if a file is closed; | |
32 | \-1 is returned for an unknown file descriptor. | |
33 | .SH "ASSEMBLER (PDP-11)" | |
34 | (close = 6.) | |
35 | .br | |
36 | (file descriptor in r0) | |
37 | .br | |
38 | .B sys close | |
39 | .PP | |
40 | .SH BUGS | |
41 | A file cannot be closed while there are pages which have been | |
42 | .I vread | |
43 | but not referenced. |