1// Package setuid provides functions to change the current UID and GID on *nix
2// systems.
3//
4// These functions are only available on *NIX platforms. On systems without
5// setres[ug]id, but only setre[ug]id, etc., setres[ug]id calls are translated
6// to such calls.
7//
8// Linux Support
9//
10// Linux support is somewhat harder than it seems. The syscall package provides
11// Setuid, etc., but on Linux, these functions are a trap:
12//
13// Linux has a faulty, non-compliant implementation of setuid(2) which only
14// changes the UID of the current thread, not the whole process. Amazingly,
15// even the manual page lies and claims that it affects the process.
16//
17// glibc's setuid syscall wrapper dispatches setuid calls to all threads. Ergo,
18// the manual page for setuid(3) but not setuid(2) is accurate.
19//
20// The same also applies to setgid, setresuid, setresgid, etc. Though oddly
21// enough not setgroups.
22//
23// Therefore setuid, setgid, setresuid and setresgid are dispatched through
24// cgo, hence this package rather than using the syscall package.
25package setuid
26