Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ close(2) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

dup(2)

exec(2)

fcntl(2)

open(2)

pipe(2)

socket(2N)




close(2) close(2)
NAME close - close a file descriptor SYNOPSIS int close(fildes) int fildes; DESCRIPTION close closes the file descriptor indicated by fildes. All outstanding record locks owned by the process (on the file indicated by fildes) are removed. The argument fildes is a file descriptor obtained from a creat, open, dup, fcntl, pipe, or socket system call. A close system call is automatically performed on all open files are part of exit . There is a small, finite limit on the number of open files per process (OPEN_MAX), so close is necessary for programs that deal with many files. When all file descriptors associated with a pipe or FIFO special file have been closed, any data remaining in the pipe or FIFO is discarded. When all file descriptors asso- ciated with an open file description have been closed, the file description is freed. If the link count of the file is 0 when all the file descriptors associated with the file have been closed, the space occupied by the file is freed and the file is no longer accessible. RETURN VALUE Upon successful completion, a value of 0 is returned. Oth- erwise, a value of -1 is returned and errno is set to indi- cate the error. ERRORS close will fail if one or both of the following are true: [EBADF]The argument fildes is not a valid open file descrip- tor. [EINTR]close was interrupted by a signal. SEE ALSO creat(2), dup(2), exec(2), fcntl(2), open(2), pipe(2), socket(2N). April, 1990 1

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026