vnop_ftrunc Entry Point

Purpose

Truncates a file.

Syntax

int vnop_ftrunc (vp, flags, length, vinfo, crp)
struct vnode * vp;
int  flags;
offset_t  length;
caddr_t  vinfo;
struct ucred * crp;

Parameters

Item Description
vp Points to the virtual node (v-node) of the file.
flags Identifies flags from the open file structure.
length Specifies the length to which the file should be truncated.
vinfo This parameter is unused.
crp Points to the cred structure. This structure contains data that the file system can use to validate access permission.

Description

The vnop_ftrunc entry point is invoked by the logical file system to decrease the length of a file by truncating it. This operation is unsuccessful if any process other than the caller has locked a portion of the file past the specified offset.

Execution Environment

The vnop_ftrunc entry point can be called from the process environment only.

Return Values

Item Description
0 Indicates success.

Nonzero return values are returned from the /usr/include/sys/errno.h file to indicate failure.