setuid(2)
DESCRIPTION
Sets the real and effective user IDs to uid. A non‑root caller may select only its current real or effective UID.
SYNOPSIS
long setuid(uint32_t uid);
RETURN VALUE
- Returns zero, or a negative errno.
ERRORS
-EINVAL- Uid is outside the unsigned 32‑bit range.
-EPERM- The current effective UID is nonzero and uid is neither the real nor effective UID.
-ESRCH- There is no current process.
NOTES
The kernel stores credentials per process.