ioctl_tty.2: Remove duplicated text
[man-pages.git] / man2 / getuid.2
blob48e734cf2e967dbfb47832f49cfb04b7b3ce8914
1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\"
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.
7 .\"
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.
12 .\"
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
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Historical remark, aeb, 2004-06-05
26 .TH GETUID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 getuid, geteuid \- get user identity
29 .SH SYNOPSIS
30 .nf
31 .B #include <unistd.h>
32 .PP
33 .B uid_t getuid(void);
34 .B uid_t geteuid(void);
35 .fi
36 .SH DESCRIPTION
37 .BR getuid ()
38 returns the real user ID of the calling process.
39 .PP
40 .BR geteuid ()
41 returns the effective user ID of the calling process.
42 .SH ERRORS
43 These functions are always successful
44 and never modify
45 .\" https://www.austingroupbugs.net/view.php?id=511
46 .\" 0000511: getuid and friends should not modify errno
47 .IR errno .
48 .SH CONFORMING TO
49 POSIX.1-2001, POSIX.1-2008, 4.3BSD.
50 .SH NOTES
51 .SS History
52 In UNIX\ V6 the
53 .BR getuid ()
54 call returned
55 .IR "(euid << 8) + uid" .
56 UNIX\ V7 introduced separate calls
57 .BR getuid ()
58 and
59 .BR geteuid ().
60 .PP
61 The original Linux
62 .BR getuid ()
63 and
64 .BR geteuid ()
65 system calls supported only 16-bit user IDs.
66 Subsequently, Linux 2.4 added
67 .BR getuid32 ()
68 and
69 .BR geteuid32 (),
70 supporting 32-bit IDs.
71 The glibc
72 .BR getuid ()
73 and
74 .BR geteuid ()
75 wrapper functions transparently deal with the variations across kernel versions.
76 .PP
77 On Alpha, instead of a pair of
78 .BR getuid ()
79 and
80 .BR geteuid ()
81 system calls, a single
82 .BR getxuid ()
83 system call is provided, which returns a pair of real and effective UIDs.
84 The glibc
85 .BR getuid ()
86 and
87 .BR geteuid ()
88 wrapper functions transparently deal with this.
89 See
90 .BR syscall (2)
91 for details regarding register mapping.
92 .SH SEE ALSO
93 .BR getresuid (2),
94 .BR setreuid (2),
95 .BR setuid (2),
96 .BR credentials (7)