++/* Returns the file descriptor associated with the given handle.
++ Terminates the process if HANDLE is not associated with an
++ open ordinary file. */
++static struct file_descriptor *
++lookup_file_fd (int handle)
++{
++ struct file_descriptor *fd = lookup_fd (handle);
++ if (fd->file == NULL)
++ thread_exit ();
++ return fd;
++}
++
++/* Returns the file descriptor associated with the given handle.
++ Terminates the process if HANDLE is not associated with an
++ open directory. */
++static struct file_descriptor *
++lookup_dir_fd (int handle)
++{
++ struct file_descriptor *fd = lookup_fd (handle);
++ if (fd->dir == NULL)
++ thread_exit ();
++ return fd;
++}
++