Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ close(2) — Ultrix-11 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

exec(2)

fcntl(2)

ioctl(2)

open(2)

pipe(2)

close(2)

NAME

close − close a file

SYNTAX

int close(fildes)
int fildes;

DESCRIPTION

Given a file descriptor returned from a creat, dup, fcntl, open, or pipe call, the close system call closes the file named by fildes. A close of all files is automatic on an exit call, but because there is a limit on the number of open files per process, the close call is necessary for programs which deal with many files. 

All outstanding record locks on the file indicated by fildes that are owned by the calling process are removed. 

Files are closed upon termination of a process, and certain file descriptors may be closed by the exec call. 

RETURN VALUE

If unsuccessful, returns a −1, and the global variable errno indicates the error code. 

DIAGNOSTICS

The close call will fail if:

[EBADF] The fildes argument is not an active descriptor. 

ASSEMBLER

(close = 6.) 
(file descriptor in r0)
sys close

SEE ALSO

creat(2), exec(2), fcntl(2), ioctl(2), open(2), pipe(2)

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