PRISON_CHECK(9)
β¨ PRISON_CHECK(9) β¨
okay so bestie, we're in the Kernel Developer's Manual section 9 today and the vibes are immaculate π this one's a little function that does exactly one thing and does it slayfully: it tells you whether two credentials are living in the same jail or not. jail as in FreeBSD jail, not jail jail, don't be weird about it π
π NAME π
prison_check β determine if two credentials belong to the same jail
like literally that's it, that's the whole job description, she's a one-trick pony and her trick is iconic π¦
πΈ SYNOPSIS πΈ
#include <sys/jail.h>
int
prison_check(struct ucred *cred1, struct ucred *cred2);
π DESCRIPTION π
okay so here's the tea π β this function can be used to determine if the two credentials cred1 and cred2 belong to the same jail.
that's it. that's the function. she looks at two struct ucred * pointers, and she tells you if they're jail-mates or not. main character energy, zero drama, no cap π
π₯ RETURN VALUES π₯
okay this is the part where you actually have to pay attention, bestie, because the return value is a lil quirky π
ESRCHβ returned ifcred1has been jailed, andcred1andcred2do not belong to the same jail. so like: one of them is in a jail, and the two of them aren't in the same one. that's the sad path π- zero β in all other cases,
prison_check()returns zero. yes, all of them. every single other combination. zero. that's your happy path π«Ά
β οΈ read that again slowly: it's not a simple true/false. the error only fires whencred1is jailed and the two aren't in the same jail. everything else β includingcred1not being jailed at all β is a zero. iykyk β¨
π¦ SEE ALSO π¦
and that's the whole page, bestie, you ate that π
this lil masterpiece comes from the Debian crew, dated December 11, 2003 β yeah she's an elder but she's still serving looks β¨ πππ
π¦ 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) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms