int close (fd) int fd; close() deletes a descriptor from the
per-process object reference table. If fd is the last reference
to the underlying object, then the object will be deactivated.
For example, on the last close of a file the current seek
pointer associated with the file is lost. On the last close of a
socket (see socket.2 associated naming information and queued
data are discarded. On the last close of a file holding an
advisory lock applied by flock.2 the lock is released. (Record
locks applied to the file by lockf.3 however, are released on
any call to close() regardless of whether fd is the last
reference to the underlying object.) close() does not unmap any
mapped pages of the object referred to by fd (see mmap(),
munmap.2 A close of all of a process's descriptors is automatic
on exit(), but since there is a limit on the number of active
descriptors per process, close() is necessary for programs that
deal with many descriptors. When a process forks (see fork.2v
all descriptors for the new child pr