+inf_child_pid_to_exec_file (struct target_ops *self, int pid)
+{
+ /* This target doesn't support translation of a process ID to the
+ filename of the executable file. */
+ return NULL;
+}
+
+/* Implementation of to_fileio_open. */
+
+static int
+inf_child_fileio_open (struct target_ops *self,
+ struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno)
+{
+ int nat_flags;
+ mode_t nat_mode;
+ int fd;
+
+ if (fileio_to_host_openflags (flags, &nat_flags) == -1
+ || fileio_to_host_mode (mode, &nat_mode) == -1)
+ {
+ *target_errno = FILEIO_EINVAL;
+ return -1;
+ }
+
+ fd = gdb_open_cloexec (filename, nat_flags, nat_mode);
+ if (fd == -1)
+ *target_errno = host_to_fileio_error (errno);
+
+ return fd;
+}
+
+/* Implementation of to_fileio_pwrite. */
+
+static int
+inf_child_fileio_pwrite (struct target_ops *self,
+ int fd, const gdb_byte *write_buf, int len,
+ ULONGEST offset, int *target_errno)
+{
+ int ret;
+
+#ifdef HAVE_PWRITE
+ ret = pwrite (fd, write_buf, len, (long) offset);
+#else
+ ret = -1;
+#endif
+ /* If we have no pwrite or it failed for this file, use lseek/write. */
+ if (ret == -1)
+ {
+ ret = lseek (fd, (long) offset, SEEK_SET);
+ if (ret != -1)
+ ret = write (fd, write_buf, len);
+ }
+
+ if (ret == -1)
+ *target_errno = host_to_fileio_error (errno);
+
+ return ret;
+}
+
+/* Implementation of to_fileio_pread. */
+
+static int
+inf_child_fileio_pread (struct target_ops *self,
+ int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *target_errno)
+{
+ int ret;
+
+#ifdef HAVE_PREAD
+ ret = pread (fd, read_buf, len, (long) offset);
+#else
+ ret = -1;
+#endif
+ /* If we have no pread or it failed for this file, use lseek/read. */
+ if (ret == -1)
+ {
+ ret = lseek (fd, (long) offset, SEEK_SET);
+ if (ret != -1)
+ ret = read (fd, read_buf, len);
+ }
+
+ if (ret == -1)
+ *target_errno = host_to_fileio_error (errno);
+
+ return ret;
+}
+
+/* Implementation of to_fileio_fstat. */
+
+static int
+inf_child_fileio_fstat (struct target_ops *self, int fd,
+ struct stat *sb, int *target_errno)
+{
+ int ret;
+
+ ret = fstat (fd, sb);
+ if (ret == -1)
+ *target_errno = host_to_fileio_error (errno);
+
+ return ret;
+}
+
+/* Implementation of to_fileio_close. */
+
+static int
+inf_child_fileio_close (struct target_ops *self, int fd, int *target_errno)
+{
+ int ret;
+
+ ret = close (fd);
+ if (ret == -1)
+ *target_errno = host_to_fileio_error (errno);
+
+ return ret;
+}
+
+/* Implementation of to_fileio_unlink. */
+
+static int
+inf_child_fileio_unlink (struct target_ops *self,
+ struct inferior *inf, const char *filename,
+ int *target_errno)
+{
+ int ret;
+
+ ret = unlink (filename);
+ if (ret == -1)
+ *target_errno = host_to_fileio_error (errno);
+
+ return ret;
+}
+
+/* Implementation of to_fileio_readlink. */
+
+static char *
+inf_child_fileio_readlink (struct target_ops *self,
+ struct inferior *inf, const char *filename,
+ int *target_errno)