There is no main thread in RTEMS

The resolv module has a questionable fall back strategy on error.
This commit is contained in:
Sebastian Huber 2013-09-20 16:08:34 +02:00
parent 937461c950
commit 83cb10f952
6 changed files with 2 additions and 32 deletions

View File

@ -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

View File

@ -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); \

View File

@ -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); \

View File

@ -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)

View File

@ -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;
}

View File

@ -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;