---
name: "BUF_ISLOCKED"
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/BUF_ISLOCKED"
---

# BUF\_ISLOCKED(9)

returns the state of the lock linked to the buffer

## NAME

**BUF\_ISLOCKED** – returns the state of the lock linked to the buffer

## SYNOPSIS

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

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

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

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

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

*int*\

**BUF\_ISLOCKED**(*struct buf \*bp*);

## DESCRIPTION

The **BUF\_ISLOCKED**() function returns the status of the lock linked to the buffer in relation to curthread.

It can return:

- LK\_EXCLUSIVE

  An exclusive lock is held by curthread.

- LK\_EXCLOTHER

  An exclusive lock is held by someone other than curthread.

- LK\_SHARED

  A shared lock is held.

- 0

  The lock is not held by anyone.

## SEE ALSO

[buf(9)](/buf/9.md), [BUF\_LOCK(9)](/BUF_LOCK/9.md), [BUF\_UNLOCK(9)](/BUF_UNLOCK/9.md), [lockmgr(9)](/lockmgr/9.md)

## AUTHORS

This manual page was written by Attilio Rao ⟨*attilio@FreeBSD.org*⟩.
