+ return 0;
+}
+
+/* Creates and returns a new struct process with the specified 'name' and
+ * 'pid'. */
+static struct process *
+process_register(const char *name, pid_t pid)
+{
+ struct process *p;
+ const char *slash;
+
+ p = xzalloc(sizeof *p);
+ p->pid = pid;
+ slash = strrchr(name, '/');
+ p->name = xstrdup(slash ? slash + 1 : name);
+ p->exited = false;
+
+ list_push_back(&all_processes, &p->node);
+
+ return p;
+}
+
+/* Starts a subprocess with the arguments in the null-terminated argv[] array.
+ * argv[0] is used as the name of the process. Searches the PATH environment
+ * variable to find the program to execute.
+ *
+ * This function may not be called after creating any additional threads.
+ *
+ * All file descriptors are closed before executing the subprocess, except for
+ * fds 0, 1, and 2.
+ *
+ * Returns 0 if successful, otherwise a positive errno value indicating the
+ * error. If successful, '*pp' is assigned a new struct process that may be
+ * used to query the process's status. On failure, '*pp' is set to NULL. */
+int
+process_start(char **argv, struct process **pp)
+{
+ pid_t pid;
+ int error;
+
+ assert_single_threaded();
+
+ *pp = NULL;
+ COVERAGE_INC(process_start);
+ error = process_prestart(argv);
+ if (error) {
+ return error;
+ }
+