err = __hurd_file_name_lookup (&use_init_port, &__getdport, file_name, flags, mode, &result);  return err ? (__hurd_fail (err), MACH_PORT_NULL) : result;
error_t reauthenticate (file_t unauth) { error_t err; mach_port_t ref = __mach_reply_port (); error_t reauth (auth_t auth) { return __auth_user_authenticate (auth, unauth, ref, MACH_MSG_TYPE_MAKE_SEND, result); } err = __io_reauthenticate (unauth, ref, MACH_MSG_TYPE_MAKE_SEND); if (! err) err = (*use_init_port) (INIT_PORT_AUTH, &reauth); __mach_port_destroy (__mach_task_self (), ref); __mach_port_deallocate (__mach_task_self (), unauth); return err; }  nloops = 0; err = 0; do { file_t startdir = MACH_PORT_NULL; int dirport = INIT_PORT_CWDIR;  switch (doretry) { case FS_RETRY_REAUTH: if (err = reauthenticate (*result)) return err;   case FS_RETRY_NORMAL: #ifdef SYMLOOP_MAX if (nloops++ >= SYMLOOP_MAX) return ELOOP; #endif   if (retryname[0] == '\0') {  if (flags & O_EXLOCK) ;		 if (!err && (flags & O_SHLOCK)) ;		 if (!err && (flags & O_TRUNC)) err = __file_set_size (*result, 0);  if (err) __mach_port_deallocate (__mach_task_self (), *result); return err; }  startdir = *result; file_name = retryname; break;  case FS_RETRY_MAGICAL: switch (retryname[0]) { case '/': dirport = INIT_PORT_CRDIR; if (*result != MACH_PORT_NULL) __mach_port_deallocate (__mach_task_self (), *result); file_name = &retryname[1]; break;  case 'f': if (retryname[1] == 'd' && retryname[2] == '/') { int fd; char *end; int save = errno; errno = 0; fd = (int) strtol (&retryname[3], &end, 10); if (end == NULL || errno ||   (*end != '/' && *end != '\0')) { errno = save; return ENOENT; } if (! get_dtable_port) err = EGRATUITOUS; else { *result = (*get_dtable_port) (fd); if (*result == MACH_PORT_NULL) {  err = errno; errno = save; } } errno = save; if (err) return err; if (*end == '\0') return 0; else {  startdir = *result; file_name = end + 1;  break; } } else goto bad_magic; break;  case 'm': if (retryname[1] == 'a' && retryname[2] == 'c' && retryname[3] == 'h' && retryname[4] == 't' && retryname[5] == 'y' && retryname[6] == 'p' && retryname[7] == 'e') { error_t err; struct host_basic_info hostinfo; mach_msg_type_number_t hostinfocnt = HOST_BASIC_INFO_COUNT; char *p;  if (err = __host_info (__mach_host_self (), HOST_BASIC_INFO, (natural_t *) &hostinfo, &hostinfocnt)) return err; if (hostinfocnt != HOST_BASIC_INFO_COUNT) return EGRATUITOUS; p = _itoa (hostinfo.cpu_subtype, &retryname[8], 10, 0); *--p = '/'; p = _itoa (hostinfo.cpu_type, &retryname[8], 10, 0); if (p < retryname) abort ();	 if (p > retryname) strcpy (retryname, p); startdir = *result; } else goto bad_magic; break;  case 't': if (retryname[1] == 't' && retryname[2] == 'y') switch (retryname[3]) { error_t opentty (file_t *result) { error_t err; error_t ctty_open (file_t port) { if (port == MACH_PORT_NULL) return ENXIO;  return __termctty_open_terminal (port, flags, result); } err = (*use_init_port) (INIT_PORT_CTTYID, &ctty_open); if (! err) err = reauthenticate (*result); return err; }  case '\0': return opentty (result); case '/': if (err = opentty (&startdir)) return err; strcpy (retryname, &retryname[4]); break; default: goto bad_magic; } else goto bad_magic; break;  default: bad_magic: return EGRATUITOUS; } break;  default: return EGRATUITOUS; }  if (startdir != MACH_PORT_NULL) { err = lookup (startdir); __mach_port_deallocate (__mach_task_self (), startdir); startdir = MACH_PORT_NULL; } else err = (*use_init_port) (dirport, &lookup); } while (! err);  return err;
weak_alias (__file_name_split, file_name_split)file_t__file_name_lookup_under (file_t startdir,			  const char *file_name, int flags, mode_t mode){  error_t err;  file_t result;  error_t use_init_port (int which, error_t (*operate) (mach_port_t))    {      return (which == INIT_PORT_CWDIR ? (*operate) (startdir) :	      _hurd_ports_use (which, operate));    }  err = __hurd_file_name_lookup (&use_init_port, &__getdport,				 file_name, flags, mode,				 &result);  return err ? (__hurd_fail (err), MACH_PORT_NULL) : result;}