[rtems-libbsd commit] There is no main thread in RTEMS
Sebastian Huber
sebh at rtems.org
Fri Sep 20 14:16:45 UTC 2013
Module: rtems-libbsd
Branch: master
Commit: 83cb10f95272a31653de269caf302c9457c3f46d
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=83cb10f95272a31653de269caf302c9457c3f46d
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Sep 20 16:08:34 2013 +0200
There is no main thread in RTEMS
The resolv module has a questionable fall back strategy on error.
---
freebsd-userspace/Makefile | 1 -
freebsd-userspace/lib/libc/include/nss_tls.h | 5 -----
freebsd-userspace/lib/libc/net/netdb_private.h | 3 ---
freebsd-userspace/lib/libc/resolv/res_state.c | 2 ++
freebsd-userspace/rtems/rtems-uthread_main_np.c | 20 --------------------
rtemsbsd/src/rtems-bsd-init.c | 3 ---
6 files changed, 2 insertions(+), 32 deletions(-)
diff --git a/freebsd-userspace/Makefile b/freebsd-userspace/Makefile
index 18dde49..7ff8ed5 100644
--- a/freebsd-userspace/Makefile
+++ b/freebsd-userspace/Makefile
@@ -170,7 +170,6 @@ C_FILES += rtems/rtems-kvm.c
C_FILES += rtems/rtems-kvm-symbols.c
C_FILES += rtems/rtems-syslog-initialize.c
C_FILES += rtems/rtems-getprogname.c
-C_FILES += rtems/rtems-uthread_main_np.c
C_FILES += rtems/rtems-uthread_kevent.c
C_FILES += rtems/rtems-uthread_kqueue.c
C_FILES += rtems/rtems-shell.c
diff --git a/freebsd-userspace/lib/libc/include/nss_tls.h b/freebsd-userspace/lib/libc/include/nss_tls.h
index 13ab367..03cf992 100644
--- a/freebsd-userspace/lib/libc/include/nss_tls.h
+++ b/freebsd-userspace/lib/libc/include/nss_tls.h
@@ -50,14 +50,9 @@ name##_keyinit(void) \
static int \
name##_getstate(struct name##_state **p) \
{ \
- static struct name##_state st; \
static pthread_once_t keyinit = PTHREAD_ONCE_INIT; \
int rv; \
\
- if (!__isthreaded || _pthread_main_np() != 0) { \
- *p = &st; \
- return (0); \
- } \
rv = _pthread_once(&keyinit, name##_keyinit); \
if (rv != 0) \
return (rv); \
diff --git a/freebsd-userspace/lib/libc/net/netdb_private.h b/freebsd-userspace/lib/libc/net/netdb_private.h
index b48dd7b..9892c01 100644
--- a/freebsd-userspace/lib/libc/net/netdb_private.h
+++ b/freebsd-userspace/lib/libc/net/netdb_private.h
@@ -31,7 +31,6 @@
#include <stdio.h> /* XXX: for FILE */
#define NETDB_THREAD_ALLOC(name) \
-static struct name name; \
static thread_key_t name##_key; \
static once_t name##_init_once = ONCE_INITIALIZER; \
static int name##_thr_keycreated = 0; \
@@ -50,8 +49,6 @@ __##name##_init(void) \
{ \
struct name *he; \
\
- if (thr_main() != 0) \
- return (&name); \
if (thr_once(&name##_init_once, name##_keycreate) != 0 || \
!name##_thr_keycreated) \
return (NULL); \
diff --git a/freebsd-userspace/lib/libc/resolv/res_state.c b/freebsd-userspace/lib/libc/resolv/res_state.c
index dc77a9c..8a82db7 100644
--- a/freebsd-userspace/lib/libc/resolv/res_state.c
+++ b/freebsd-userspace/lib/libc/resolv/res_state.c
@@ -66,8 +66,10 @@ __res_state(void)
{
res_state statp;
+#ifndef __rtems__
if (thr_main() != 0)
return (&_res);
+#endif /* __rtems__ */
if (thr_once(&res_init_once, res_keycreate) != 0 ||
!res_thr_keycreated)
diff --git a/freebsd-userspace/rtems/rtems-uthread_main_np.c b/freebsd-userspace/rtems/rtems-uthread_main_np.c
deleted file mode 100644
index 2ce8dfd..0000000
--- a/freebsd-userspace/rtems/rtems-uthread_main_np.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * RTEMS version of
- */
-
-#include <rtems.h>
-#include <pthread_np.h>
-
-__weak_reference(_pthread_main_np, pthread_main_np);
-
-/*
- * Provide the equivalent to Solaris thr_main() function
- */
-int
-_pthread_main_np()
-{
- if ( rtems_init_task_id == rtems_task_self() )
- return 1;
- else
- return 0;
-}
diff --git a/rtemsbsd/src/rtems-bsd-init.c b/rtemsbsd/src/rtems-bsd-init.c
index ebaee17..429f064 100644
--- a/rtemsbsd/src/rtems-bsd-init.c
+++ b/rtemsbsd/src/rtems-bsd-init.c
@@ -56,14 +56,11 @@ int hz;
int tick;
int maxusers; /* base tunable */
-rtems_id rtems_init_task_id;
-
rtems_status_code
rtems_bsd_initialize(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
- rtems_init_task_id = rtems_task_self();
hz = (int) rtems_clock_get_ticks_per_second();
tick = 1000000 / hz;
maxusers = 1;
More information about the vc
mailing list