BUF_LOCK(9)
π BUF_LOCK β locks a buffer π
okay bestie, welcome to the BUF_LOCK(9) page from the Kernel Developer's Manual β¨ β yes this is the kernel-dev girly side of the buf(9) family, and it's honestly giving "small function, big responsibility" energy π
πΈ SYNOPSIS πΈ
First you gotta bring the whole squad of headers along, no cap:
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/bio.h>
#include <sys/buf.h>
int
BUF_LOCK(struct buf *bp, int locktype);
Like, all five includes. They're a package deal π
β¨ DESCRIPTION β¨
So BUF_LOCK() locks the given buffer. That's the whole vibe. π¦
But here's the tea: if the lock is already held, this call will block until it can acquire the lock β unless LK_NOWAIT is set. So if you're the impatient type, set LK_NOWAIT. If you're chill, enjoy the wait π
Its arguments are:
bpβ literally just the buffer you wanna lock. That's it. That's the whole parameter. πlocktypeβ the flags that control the type of lock. For the deets, go seelockmgr(9)β she has the full lore π
π«Ά RETURN VALUES π«Ά
On success you get a 0. Iconic. Perfect. No notes. β¨
For what all the non-zero return values mean, hit up lockmgr(9) β that's where the drama lives π
π SEE ALSO π
the whole friend group, fr fr π―ββοΈ
π AUTHORS π
This manual page was written by Chad David <davidc@acns.ab.ca>. Give her her flowers πΈπ
and that's the page, bestie!! this lil number is from Debian, dated July 9, 2001 β vintage but still slaying, lowkey a nostalgic era ππ mwah, go lock some buffers responsibly π§ββοΈβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms