Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (s and S) spt_ftruncate64z(2)
NAME
spt_ftruncate64z - Changes file length (thread-aware version)
LIBRARY
H-series and J series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <sys/types.h>
#include <spthread.h>
int spt_ftruncate64z(
int filedes,
off64_t length);
PARAMETERS
filedes Specifies the descriptor of a file that must be open for writing.
length Specifies the new length of the file in bytes.
DESCRIPTION
The spt_ftruncate64z( ) function is a thread-aware version of the ftruncate64() function.
The spt_ftruncate64z( ) function changes the length of a file to the size, in bytes, specified by the
length parameter.
If the new length is less than the previous length, the spt_ftruncate64z( ) function removes all
data beyond length bytes from the specified file. All file data between the new EOF and the pre-
vious 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 file size limit for the calling process, the
call to spt_ftruncate64z( ) fails, and errno is set to [EFBIG].
Full blocks are returned to the fileset so that they can be used again, and the file size is changed
to the value of the length parameter.
The spt_ftruncate64z( ) function has no effect on First-in, First out (FIFO) special files. This
function does not modify the seek pointer of the file. If spt_ftruncate64z( ) is called for a FIFO
file, the call fails, and errno is set to [EINVAL].
Upon successful completion, the spt_ftruncate64z() function marks the st_ctime and st_mtime
fields of the file for update. If the file is a regular le, the spt_ftruncate64z( ) function clears the
S_ISUID and S_ISGID attributes of the file.
NOTES
The spt_ftruncate64z( ) function offers an alternative to the O_SYNC file status flag. Using
spt_ftruncate64z( ) calls gives an application control over the performance tradeoffs involved in
guaranteeing data integrity. OSS file-system caching can be used for files that are protected only
by spt_ftruncate64z() function calls.
This function is thread-aware: if this function must wait for an I/O operation to complete on an
open file, this function blocks the thread that called it (instead of the entire process), while it
waits for the I/O operation to complete.
This function serializes file operations on an open file. If a thread calls spt_ftruncate64z() to
access a file that already has a file operation in progress by a different thread, this thread is
blocked until the prior file operation is complete.
527186-023 Hewlett-Packard Company 7249