UIDINFO(9)

πŸ’– UIDINFO(9) πŸ’–

ok so bestie, welcome to the uidinfo page from the Kernel Developer's Manual β€” yes we're in section 9, we're in the kernel, we're doing UID bookkeeping and honestly? it's giving main character energy. πŸŽ€


✨ NAME ✨

uidinfo, uihashinit, uifind, uihold, uifree β€” the whole girl gang of functions for managing UID information 🫢


✨ SYNOPSIS ✨

#include <sys/param.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>

void
uihashinit(void);

struct uidinfo *
uifind(uid_t uid);

void
uihold(struct uidinfo *uip);

void
uifree(struct uidinfo *uip);

like, copy that exactly bestie, no typos, the compiler is not forgiving πŸ’…


✨ DESCRIPTION ✨

The uidinfo family of functions manages uidinfo structures. Every single uidinfo structure keeps track of per-uid resource consumption counts β€” and we mean per uid, like one lil record per user β€” including the process count and the socket buffer space usage. no cap. 🌸


🌈 uihashinit()

uihashinit() initializes the uidinfo hash table and its mutex. 🧚

⚠️ bestie, listen: this one should only be called during system initialization. it's not a "call it whenever" situation, it's a "call it once, at boot, and then never speak of it again" situation. periodt.

🌈 uifind()

uifind() looks up and returns the uidinfo structure for uid. πŸ”

And if there's no uidinfo structure chillin' there for uid yet? don't even worry, a brand new structure will be allocated and initialized for you. iconic behavior honestly.

oh and heads up β€” the uidinfo hash mutex is acquired and released. yes ma'am, we lock and unlock, that's just how we move here. πŸ”₯


🌈 uihold()

uihold() increases the reference count on uip. ✨

uip's lock is acquired and released. that's the whole thing. simple. clean. slay.


🌈 uifree()

uifree() decreases the reference count on uip, and if that count reaches 0, uip is freed. πŸ’€ (rip lil struct, you did amazing sweetie)

uip's lock is acquired and released, and the uidinfo hash mutex may be acquired and released too. yes, "may" β€” we're being precise, don't @ me. πŸ¦‹


✨ RETURN VALUES ✨

uifind() returns a pointer to an initialized uidinfo structure β€” and it should not fail. like, it's not going to ghost you. it's reliable. πŸ‘‘


✨ AUTHORS ✨

This manual page was written by Chad David <davidc@acns.ab.ca>. 🫢


and that's the whole page bestie, mwah πŸ’…

this lil beauty is from the Debian crew and it's dated July 10, 2001 β€” yeah, it's an elder but it's still serving, we love her, bye bye πŸ’–βœ¨

πŸ“¦ where this page comes from