AUDIT_GETLOGINUID(3)

πŸ“¦
version 4.2.1 Β· 2 versions
, in alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, fedora 43, fedora 44, nixpkgs unstable, ubuntu resolute, ubuntu stonking

πŸŽ€ AUDIT_GETLOGINUID πŸ’–

okay bestie, welcome to the Linux Audit API corner of the man pages 🌸 this one's short and sweet, it's literally just one function and she's an icon, no cap.


✨ NAME ✨

audit_getloginuid β€” get a program's loginuid value πŸ‘‘


🌈 SYNOPSIS 🌈

#include <libaudit.h>

uid_t audit_getloginuid(void);

like yes, that's the whole vibe. include the header, call the function, no arguments, we love a zero-arg queen πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this function returns the task attribute loginuid. that's it. that's the whole job. she shows up, she hands you the loginuid, she leaves 🫢


πŸ’œ RETURN VALUE πŸ’œ

if the loginuid was set, you get that value back. slay ✨

but if loginuid was unset, it returns a -1. and here's the little plot twist that gets everybody: uid_t is an unsigned type, so you're not gonna see a -1 staring back at you β€” you'll see the converted value instead 😭 it's giving "the math said no". don't let it catch you off guard, fr fr.


πŸ”₯ ERRORS πŸ”₯

on failure, this function returns -1. but listen β€” in the event of a real error, errno would be set. so if you're out here just checking the return value and not errno, that's not the move bestie πŸ’€

the function can set errno based on failures of open, read, or strtoul. that's the whole list, no more no less πŸ‘‘

ngl the -1 vs unsigned uid_t situation from RETURN VALUE applies here too, so keep both eyes open when you're doing your vibe check on the result.

🌟 SEE ALSO 🌟


πŸ‘‘ AUTHOR πŸ‘‘

Steve Grubb ✨ absolute legend, we stan.


mwah πŸ’‹ that's the page, bestie. this one came from Red Hat, dated Oct 2006 β€” vintage but still iconic, like a limited edition πŸŽ€ go forth and get those loginuids, iykyk πŸ¦‹β­