1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Historical remark, aeb, 2004-06-05
26 .TH GETUID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
28 getuid, geteuid \- get user identity
31 .B #include <unistd.h>
33 .B uid_t getuid(void);
34 .B uid_t geteuid(void);
38 returns the real user ID of the calling process.
41 returns the effective user ID of the calling process.
43 These functions are always successful
45 .\" https://www.austingroupbugs.net/view.php?id=511
46 .\" 0000511: getuid and friends should not modify errno
49 POSIX.1-2001, POSIX.1-2008, 4.3BSD.
55 .IR "(euid << 8) + uid" .
56 UNIX\ V7 introduced separate calls
65 system calls supported only 16-bit user IDs.
66 Subsequently, Linux 2.4 added
70 supporting 32-bit IDs.
75 wrapper functions transparently deal with the variations across kernel versions.
77 On Alpha, instead of a pair of
81 system calls, a single
83 system call is provided, which returns a pair of real and effective UIDs.
88 wrapper functions transparently deal with this.
91 for details regarding register mapping.