chsize(2XNX) (XENIX System Compatibility) chsize(2XNX)
NAME
chsize - (XENIX) change the size of a file
SYNOPSIS
cc [flag . . . ] flag . . . -lx
int chsize(int fildes, long size);
DESCRIPTION
fildes is a file descriptor obtained from a create, open, dup,
fcntl, or pipe system call. chsize changes the size of the
file associated with the file descriptor fildes to be exactly
size bytes in length. The routine either truncates the file,
or pads it with an appropriate number of bytes. If size is
less than the initial size of the file, then all allocated
disk blocks between size and the initial file size are freed.
The maximum file size as set by ulimit(2) is enforced when
chsize is called, rather than on subsequent writes. Thus
chsize fails, and the file size remains unchanged if the new
changed file size would exceed the ulimit.
Return Values
Upon successful completion, a value of 0 is returned.
Otherwise, the value -1 is returned and errno is set to
indicate the error.
REFERENCES
creat(2), dup(2), lseek(2), open(2), pipe(2), ulimit(2)
NOTICES
In general if chsize is used to expand the size of a file,
when data is written to the end of the file, intervening
blocks are filled with zeros. In a some cases, reducing the
file size may not remove the data beyond the new end-of-file.
Copyright 1994 Novell, Inc. Page 1