Back to index

glibc  2.9
Functions
geteuid.c File Reference
#include <errno.h>
#include <unistd.h>
#include <hurd.h>
#include <hurd/id.h>

Go to the source code of this file.

Functions

uid_t __geteuid ()

Function Documentation

uid_t __geteuid ( void  )

Definition at line 26 of file geteuid.c.

{
  error_t err;
  uid_t euid;

  HURD_CRITICAL_BEGIN;
  __mutex_lock (&_hurd_id.lock);

  if (err = _hurd_check_ids ())
    {
      errno = err;
      euid = -1;
    }
  else if (_hurd_id.gen.nuids >= 1)
    euid = _hurd_id.gen.uids[0];
  else if (_hurd_id.aux.nuids >= 1)
    /* We have no effective uids.  Return the real uid.  */
    euid = _hurd_id.aux.uids[0];
  else
    {
      /* We do not even have a real uid.  */
      errno = EGRATUITOUS;
      euid = -1;
    }

  __mutex_unlock (&_hurd_id.lock);
  HURD_CRITICAL_END;

  return euid;
}

Here is the call graph for this function: