.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\" @(#)truncate.2 6.2 (Berkeley) %G%
truncate \- truncate a file to a specified length
to be truncated to at most
bytes in size. If the file previously
was larger than this size, the extra data
the file must be open for writing.
A value of 0 is returned if the call succeeds. If the call
fails a \-1 is returned, and the global variable \fIerrno\fP
A component of the path prefix is not a directory.
The pathname contains a character with the high-order bit set.
A component of a pathname exceeded 255 characters,
or an entire path name exceeded 1023 characters.
The named file does not exist.
Search permission is denied for a component of the path prefix.
Too many symbolic links were encountered in translating the pathname.
The named file is a directory.
The named file resides on a read-only file system.
The file is a pure procedure (shared text) file that is being executed.
An I/O error occurred updating the inode.
points outside the process's allocated address space.
is not a valid descriptor.
references a socket, not a file.
Partial blocks discarded as the result of truncation
are not zero filled; this can result in holes in files
which do not read as zero.
These calls should be generalized to allow ranges
of bytes in a file to be discarded.