BUF_ISLOCKED(9)
π BUF_ISLOCKED π
okay bestie, so you wanna know if a buffer's lock is held?? say less, this page has you covered π«Ά it's from the Kernel Developer's Manual (section 9, kernel-land only, no user-space shenanigans here) and it's literally just one tiny function that tells you what's up with a lock. no cap.
β¨ SYNOPSIS β¨
like always, you gotta include the whole squad first or nothing works:
#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 πΈ
so BUF_ISLOCKED() returns the status of the lock linked to the buffer, and it does it in relation to curthread (that's the thread you're running as, iykyk). it's giving "who's holding this lock and is it me??" energy π
it can return:
LK_EXCLUSIVEβ an exclusive lock is held bycurthread. that's you bestie, main character energy πLK_EXCLOTHERβ an exclusive lock is held by someone other thancurthread. not you, someone else is in there πLK_SHAREDβ a shared lock is held. everybody's sharing, cute π0β the lock is not held by anyone. fully free, unlocked, living its best life β¨
π₯ SEE ALSO π₯
buf(9), BUF_LOCK(9), BUF_UNLOCK(9), lockmgr(9), lockstatus(9)
π AUTHORS π
this manual page was written by Attilio Rao <attilio@FreeBSD.org>. iconic behavior fr fr π
Debian Β· January 22, 2008 Β· that's the Debian-flavored BUF_ISLOCKED(9) page, mwah π go check your locks bestie, ily, bye!! π¦πΈ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (C) 2008 Attilio Rao <attilio@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms