summaryrefslogtreecommitdiff
path: root/libc/misc/internals
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-08-19 10:10:01 +0000
committerEric Andersen <andersen@codepoet.org>2002-08-19 10:10:01 +0000
commitc0dc392defac1b8ab00fd0d2483675d1d0805127 (patch)
treee37142894e87b78d4608e8aeadb842560659cd1d /libc/misc/internals
parentd7643439eba4ded2253cc4c0c5b2531ee82bd4ea (diff)
Call the pthread setup junk early if possible.
Diffstat (limited to 'libc/misc/internals')
-rw-r--r--libc/misc/internals/__uClibc_main.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 81cc57d94..e9af10dcd 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -21,6 +21,7 @@
*/
extern int main(int argc, char **argv, char **envp);
extern void weak_function _init(void);
+extern void weak_function __pthread_initialize_minimal(void);
extern void weak_function _fini(void);
extern void weak_function _stdio_init(void);
extern int *weak_const_function __errno_location(void);
@@ -56,6 +57,11 @@ __uClibc_main(int argc, char **argv, char **envp)
__environ = envp;
}
+#ifdef _LIBC_REENTRANT
+ if (likely(__pthread_initialize_minimal!=NULL))
+ __pthread_initialize_minimal();
+#endif
+
#if 0
/* Some security at this point. Prevent starting a SUID binary
* where the standard file descriptors are not opened. We have
@@ -67,7 +73,8 @@ __uClibc_main(int argc, char **argv, char **envp)
#ifdef __UCLIBC_HAS_LOCALE__
/* Initialize the global locale structure. */
- if (likely(_locale_init!=NULL)) _locale_init();
+ if (likely(_locale_init!=NULL))
+ _locale_init();
#endif
/*
@@ -78,12 +85,12 @@ __uClibc_main(int argc, char **argv, char **envp)
_stdio_init();
/* Arrange for dtors to run at exit. */
- if (unlikely(_fini!=NULL && atexit)) {
+ if (likely(_fini!=NULL && atexit)) {
atexit (&_fini);
}
/* Run all ctors now. */
- if (unlikely(_init!=NULL))
+ if (likely(_init!=NULL))
_init();
/*