Gets the real or effective user ID of the current process.
Standard C Library (libc.a)
#include <sys/types.h> #include <unistd.h>
uid_t getuid(void)
uid_t geteuid(void)
#include <id.h>
uid_t getuidx (int type);
The getuid subroutine returns the real user ID of the current process. The geteuid subroutine returns the effective user ID of the current process.
The getuidx subroutine returns the user ID indicated by the type parameter of the calling process.
These subroutines are part of Base Operating System (BOS) Runtime.
The getuid, geteuid and getuidx subroutines return the corresponding user ID. The getuid and geteuid subroutines always succeed.
The getuidx subroutine will return -1 and set the global errno variable to EINVAL if the type parameter is not one of ID_REAL, ID_EFFECTIVE, ID_SAVED or ID_LOGIN.
type | Specifies the user ID to get. Must be one of ID_REAL (real user ID), ID_EFFECTIVE (effective user ID), ID_SAVED (saved set-user ID) or ID_LOGIN (login user ID). |
If the getuidx subroutine fails the following is returned:
EINVAL | Indicates the value of the type parameter is invalid. |
The setuid subroutine.
List of Security and Auditing Subroutines, Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.