geteuid -- Determine Effective User ID

SYNOPSIS

 #include <sys/types.h>
 #include <unistd.h>

 uid_t geteuid(void);
 

DESCRIPTION

geteuid determines the effective user ID of the calling process.

RETURN VALUE

If successful, geteuid returns the effective user ID of the calling process. Under unusual conditions (for instance, if OpenEdition is not running) getegid can fail. In this case, geteuid issues an MVS user ABEND 1230 to indicate the error.

EXAMPLE

The following code fragment illustrates the use of geteuid to determine the effective user ID of a calling process:
  #include <sys/types.h>
  #include <unistd.h>
  #include <stdio.h>

  main()
  {
     uid_t uid, euid;

     uid = getuid();
     euid = geteuid();
     printf("The effective user id is  %dn", (int) geteuid());
     printf("The real user id is  %dn", (int) getuid());
     if (uid == euid)
        printf("Effective user id and Real user id are the samen");
  }

 

RELATED FUNCTIONS

getegid, getuid, seteuid, setuid


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.