GETLOGINCLASS(2)
π GETLOGINCLASS(2) β the system calls manual, bestie edition π
okay so this is the page for getloginclass and setloginclass, aka the little duo that handles your login class. it's a section 2 manpage, iykyk, syscalls only, no cap. π¦
β¨ NAME β¨
getloginclass, setloginclass β get/set login class π
π LIBRARY π
Standard C Library (libc, -lc) β she's literally in libc, she's everywhere, main character energy fr fr. β¨
πΈ SYNOPSIS πΈ
#include <unistd.h>
int
getloginclass(char *name, size_t len);
int
setloginclass(const char *name);
π DESCRIPTION π
so getloginclass() is the one that tells you your login class name β the one that's attached to the process that's calling her, as previously set by setloginclass(). you, the caller, have to hand her a buffer called name with len bytes of room so she can drop the result in there. π
pro tip bestie: make that buffer at least MAXLOGNAME bytes long or you're gonna have a bad time. π
and setloginclass() is the system call that sets the login class of the calling process to name. she's β¨ exclusive β¨ β this one is restricted to the super-user only, periodt. she's normally used only when a brand new session is being created on behalf of the named user (like, at login time, or when a remote shell gets invoked). and the lore? processes inherit their login class from their parents. generational, honestly. π
π«Ά RETURN VALUES π«Ά
when everything slays: the value 0 is returned. π
when it does NOT slay: the value -1 is returned, and the global variable errno gets set to tell you what went wrong. not me getting humbled by errno again π
π¨ ERRORS π¨
here's the lil roster of errors these calls might throw at you, no filter:
[EFAULT]β thenameargument gave an invalid address. like, girl, that pointer is not pointing anywhere real. π[EINVAL]β thenameargument pointed to a string that was too long. login class names are limited toMAXLOGNAME(from<sys/param.h>) characters, currently 33 including the null. yes, thirty-three. count them. she's on a budget. π[EPERM]β the caller tried to set the login class and was not the super-user. bestie you are not on the list, i'm so sorry. π[ENAMETOOLONG]β the size of the buffer is smaller than the result to be returned. the buffer said "i'm full" and honestly? valid. π
π SEE ALSO π
ps(1), setusercontext(3), login.conf(5), rctl(8) β go read these next, they're the friend group. π
β HISTORY β
the getloginclass() and setloginclass() system calls first appeared in FreeBSD 9.0. vintage but make it iconic. π
and that's the whole page, bestie!! π¦β¨ this one came from the Debian crew and she's dated July 12, 2016 β a classic, an heirloom, a little time capsule. π thanks for reading, go set your login class responsibly (or don't, you need super-user anyway π ). π
π¦ 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) 2011 Edward Tomasz Napierala
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms