+#include "fileio.h"
+#include "agent.h"
+#include "gdb_wait.h"
+#include "filestuff.h"
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* A pointer to what is returned by inf_child_target. Used by
+ inf_child_open to push the most-derived target in reaction to
+ "target native". */
+static struct target_ops *inf_child_ops = NULL;
+
+/* Helper function for child_wait and the derivatives of child_wait.
+ HOSTSTATUS is the waitstatus from wait() or the equivalent; store our
+ translation of that in OURSTATUS. */
+void
+store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
+{
+ if (WIFEXITED (hoststatus))
+ {
+ ourstatus->kind = TARGET_WAITKIND_EXITED;
+ ourstatus->value.integer = WEXITSTATUS (hoststatus);
+ }
+ else if (!WIFSTOPPED (hoststatus))
+ {
+ ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+ ourstatus->value.sig = gdb_signal_from_host (WTERMSIG (hoststatus));
+ }
+ else
+ {
+ ourstatus->kind = TARGET_WAITKIND_STOPPED;
+ ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (hoststatus));
+ }
+}