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

# VOP\_REMOVE(9)

remove a file or directory

## NAME

**VOP\_REMOVE**, **VOP\_RMDIR** – remove a file or directory

## SYNOPSIS

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

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

*int*\

**VOP\_REMOVE**(*struct vnode \*dvp*, *struct vnode \*vp*, *struct componentname \*cnp*);

*int*\

**VOP\_RMDIR**(*struct vnode \*dvp*, *struct vnode \*vp*, *struct componentname \*cnp*);

## DESCRIPTION

These entry points remove files and directories respectively.

The arguments are:

- *dvp*

  The vnode of the directory.

- *vp*

  The vnode of the file to be removed.

- *cnp*

  Pathname information about the file.

## LOCKS

Both *dvp* and *vp* should be locked on entry and remain locked on return.

## RETURN VALUES

Zero is returned on success, otherwise an error code is returned.

## ERRORS

- \[EPERM\]

  The file is immutable.

- \[ENOTEMPTY\]

  An attempt was made to remove a directory which is not empty.

## SEE ALSO

[vnode(9)](/vnode/9.md), [VOP\_LOOKUP(9)](/VOP_LOOKUP/9.md)

## AUTHORS

This manual page was written by Doug Rabson.
