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.11—126
xnu-1504.15.3—126
xnu-1504.3.12—126
xnu-1504.7.4—126
xnu-1504.9.17—126
xnu-1504.9.26—126
xnu-1504.9.37—126

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