---
name: "VOP_ADVISE"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/VOP_ADVISE"
---

# VOP\_ADVISE(9)

apply advice about use of file data

## NAME

**VOP\_ADVISE** – apply advice about use of file data

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<sys/vnode.h\>**

*int*\

**VOP\_ADVISE**(*struct vnode \*vp*, *off\_t start*, *off\_t end*, *int advice*);

## DESCRIPTION

This call applies advice for a range of a file's data. It is used to implement the [posix\_fadvise(2)](/posix_fadvise/2.md) system call.

Its arguments are:

- *vp*

  The vnode of the file.

- *start*

  The start of the range of file data.

- *end*

  The end of the range of file data. A value of OFF\_MAX indicates that the advice is to be applied up to the end of the file.

- *advice*

  The type of operation to apply to the file data. Possible values are:

  - POSIX\_FADV\_WILLNEED

    Initiate an asynchronous read of the file data if it is not already resident.

  - POSIX\_FADV\_DONTNEED

    Decrease the in-memory priority of clean file data or discard clean file data.

If the *start* and *end* offsets are both zero, then the operation should be applied to the entire file. Note that this call is advisory only and may perform the requested operation on a subset of the requested range (including not performing it at all) and still return success.

## LOCKS

The file should be unlocked on entry.

## RETURN VALUES

Zero is returned if the call is successful, otherwise an appropriate error code is returned.

## ERRORS

- \[EINVAL\]

  An invalid value was given for *advice*.

## SEE ALSO

[vnode(9)](/vnode/9.md)
