GETLOGINCLASS(2)
π NAME π
getloginclass, setloginclass β get/set login class
okay bestie, welcome to getloginclass(2) from the System Calls Manual β it's the login-class get/set duo, and it's lowkey iconic π
π LIBRARY π
Standard C Library (libc, -lc) β that's the home base, slay β¨
β¨ SYNOPSIS β¨
#include <unistd.h>
int
getloginclass(char *name, size_t len);
int
setloginclass(const char *name);
π¦ DESCRIPTION π¦
So getloginclass() gives you back the login class name attached to the calling process β the one that was previously set by setloginclass() π
. You, the caller, have to hand over a buffer called name with len bytes of room to hold the result, and that buffer should be at least MAXLOGNAME bytes long. No tiny-buffer nonsense, bestie.
setloginclass() is the system call that sets the login class of the calling process to name. This one is restricted to the super-user, and it's normally used only when a new session is being created on behalf of the named user β for example, at login time, or when a remote shell is invoked. Processes inherit login class from their parents, iykyk π«Ά
π₯ RETURN VALUES π₯
When it goes right, you get 0. When it doesn't, you get -1, and the global variable errno is set to indicate the error. Simple as that, no cap. π«Ά
π ERRORS π
The following errors may be returned by these calls β read 'em and weep (affectionately):
[EFAULT]β thenameargument gave an invalid address.[EINVAL]β thenameargument pointed to a string that was too long. Login class names are limited toMAXLOGNAME(from<sys/param.h>) characters, currently33including null.[EPERM]β the caller tried to set the login class and was not the super-user.[ENAMETOOLONG]β the size of the buffer is smaller than the result to be returned.
π SEE ALSO π
π HISTORY π
getloginclass() and setloginclass() first appeared in FreeBSD 9.0.
and that's the whole page, bestie π huge shoutout to Debian for this one, dated July 12, 2016 β stay classy, literally π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2011 Edward Tomasz Napierala
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms