This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 3/3] posix: New Linux posix_spawn{p} implementation
- From: Eric Wong <e at 80x24 dot org>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Sun, 29 May 2016 09:54:29 +0000
- Subject: Re: [PATCH 3/3] posix: New Linux posix_spawn{p} implementation
- Authentication-results: sourceware.org; auth=none
- References: <1456770820-21341-1-git-send-email-adhemerval dot zanella at linaro dot org> <1456770820-21341-4-git-send-email-adhemerval dot zanella at linaro dot org>
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> +static int
> +__spawni_child (void *arguments)
<snip>
> +fail:
> + /* Since sizeof errno < PIPE_BUF, the write is atomic. */
> + ret = -ret;
> + if (ret)
> + while (write_not_cancel (p, &ret, sizeof ret) < 0)
> + continue;
> + exit (SPAWN_ERROR);
> +}
Sorry for not noticing earlier, but shouldn't it be
"_exit" instead of "exit" when the child fails?
At least that's what CLONE_VFORK section of the clone(2) manpage
documents, and what normal vfork requires.
> +static int
> +__spawnix (pid_t * pid, const char *file,
And the comment in __spawnix mentions "_exit", too:
> + /* The clone flags used will create a new child that will run in the same
> + memory space (CLONE_VM) and the execution of calling thread will be
> + suspend until the child calls execve or _exit. These condition as
> + signal below either by pipe write (_exit with SPAWN_ERROR) or
> + a successful execve.
> + Also since the calling thread execution will be suspend, there is not
> + need for CLONE_SETTLS. Although parent and child share the same TLS
> + namespace, there will be no concurrent access for TLS variables (errno
> + for instance). */
> + new_pid = CLONE (__spawni_child, STACK (stack, stack_size), stack_size,
> + CLONE_VM | CLONE_VFORK | SIGCHLD, &args);
Anyways thanks for implementing this so I can look forward
to using this faster version :)