__mutex_lock (&_hurd_dtable_lock); for (fd = 0; fd < _hurd_dtablesize; ++fd) if (_hurd_dtable[fd] == cookie) { __mutex_unlock (&_hurd_dtable_lock); return fd; } __mutex_unlock (&_hurd_dtable_lock);
if (err = _hurd_fd_read (fd, buf, &n)) return fd_fail (fd, err);
DEFUN(__stdio_fileno, (cookie), PTR cookie){  int fd;  if (! cookie)    return __hurd_fail (EBADF);  __mutex_lock (&_hurd_dtable_lock);  for (fd = 0; fd < _hurd_dtablesize; ++fd)    if (_hurd_dtable[fd] == cookie)      {	__mutex_unlock (&_hurd_dtable_lock);	return fd;      }  __mutex_unlock (&_hurd_dtable_lock);  /* This should never happen, because this function should not be     installed as a stream's __fileno function unless that stream's cookie     points to a file descriptor.  */  errno = EGRATUITOUS;  return -1;}