Debian Codegraph @

upstream/debian-trixie/man2/getuid.2

raw
1 .\" Copyright 1993 Rickard E. Faith ([email protected])
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .\" Historical remark, aeb, 2004-06-05
6 .TH getuid 2 2024-05-02 "Linux man-pages 6.9.1"
7 .SH NAME
8 getuid, geteuid \- get user identity
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <unistd.h>
15 .P
16 .B uid_t getuid(void);
17 .B uid_t geteuid(void);
18 .fi
19 .SH DESCRIPTION
20 .BR getuid ()
21 returns the real user ID of the calling process.
22 .P
23 .BR geteuid ()
24 returns the effective user ID of the calling process.
25 .SH ERRORS
26 These functions are always successful
27 and never modify
28 .\" https://www.austingroupbugs.net/view.php?id=511
29 .\" 0000511: getuid and friends should not modify errno
30 .IR errno .
31 .SH STANDARDS
32 POSIX.1-2008.
33 .SH HISTORY
34 POSIX.1-2001, 4.3BSD.
35 .P
36 In UNIX\ V6 the
37 .BR getuid ()
38 call returned
39 .IR "(euid << 8) + uid" .
40 UNIX\ V7 introduced separate calls
41 .BR getuid ()
42 and
43 .BR geteuid ().
44 .P
45 The original Linux
46 .BR getuid ()
47 and
48 .BR geteuid ()
49 system calls supported only 16-bit user IDs.
50 Subsequently, Linux 2.4 added
51 .BR getuid32 ()
52 and
53 .BR geteuid32 (),
54 supporting 32-bit IDs.
55 The glibc
56 .BR getuid ()
57 and
58 .BR geteuid ()
59 wrapper functions transparently deal with the variations across kernel versions.
60 .P
61 On Alpha, instead of a pair of
62 .BR getuid ()
63 and
64 .BR geteuid ()
65 system calls, a single
66 .BR getxuid ()
67 system call is provided, which returns a pair of real and effective UIDs.
68 The glibc
69 .BR getuid ()
70 and
71 .BR geteuid ()
72 wrapper functions transparently deal with this.
73 See
74 .BR syscall (2)
75 for details regarding register mapping.
76 .SH SEE ALSO
77 .BR getresuid (2),
78 .BR setreuid (2),
79 .BR setuid (2),
80 .BR credentials (7)