---
name: "VOP_LINK"
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_LINK"
---

# VOP\_LINK(9)

create a new name for a file

## NAME

**VOP\_LINK** – create a new name for a file

## SYNOPSIS

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

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

*int*\

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

## DESCRIPTION

This links a new name in the specified directory to an existing file.

Its arguments are:

- *dvp*

  The vnode of the directory.

- *vp*

  The vnode of the file to be linked.

- *cnp*

  Pathname information about the file.

The pathname info should *not* be released on exit because it is done by the caller. The directory and file vnodes should *not* be released on exit.

## LOCKS

**VOP\_LINK**() expects the directory and file vnodes to be locked on entry and will leave the vnodes locked on return.

## RETURN VALUES

Zero is returned if the file was linked successfully, otherwise an error is returned.

## ERRORS

- \[EMLINK\]

  The file has too many links.

- \[EPERM\]

  The file is immutable.

- \[EXDEV\]

  A hard link is not possible between different file systems.

## SEE ALSO

[vn\_lock(9)](/vn_lock/9.md), [vnode(9)](/vnode/9.md)

## AUTHORS

This manual page was originally written by Doug Rabson.
