close(2)
_________________________________________________________________
close System Call
Close an object associated with a file descriptor.
_________________________________________________________________
SYNTAX
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 successful close of an object, all outstanding locks
owned by the calling process on the object are released.
ACCESS CONTROL
None.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
close(2)
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:
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.
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).
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)