geteuid()--Get Effective User ID


  Syntax
 #include <unistd.h>

 uid_t geteuid(void);  
  Service Program Name: QSYPAPI

  Default Public Authority: *USE

  Threadsafe: Yes

The geteuid() function returns the effective user ID (UID) of the calling thread. The effective UID is the user ID under which the thread is currently running. The effective UID of a thread may change while the thread is running.


Parameters

None.


Authorities

No authorization is required.


Return Value

If successful, the value returned by geteuid() represents the effective UID. Under unusual conditions geteuid() can fail and will send error message CPE3418.


Error Conditions

If geteuid() is not successful, errno usually indicates one of the following errors. Under some conditions, errno could indicate an error other than those listed here.


Error Messages

The following messages may be sent from this function:


Related Information


Example

The following example gets the effective UID.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <unistd.h>

main()
{
  uid_t ef_uid;

  ef_uid = geteuid(void);
  printf("The effective UID is: %u\n", ef_uid);

}

Output:

  The effective UID is: 1957

API introduced: V3R1

[ Back to top | UNIX-Type APIs | APIs by category ]