VOP_TRUNCATE(9)

NAME
VOP_TRUNCATE - truncate a file

SYNOPSIS
#include <sys/vnode.h>
int
VOP_TRUNCATE(struct vnode *vp, off_t length, int flags, struct ucred *cred, struct proc *p);

DESCRIPTION

The arguments are:

vp  The file to truncate.

length
    The desired new length of the file.

flags
    Flags controlling I/O.

cred
    Credentials of the caller.

p   Current process.

The size of file vp is set to length. The file can be both truncated and extended by this call. If flags contains the value IO_SYNC then all writes to the filesystem should complete before the call returns. This call is used internally by the UFS filesystem as part of its implementation of VOP_SETATTR(9).

RETURN VALUES
Zero is returned on success, otherwise an error is returned.

SEE ALSO
vnode(9), VOP_SETATTR(9)

AUTHORS
This man page was written by Doug Rabson.