LDT initialization after fork() for LinuxThreads?
Wolfram Gloger
Wolfram.Gloger@dent.med.uni-muenchen.de
Wed Jun 27 07:47:00 GMT 2001
Hi,
Maybe I'm missing something obvious, or I just don't understand the
LDT stuff sufficiently.
But, my tests indicate that modified LDT entries aren't inherited
across fork(). So, aren't we missing something like the untested
patch below, since __pthread_reset_main_thread() doesn't do any
INIT_THREAD_SELF?
Regards,
Wolfram.
--- linuxthreads/ptfork.c~ Sun Jan 7 05:35:20 2001
+++ linuxthreads/ptfork.c Wed Jun 27 16:36:10 2001
@@ -78,6 +78,7 @@
pid_t __fork(void)
{
+ pthread_descr self = THREAD_SELF;
pid_t pid;
pthread_mutex_lock(&pthread_atfork_lock);
@@ -89,6 +90,9 @@
pid = __libc_fork();
if (pid == 0) {
+#ifdef INIT_THREAD_SELF
+ INIT_THREAD_SELF(self, self->p_nr);
+#endif
__pthread_reset_main_thread();
__fresetlockfiles();
More information about the Libc-alpha
mailing list