nptl-0.29 tcbhead_t

Nick <[email protected]>
Newsgroups gmane.comp.lib.phil
Message-ID <[email protected]>
I was getting the following:
../sysdeps/generic/libc-start.c: In function `__libc_start_main':
../sysdeps/generic/libc-start.c:147: error: structure has no member named `tcbhead'
make[2]: *** [/usr/src/build-glibc/csu/libc-start.o] Error 1
make[2]: Leaving directory `/usr/src/libc-work/csu'
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory `/usr/src/libc-work'
make: *** [all] Error 2

about 30 seconds into a build of cvs glibc cvs 030312+nptl 0.29, the line contains a call to
THREAD_SELF in tls.h

before I go too far, is this a tools problem? I am using cvs binutils from 7th of march, gcc from
3rd of march

So that I can understand a build problem with nptl 0.29 (and nptl itself) a bit more clearly:
why was the tcbhead_t in struct pthread made anonymous?  After this change THREAD_SELF can no
longer resolve: offsetof(struct pthread, self)

The changelog mentions that the pthread struct now contains: '...an anonymous union containing an
anonymous tcbhead_t' but my wild guess is that tcbhead_t is a singleton either amongst all threads
or within the realm of a single thread, and is populated with the properties a thread when context
is switched to that thread.  am I correct?  where in the code is tcbhead_t populated?

how do THREAD_SELF and other functions like THREAD_SINGLE_P work if they haven't got a handle to
the tcbhead_t?

what are the consequences of a change such as this (not proposing it, although it does fix the
build process until the next broken macro):

diff -ur nptl-0.29/descr.h libc-work/nptl/descr.h
--- nptl-0.29/descr.h   2003-03-10 17:33:29.000000000 +0000
+++ libc-work/nptl/descr.h      2003-03-13 03:30:02.000000000 +0000
@@ -61,7 +61,7 @@
   /* This overlaps tcbhead_t (see tls.h), as used for TLS without threads.  */
   union
   {
-    tcbhead_t;
+    tcbhead_t tcbh;
     void *__padding[16];
   };
 #elif TLS_MULTIPLE_THREADS_IN_TCB
diff -ur nptl-0.29/sysdeps/i386/tls.h libc-work/nptl/sysdeps/i386/tls.h
--- nptl-0.29/sysdeps/i386/tls.h        2003-03-10 17:33:37.000000000 +0000
+++ libc-work/nptl/sysdeps/i386/tls.h   2003-03-13 03:33:56.000000000 +0000
@@ -240,7 +240,7 @@
 # define THREAD_SELF \
   ({ struct pthread *__self;                                                 \
      asm ("movl %%gs:%c1,%0" : "=r" (__self)                                 \
-         : "i" (offsetof (struct pthread, self)));                           \
+         : "i" (offsetof (struct pthread, tcbh.self)));                      \
      __self;})
 
 
Thanks

  Nick

_______________________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com.hk address at http://mail.english.yahoo.com.hk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.