BSD syscall#50
svc · unix #50
setlogin
Sets the login name of the current session.
Prototype
int setlogin(char *namebuf);Returns: int
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| namebuf | char | - |
Version history
| XNU tag | macOS | # |
|---|---|---|
| xnu-1456.1.26 | macOS 10.6 Snow Leopard | 50 |
| xnu-1486.2.11 | — | 50 |
| xnu-1504.15.3 | — | 50 |
| xnu-1504.3.12 | — | 50 |
| xnu-1504.7.4 | — | 50 |
| xnu-1504.9.17 | — | 50 |
| xnu-1504.9.26 | — | 50 |
| xnu-1504.9.37 | — | 50 |
Notes
Requires effective root and only affects the session of the calling process. Used by login(1) and sshd to record the authenticated user, which getlogin() then retrieves. Should be called once after setsid()/setpgid() and before dropping privileges.
Related APIs
getloginsetsidsetuidsetgidinitgroups