FCLEAR(2,L) AIX Technical Reference FCLEAR(2,L)
-------------------------------------------------------------------------------
fclear
PURPOSE
Clears space in a file, freeing unused disk space.
SYNTAX
long fclear (fildes, nbytes)
int fildes;
unsigned long nbytes;
DESCRIPTION
The fclear system call zeros the number of bytes specified by the nbytes
parameter starting at the current position of the file open on file descriptor
fildes. This function differs from the logically equivalent write operation in
that it returns full blocks of binary zeros to the file system, constructing
holes in the file. The seek pointer of the file is advanced by nbytes.
If you fclear past the end of a file, the rest of the file is cleared, and the
seek pointer is advanced by nbytes. The file size is updated to include this
new hole, which leaves the current file position at the byte immediately beyond
the new end-of-file. Successful completion of the fclear system call clears
the set-user-ID and set-group-ID attributes of the file.
RETURN VALUE
Upon successful completion, a value of nbytes is returned. If the fclear
system call fails, a value of -1 is returned, and errno is set to indicate the
error.
ERROR CONDITIONS
The fclear system call fails if one or more of the following are true:
EIO I/O error.
EBADF The fildes option is not a valid file descriptor open for writing.
EINVAL The file is a FIFO, directory, or special file.
EAGAIN The write operation in fclear failed, due to an enforced write lock
on the file.
If the Transparent Computing Facility is installed on your system, fclear can
also fail if one or more of the following are true:
Processed November 7, 1990 FCLEAR(2,L) 1
FCLEAR(2,L) AIX Technical Reference FCLEAR(2,L)
ESITEDN1 The storage site is down or has gone down since this file descriptor
was issued.
ESITEDN2 The operation was terminated because a site failed.
RELATED INFORMATION
In this book: "ftruncate, truncate."
Processed November 7, 1990 FCLEAR(2,L) 2