Messages in this thread |  | | Subject | Re: [BUG 2.4.6] PPID of a process is set to itself | | From | Ulrich Drepper <> | | Date | 17 Jul 2001 00:08:27 -0700 |
| |
Linus Torvalds <torvalds@transmeta.com> 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 redhat.com `------------------------ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |