Back to index

glibc  2.9
Functions
dirfd.c File Reference
#include <dirent.h>
#include <dirstream.h>
#include <hurd/fd.h>
#include <errno.h>

Go to the source code of this file.

Functions

int dirfd (DIR *dirp)

Function Documentation

int dirfd ( DIR *  dirp)

Definition at line 26 of file dirfd.c.

{
  int fd;
  __mutex_lock (&_hurd_dtable_lock);
  for (fd = 0; fd < _hurd_dtablesize; ++fd)
    if (_hurd_dtable[fd] == dirp->__fd)
      break;
  if (fd == _hurd_dtablesize)
    {
      errno = EINVAL;
      fd = -1;
    }
  __mutex_unlock (&_hurd_dtable_lock);

  return fd;
}

Here is the call graph for this function: