zkClose - close a file descriptor
#include "zkUnistd.h"
int zkClose(int fildes);
The zkClose() function will deallocate the file descriptor indicated by fildes. To deallocate means to make the file descriptor available for return by subsequent calls to zkOpen() or other functions that allocate file descriptors. All outstanding record locks owned by the process on the file associated with the file descriptor will be removed (that is, unlocked).
If zkClose() is interrupted by a signal that is to be caught, it will return -1 with errno set to [EINTR] and the state of fildes is unspecified.
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
The zkClose() function will fail if:
- [EBADF]
- The fildes argument is not a valid file descriptor.
- [EINTR]
- The zkClose() function was interrupted by a signal.
The zkClose() function may fail if:
- [EIO]
- An I/O error occurred while reading from or writing to the file system.
An application that had used the zkStdio routine zkFopen() to open a file should use the corresponding zkFclose() routine rather than zkClose().
The zkClose() function may portably be used only with file descriptors representing regular files. Any attempt to use it on a socket, directory, FIFO, STREAMS file, terminal device file, character special file, or block special file is non-portable