Browse Source

linuxthreads.old: cleanup a bit

Use __UCLIBC_HAS_TLS__ instead of USE___THREADS (although this LT implementation
will never support TLS).
Disable unused/unneeded members of the pthread_functions structure.
No redirect/forward for _pthread_cleanup_push/pop, it would have not worked anyway
due to the fact, that the structure member was not initialized. Disable it's possible
internal use in libc-lock.h.
Avoid using internals.h in libc_pthread_init.c (moving a prototype to pthread-functions.h).

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Peter S. Mazinger 13 years ago
parent
commit
71a7acbd4e

+ 4 - 0
libpthread/linuxthreads.old/forward.c

@@ -163,8 +163,12 @@ FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
 
 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 
+#if 0
 FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
+#endif
 FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
 
+#if 0
 FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
+#endif
 FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)

+ 0 - 2
libpthread/linuxthreads.old/internals.h

@@ -526,6 +526,4 @@ extern void __linuxthreads_reap_event (void);
 
 #include <pthread-functions.h>
 
-extern int * __libc_pthread_init (const struct pthread_functions *functions);
-
 #endif /* internals.h */

+ 2 - 3
libpthread/linuxthreads.old/libc_pthread_init.c

@@ -32,8 +32,7 @@
 # include <sys/wait.h>
 #endif
 
-#include "internals.h"
-#include "sysdeps/pthread/pthread-functions.h"
+#include <linuxthreads.old/sysdeps/pthread/pthread-functions.h>
 
 
 int __libc_multiple_threads attribute_hidden __attribute__((nocommon));
@@ -48,7 +47,7 @@ int * __libc_pthread_init (const struct pthread_functions *functions)
 	  sizeof (__libc_pthread_functions));
 #endif
 
-#if ! defined USE___THREAD && defined __UCLIBC_HAS_XLOCALE__
+#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_XLOCALE__
   /* Initialize thread-locale current locale to point to the global one.
      With __thread support, the variable's initializer takes care of this.  */
   uselocale (LC_GLOBAL_LOCALE);

+ 4 - 4
libpthread/linuxthreads.old/pthread.c

@@ -317,7 +317,7 @@ libpthread_hidden_proto(pthread_condattr_init)
 
 struct pthread_functions __pthread_functions =
   {
-#ifndef USE___THREAD
+#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__
     .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set,
     .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get,
     .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address,
@@ -365,10 +365,10 @@ struct pthread_functions __pthread_functions =
     .ptr_pthread_sigwait = pthread_sigwait,
     .ptr_pthread_raise = pthread_raise,
     .ptr__pthread_cleanup_push = _pthread_cleanup_push,
-    .ptr__pthread_cleanup_pop = _pthread_cleanup_pop
+    .ptr__pthread_cleanup_pop = _pthread_cleanup_pop,
 */
     .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
-    .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
+    .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore
   };
 #ifdef SHARED
 # define ptr_pthread_functions &__pthread_functions
@@ -526,7 +526,7 @@ int __pthread_initialize_manager(void)
   /* On non-MMU systems we make sure that the initial thread bounds don't overlap
    * with the manager stack frame */
   NOMMU_INITIAL_THREAD_BOUNDS(__pthread_manager_thread_tos,__pthread_manager_thread_bos);
-  PDEBUG("manager stack: size=%d, bos=%p, tos=%p\n", THREAD_MANAGER_STACK_SIZE,
+  PDEBUG("manager stack: size=%ld, bos=%p, tos=%p\n", THREAD_MANAGER_STACK_SIZE,
 	 __pthread_manager_thread_bos, __pthread_manager_thread_tos);
 #if 0
   PDEBUG("initial stack: estimate bos=%p, tos=%p\n",

+ 1 - 1
libpthread/linuxthreads.old/specific.c

@@ -167,7 +167,7 @@ void __pthread_destroy_specifics(void)
     __pthread_unlock(THREAD_GETMEM(self, p_lock));
 }
 
-#ifndef USE___THREAD
+#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__
 
 /* Thread-specific data for libc. */
 

+ 2 - 0
libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h

@@ -271,6 +271,7 @@ typedef pthread_key_t __libc_key_t;
       _pthread_cleanup_pop_restore (&_buffer, (DOIT));			      \
     }
 
+#if 0
 #define __libc_cleanup_push(fct, arg) \
     { struct _pthread_cleanup_buffer _buffer; 				      \
     __libc_maybe_call (_pthread_cleanup_push, (&_buffer, (fct), (arg)), 0)
@@ -278,6 +279,7 @@ typedef pthread_key_t __libc_key_t;
 #define __libc_cleanup_pop(execute) \
     __libc_maybe_call (_pthread_cleanup_pop, (&_buffer, execute), 0);	      \
     }
+#endif
 
 /* Create thread-specific key.  */
 #define __libc_key_create(KEY, DESTRUCTOR) \

+ 16 - 0
libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h

@@ -21,17 +21,21 @@
 #define _PTHREAD_FUNCTIONS_H	1
 
 #include <pthread.h>
+#if 0
 #include <setjmp.h>
 #include <linuxthreads.old/internals.h>
 
 struct fork_block;
+#endif
 
 /* Data type shared with libc.  The libc uses it to pass on calls to
    the thread functions.  Wine pokes directly into this structure,
    so if possible avoid breaking it and append new hooks to the end.  */
 struct pthread_functions
 {
+#if 0
   pid_t (*ptr_pthread_fork) (struct fork_block *);
+#endif
   int (*ptr_pthread_attr_destroy) (pthread_attr_t *);
   int (*ptr_pthread_attr_init) (pthread_attr_t *);
   int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *);
@@ -68,26 +72,36 @@ struct pthread_functions
   pthread_t (*ptr_pthread_self) (void);
   int (*ptr_pthread_setcancelstate) (int, int *);
   int (*ptr_pthread_setcanceltype) (int, int *);
+#if 0
   void (*ptr_pthread_do_exit) (void *retval, char *currentframe);
   void (*ptr_pthread_cleanup_upto) (__jmp_buf target,
 				    char *targetframe);
   pthread_descr (*ptr_pthread_thread_self) (void);
+#endif
+#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__
   int (*ptr_pthread_internal_tsd_set) (int key, const void *pointer);
   void * (*ptr_pthread_internal_tsd_get) (int key);
   void ** __attribute__ ((__const__))
     (*ptr_pthread_internal_tsd_address) (int key);
+#endif
+#if 0
   int (*ptr_pthread_sigaction) (int sig, const struct sigaction * act,
 				struct sigaction *oact);
   int (*ptr_pthread_sigwait) (const sigset_t *set, int *sig);
   int (*ptr_pthread_raise) (int sig);
+#endif
   int (*ptr_pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *,
 				       const struct timespec *);
+#if 0
   void (*ptr__pthread_cleanup_push) (struct _pthread_cleanup_buffer * buffer,
 				     void (*routine)(void *), void * arg);
+#endif
   void (*ptr__pthread_cleanup_push_defer) (struct _pthread_cleanup_buffer * buffer,
 					   void (*routine)(void *), void * arg);
+#if 0
   void (*ptr__pthread_cleanup_pop) (struct _pthread_cleanup_buffer * buffer,
 				    int execute);
+#endif
   void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer * buffer,
 					    int execute);
 };
@@ -95,4 +109,6 @@ struct pthread_functions
 /* Variable in libc.so.  */
 extern struct pthread_functions __libc_pthread_functions attribute_hidden;
 
+extern int * __libc_pthread_init (const struct pthread_functions *functions);
+
 #endif	/* pthread-functions.h */