local_sub_and_test(9)
π local_sub_and_test(9) β the Kernel API Manual glow-up π¦
okay so bestie, welcome to the local_sub_and_test(9) page β¨ this one lives in the Kernel API Manual and it's honestly such a little icon β smol function, big main character energy π
β¨ NAME β¨
local_sub_and_test β literally subtracts a value from a variable and then tests the result, no cap π
πΈ SYNOPSIS πΈ
bool local_sub_and_test (long i , local_t *l );
that's it. that's the whole vibe check. π«Ά
π ARGUMENTS π
iβ the integer value you're subtracting. this is the amount getting yeeted out of the variable πlβ a pointer to typelocal_t. this is the variable doing the receiving (well, the un-receiving, since we're subtracting π)
π₯ DESCRIPTION π₯
so what does it actually do? it atomically subtracts i from l β atomically meaning no one else can sneak in and mess with it mid-operation, it's giving locked-in, one-and-done, absolutely unbothered behavior π
then it checks the result and returns true if the result is zero, or false for all other cases. that's the "and_test" part, babes β the subtraction happens, the answer gets vibe-checked, and you get a lil bool back π
no cap, that's the entire function. iconic, honestly. β
π¦ SEE ALSO π¦
if you're obsessed with this one (and why wouldn't you be π), go check out the kernel file ./arch/x86/include/asm/local.h and its besties:
local_dec_and_test(9)local_inc_and_test(9)local_add_negative(9)local_add_return(9)local_add_unless(9)
fr fr, they're all in the same friend group π«Άβ¨
and that's the whole page, bestie! π this little masterpiece comes to you from ./arch/x86/include/asm, dated October 2026, and it's filed under local_sub_and_test(9). go forth and subtract atomically π§ββοΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms