close - close a file descriptor
#include <unistd.h>
close() closes the file descriptor indicated by fildes. All outstanding record locks owned by the thread (on the file indicated by fildes) are removed. fildes must be an open file descriptor.
When all file descriptors associated with the open file description have been closed, the open file description is freed.
If the link count of the file is zero, when all file descriptors associated with the file have been closed, the space occupied by the file is freed and the file is no longer accessible.
The last close() for a stream causes the stream associated with fildes to be dismantled immediately.
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
This function is a member of Unison's IOLIB family of functions. IOLIB is implemented as a message passing and generalized interface layer. Each Unison I/O server is responsible for its own error reporting.
For an exact list of error codes returned by a particular server, refer to that server's documentation in the Unison Programmer's Guide for each specific platform.
Servers may implement these errors codes in response to this function.
The named file is closed unless one or more of the following are true: