summaryrefslogtreecommitdiff
path: root/libc/misc/internals/__uClibc_main.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-20 09:18:50 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-20 09:18:50 +0000
commite356ea321c8098cf1a83a67e27d64c44de08a298 (patch)
tree8be9273fb8f0e6acab47a9e09552cfbea5400b31 /libc/misc/internals/__uClibc_main.c
parent07ebf927b17572d92e785533d6e8ac1668cc57c6 (diff)
Merge in the pthread library. This is the linuxthreads library taken from
glibc 2.1.3 and ported to work with uClibc by Stefan Soucek and Erik Andersen (me). Stefan has hacked things up such that linuxthreads runs on MMU-less systems (tested only on arm-nommu). Erik cleaned things up and made it work properly as a shared library. -Erik
Diffstat (limited to 'libc/misc/internals/__uClibc_main.c')
-rw-r--r--libc/misc/internals/__uClibc_main.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 299e1abdf..fd4e9552b 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -10,9 +10,13 @@
* avoided in the static library case.
*/
+#define _ERRNO_H
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
+//#include <errno.h>
+#undef errno
+
+#define __set_errno(val) (*__errno_location ()) = (val)
/*
* Prototypes.
@@ -29,13 +33,21 @@ void __uClibc_main(int argc, char **argv, char **envp)
weak_alias(__environ, environ);
extern void weak_function __init_stdio(void);
extern void weak_function __stdio_flush_buffers(void);
-extern void weak_function __pthread_initialize_minimal (void);
+extern int *weak_function __errno_location (void);
#else
extern void __init_stdio(void);
extern void __stdio_flush_buffers(void);
-extern void __pthread_initialize_minimal (void);
+extern int *__errno_location (void);
#endif
+/*
+ * Declare the __environ global variable and create a weak alias environ.
+ * Note: Apparently we must initialize __environ for the weak environ
+ * symbol to be included.
+ */
+
+char **__environ = 0;
+
/*
* Now for our main routine.
@@ -48,11 +60,6 @@ void __uClibc_main(int argc, char **argv, char **envp)
*/
__environ = envp;
- /* Initialize the thread library at least a bit so at least
- * errno will be properly setup */
- if (__pthread_initialize_minimal)
- __pthread_initialize_minimal ();
-
#if 0
/* Some security at this point. Prevent starting a SUID binary
* where the standard file descriptors are not opened. We have
@@ -81,14 +88,6 @@ void __uClibc_main(int argc, char **argv, char **envp)
exit(main(argc, argv, envp));
}
-/*
- * Declare the __environ global variable and create a weak alias environ.
- * Note: Apparently we must initialize __environ for the weak environ
- * symbol to be included.
- */
-
-char **__environ = 0;
-
#ifndef HAVE_ELF
/*
* Define an empty function and use it as a weak alias for the stdio