Back to index

glibc  2.9
Functions
getgid.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 __getgid ()

Function Documentation

gid_t __getgid ( void  )

Definition at line 26 of file getgid.c.

{
  error_t err;
  gid_t gid;

  HURD_CRITICAL_BEGIN;
  __mutex_lock (&_hurd_id.lock);

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

  __mutex_unlock (&_hurd_id.lock);
  HURD_CRITICAL_END;

  return gid;
}

Here is the call graph for this function: