Re: [BUG 2.4.6] PPID of a process is set to itself

From: Ulrich Drepper (
Date: Tue Jul 17 2001 - 02:08:27 EST

Linus Torvalds <> writes:

> if (!has_created_master_process) {
> new_me = clone(CLONE_VM | SIGCHLD);
> if (new_me > 0) {
> /* Original thread turns into master process */
> printf("I am the new master process, bow down before me!\n");
> has_created_master_process = 1;
> for (;;) {
> if (!waitpid(-1, NULL, 0))
> continue;
> if (errno == ENOCHLD)
> exit(0);
> .. we could do signal propagation here ..
> }
> }
> /* This child now takes over the role of the original thread */

A bit more complicated due to switching of stacks but that's basically
it. With this clone model using n+1 threads is the only way to get
the semantics right.

> Also, please do notice that one fundamental part of the CLONE_THREAD logic
> never made it into a stable kernel: the shared signal handling. So while
> CLONE_THREAD allows for many pthread-like things (one common process ID
> shared by all threads, for example), the most fundamental part of it was
> not actually merged into the standard kernel because of stability concerns
> in late pre-2.4 test cycle.

Exactly. This is holding off everything. The way this is solved
(basically: the limitations imposed on the userland implementation)
will determine much of the implementation.

I've done already a great deal of the implementation when Linus first
put the code in the late 2.3 kernels. If somebody finally would get
the signal handling stuff done (and a few more little things, some
Linus already agreed on) we could have a compliant pthread
implementation soon.

---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at   `------------------------
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Jul 23 2001 - 21:00:08 EST