This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/3] posix: New Linux posix_spawn{p} implementation

Adhemerval Zanella <> wrote:
> +static int
> +__spawni_child (void *arguments)


> +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 :)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]