close(2) DG/UX 4.30 close(2)
NAME
close - Close an object associated with a file descriptor.
SYNOPSIS
int close (fildes)
int fildes;
PARAMETERS
fildes A valid, active file descriptor.
DESCRIPTION
If <fildes> is a valid, active descriptor, close breaks the
connection between the descriptor indicated by <fildes> and
the object to which it refers. If <fildes> is the last
descriptor that refers to an object pointer, the object
pointer is "closed" by invoking the type- specific close
operation.
Thus, the type manager is informed only of the last close
operation of an object pointer. These managers (and
specifically, the device driver close operations) should not
expect to be invoked during each close system call.
Upon completion of the close operation, <fildes> will be
inactive. Until <fildes> is reallocated, subsequent
operations using <fildes> will result in an EBADF error
condition.
Objects are also subject to implicit close operations via
the exit and exec operations. When a process terminates,
all active descriptors are closed. When a process performs
a successful exec operation, all active descriptors with the
`close-on-exec' attribute are closed. These implicit close
operations are equivalent to an explicit close operation.
On each close of an object, all outstanding locks owned by
the calling process on the object are released.
ACCESS CONTROL
None.
RETURN VALUE
0 The object was successfully closed.
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
Licensed material--property of copyright holder(s) Page 1
close(2) DG/UX 4.30 close(2)
EBADF <Fildes> is not a valid, active descriptor.
EINTR Close call was interrupted.
EIO An i/o error occurred while reading from or
writing to the file system. The <fildes> is
inactived.
SEE ALSO
The related manual sections: accept(2), creat(2), dup(2),
exec(2), fcntl(2), open(2), pipe(2), signal(2), sigset(2),
socket(2), socketpair(2).
Licensed material--property of copyright holder(s) Page 2