vnop_getattr Entry Point

Purpose

Gets the attributes of a file.

Syntax

int vnop_getattr ( vp,  vap,  crp)
struct vnode *vp;
struct vattr *vap;
struct ucred *crp;

Parameters

Item Description
vp Specifies the virtual node (v-node) of the file system object.
vap Points to a vattr structure.
crp Points to the cred structure. This structure contains data that the file system can use to validate access permission.

Description

The vnop_getattr entry point is called by the logical file system to retrieve information about a file. The vattr structure indicated by the vap parameter contains all the relevant attributes of the file. The vattr structure is defined in the /usr/include/sys/vattr.h file. This entry point is used to implement the stat, fstat, and lstat subroutines.

Note: The indicated v-node is held for the duration of the vnop_getattr subroutine.

Execution Environment

The vnop_getattr 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.