Back to index

glibc  2.9
Functions
getegid.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

gid_t __getegid ()

Function Documentation

gid_t __getegid ( void  )

Definition at line 26 of file getegid.c.

{
  error_t err;
  gid_t egid;

  HURD_CRITICAL_BEGIN;
  __mutex_lock (&_hurd_id.lock);

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

  __mutex_unlock (&_hurd_id.lock);
  HURD_CRITICAL_END;

  return egid;
}

Here is the call graph for this function: