Skip to content
BSD syscall#126

svc · unix #126

setreuid

Sets the real and effective user IDs simultaneously.

Prototype

int setreuid(uid_t ruid, uid_t euid);

Returns: int

Arguments

NameTypeDirDescription
ruiduid_t-
euiduid_t-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard126
xnu-1486.2.11126
xnu-1504.15.3126
xnu-1504.3.12126
xnu-1504.7.4126
xnu-1504.9.17126
xnu-1504.9.26126
xnu-1504.9.37126

Notes

Each argument may be -1 to leave the corresponding ID unchanged. An unprivileged caller can only swap among real, effective, and saved-set UIDs; the kernel also updates the saved-set UID to the new effective in certain combinations, which historically caused subtle privilege-retention bugs.

Related APIs

setuidseteuidgetuidgeteuidissetugid