summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-08-19 10:05:03 +0000
committerEric Andersen <andersen@codepoet.org>2002-08-19 10:05:03 +0000
commit3358b761b15daa480ca0ca788b3fe077ac967674 (patch)
treed1cea37dd0fbc86a85259b025e62f3e672d68368 /libpthread
parentc8b3ccaedb7e08a2d25ce4485ff7e13ddc6e92a5 (diff)
Based on work by Stefan Allius, arrange for early initialization of
pthread stuff. Also, don't bother building libthread_db unless we are debugging. -Erik
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/Makefile5
-rw-r--r--libpthread/linuxthreads/errno.c13
-rw-r--r--libpthread/linuxthreads/events.c2
-rw-r--r--libpthread/linuxthreads/internals.h1
-rw-r--r--libpthread/linuxthreads/pthread.c12
5 files changed, 19 insertions, 14 deletions
diff --git a/libpthread/Makefile b/libpthread/Makefile
index 1bf8e8c66..bdd097d38 100644
--- a/libpthread/Makefile
+++ b/libpthread/Makefile
@@ -30,7 +30,10 @@ LIBTHREAD_DB_SHARED_FULLNAME=libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SU
DIRS=
ifeq ($(strip $(INCLUDE_THREADS)),true)
- DIRS+=linuxthreads linuxthreads_db
+ DIRS+=linuxthreads
+endif
+ifeq ($(strip $(DODEBUG)),true)
+ DIRS+=linuxthreads_db
endif
ALL_SUBDIRS = linuxthreads linuxthreads_db
diff --git a/libpthread/linuxthreads/errno.c b/libpthread/linuxthreads/errno.c
index 46e2fbb35..9f651b8ec 100644
--- a/libpthread/linuxthreads/errno.c
+++ b/libpthread/linuxthreads/errno.c
@@ -21,28 +21,15 @@
#include "pthread.h"
#include "internals.h"
#include <stdio.h>
-extern int _errno;
-extern int _h_errno;
int * __errno_location()
{
- /* check, if the library is initilize */
- if (__pthread_initial_thread_bos != NULL)
- {
pthread_descr self = thread_self();
return THREAD_GETMEM (self, p_errnop);
- }
- return &_errno;
}
int * __h_errno_location()
{
- /* check, if the library is initilize */
- if (__pthread_initial_thread_bos != NULL)
- {
pthread_descr self = thread_self();
-
return THREAD_GETMEM (self, p_h_errnop);
- }
- return &_h_errno;
}
diff --git a/libpthread/linuxthreads/events.c b/libpthread/linuxthreads/events.c
index e5be3d935..a4bf1f898 100644
--- a/libpthread/linuxthreads/events.c
+++ b/libpthread/linuxthreads/events.c
@@ -19,6 +19,8 @@
/* The functions contained here do nothing, they just return. */
+#include "internals.h"
+
void
__linuxthreads_create_event (void)
{
diff --git a/libpthread/linuxthreads/internals.h b/libpthread/linuxthreads/internals.h
index 933ccb5f3..ffa52aff3 100644
--- a/libpthread/linuxthreads/internals.h
+++ b/libpthread/linuxthreads/internals.h
@@ -426,6 +426,7 @@ void __pthread_reset_main_thread(void);
void __fresetlockfiles(void);
void __pthread_manager_adjust_prio(int thread_prio);
void __pthread_set_own_extricate_if(pthread_descr self, pthread_extricate_if *peif);
+void __pthread_initialize_minimal (void);
extern int __pthread_attr_setguardsize __P ((pthread_attr_t *__attr,
size_t __guardsize));
diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
index 548f83a5f..5142d4c13 100644
--- a/libpthread/linuxthreads/pthread.c
+++ b/libpthread/linuxthreads/pthread.c
@@ -236,6 +236,18 @@ void (*__pthread_suspend)(pthread_descr) = __pthread_suspend_old;
static void pthread_initialize(void) __attribute__((constructor));
+ /* Do some minimal initialization which has to be done during the
+ startup of the C library. */
+void __pthread_initialize_minimal(void)
+{
+ /* If we have special thread_self processing, initialize
+ * that for the main thread now. */
+#ifdef INIT_THREAD_SELF
+ INIT_THREAD_SELF(&__pthread_initial_thread, 0);
+#endif
+}
+
+
static void pthread_initialize(void)
{
struct sigaction sa;