Open System Services System Calls Reference Manual (G06.28+, H06.05+)

ftruncate64(2) OSS System Calls Reference Manual
NAME
ftruncate64 - Changes le length
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/types.h>
int ftruncate64(
int ledes,
off64_t length);
PARAMETERS
filedes Species the descriptor of a le that must be open for writing.
length Species the new length of the le in bytes.
DESCRIPTION
The ftruncate64() function is similar to the ftruncate() function except that, in addition to sup-
porting smaller les, the ftruncate64() function supports OSS les larger than approximately 2
gigabytes.
An application can explicitly call this function when the application is compiled using the
#dene _LARGEFILE64_SOURCE 1 feature test macro or an equivalent compiler command
option.
An application call to ftruncate() is automatically mapped to this function when the applciation
is compiled using the #dene _FILE_OFFSET_BITS 64 feature test macro or an equivalent
compiler command option.
The ftruncate64() function changes the length of a le to the size, in bytes, specied by the
length parameter.
If the new length is less than the previous length, the ftruncate64() function removes all data
beyond length bytes from the specied le. All le data between the new EOF and the previous
EOF is discarded.
If the new length is greater than the previous length, zeros are added between the previous EOF
and the new EOF. If the new length would exceed the le size limit for the calling process, the
call to ftruncate64() fails, and errno is set to [EFBIG].
Full blocks are returned to the leset so that they can be used again, and the le size is changed
to the value of the length parameter.
The ftruncate64() function has no effect on First-in, First out (FIFO) special les. This function
does not modify the seek pointer of the le. If ftruncate64() is called for a FIFO le, the call
fails, and errno is set to [EINVAL].
Upon successful completion, the ftruncate64() function marks the st_ctime and st_mtime elds
of the le for update. If the le is a regular le, the ftruncate64() function clears the S_ISUID
and S_ISGID attributes of the le.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, the value -1 is returned
and errno is set to indicate the error.
360 Hewlett-Packard Company 527186-007