summaryrefslogtreecommitdiff
path: root/lib/libc_r/uthread/uthread_autoinit.c
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1998-12-10 00:33:55 +0000
committerDavid Leonard <d@cvs.openbsd.org>1998-12-10 00:33:55 +0000
commit2ae7d9d676817895acb58a95f45ed88e4626c04d (patch)
tree93e88f6dac31d3d18da4591080f494ff3f158769 /lib/libc_r/uthread/uthread_autoinit.c
parentac86a0e364b3332ce6c007a699a31f788a636999 (diff)
split automatic init into own file
Diffstat (limited to 'lib/libc_r/uthread/uthread_autoinit.c')
-rw-r--r--lib/libc_r/uthread/uthread_autoinit.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/libc_r/uthread/uthread_autoinit.c b/lib/libc_r/uthread/uthread_autoinit.c
new file mode 100644
index 00000000000..6cebea471ac
--- /dev/null
+++ b/lib/libc_r/uthread/uthread_autoinit.c
@@ -0,0 +1,53 @@
+
+#include <stdio.h>
+#include <pthread.h>
+#include "pthread_private.h"
+
+extern void _thread_init __P((void));
+
+#ifdef __cplusplus
+/*
+ * Use C++ static initialiser
+ */
+class Init {
+public:
+ Init() { _thread_init(); }
+};
+Init _thread_initialiser;
+#endif /* C++ */
+
+/*
+ * a.out ld.so initialisation
+ */
+extern void _thread_dot_init __P((void)) asm(".init");
+void
+_thread_dot_init()
+{
+ _thread_init();
+}
+
+#ifdef mips
+/*
+ * elf ld.so initialisation
+ */
+extern int _init() __attribute__((constructor,section (".dynamic")));
+int
+_init()
+{
+ _thread_init();
+ return 0;
+}
+#endif /* mips */
+
+#ifdef _GNUC_
+/*
+ * GNU CTOR_LIST constructor
+ */
+void _thread_init_constructor __P((void)) __attribute__((constructor));
+void
+_thread_init_constructor()
+{
+ _thread_init();
+}
+#endif /* GNU C */
+