1GETUID(3P)                 POSIX Programmer's Manual                GETUID(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       getuid — get a real user ID
13

SYNOPSIS

15       #include <unistd.h>
16
17       uid_t getuid(void);
18

DESCRIPTION

20       The getuid() function shall return the real  user  ID  of  the  calling
21       process.  The getuid() function shall not modify errno.
22

RETURN VALUE

24       The getuid() function shall always be successful and no return value is
25       reserved to indicate the error.
26

ERRORS

28       No errors are defined.
29
30       The following sections are informative.
31

EXAMPLES

33   Setting the Effective User ID to the Real User ID
34       The following example sets the effective user ID of the calling process
35       to the real user ID.
36
37
38           #include <unistd.h>
39           ...
40           seteuid(getuid());
41

APPLICATION USAGE

43       None.
44

RATIONALE

46       In a conforming environment, getuid() will always succeed. It is possi‐
47       ble for implementations to provide an extension where a  process  in  a
48       non-conforming  environment will not be associated with a user or group
49       ID. It is recommended that such implementations  return  (uid_t)-1  and
50       set  errno  to  indicate such an environment; doing so does not violate
51       this standard, since such an environment is already an extension.
52

FUTURE DIRECTIONS

54       None.
55

SEE ALSO

57       getegid(),  geteuid(),  getgid(),   setegid(),   seteuid(),   setgid(),
58       setregid(), setreuid(), setuid()
59
60       The Base Definitions volume of POSIX.1‐2017, <sys_types.h>, <unistd.h>
61
63       Portions  of  this text are reprinted and reproduced in electronic form
64       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
65       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
66       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
67       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
68       event of any discrepancy between this version and the original IEEE and
69       The  Open Group Standard, the original IEEE and The Open Group Standard
70       is the referee document. The original Standard can be  obtained  online
71       at http://www.opengroup.org/unix/online.html .
72
73       Any  typographical  or  formatting  errors that appear in this page are
74       most likely to have been introduced during the conversion of the source
75       files  to  man page format. To report such errors, see https://www.ker
76       nel.org/doc/man-pages/reporting_bugs.html .
77
78
79
80IEEE/The Open Group                  2017                           GETUID(3P)
Impressum