This is the mail archive of the libc-alpha@sources.redhat.com 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]

LDT initialization after fork() for LinuxThreads?


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();


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