Back to index

glibc  2.9
Functions
getuid.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 __getuid ()

Function Documentation

uid_t __getuid ( void  )

Definition at line 26 of file getuid.c.

{
  error_t err;
  uid_t uid;

  HURD_CRITICAL_BEGIN;
  __mutex_lock (&_hurd_id.lock);

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

  __mutex_unlock (&_hurd_id.lock);
  HURD_CRITICAL_END;

  return uid;
}

Here is the call graph for this function: