From f6367df2fd032db89e68e28333d995fb18ffa653 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 15 Oct 1999 00:38:31 +0000 Subject: Update. 1999-10-14 Ulrich Drepper * manager.c (pthread_handle_create): Remove p_startfct initialization. * internals.h (_pthread_descr_struct): We don't need p_startfct field. --- linuxthreads/ChangeLog | 6 ++++++ linuxthreads/internals.h | 3 +-- linuxthreads/manager.c | 1 - linuxthreads/pthread.c | 6 ++++-- linuxthreads_db/ChangeLog | 9 +++++++++ linuxthreads_db/td_ta_thr_iter.c | 12 +++++++++--- linuxthreads_db/td_thr_get_info.c | 12 ++++++------ linuxthreads_db/td_thr_validate.c | 4 ---- resolv/inet_addr.c | 2 +- 9 files changed, 36 insertions(+), 19 deletions(-) diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index e90c2fea4e..6d8d18bef4 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,9 @@ +1999-10-14 Ulrich Drepper + + * manager.c (pthread_handle_create): Remove p_startfct initialization. + + * internals.h (_pthread_descr_struct): We don't need p_startfct field. + 1999-10-12 Ulrich Drepper * internals.h: Correct return types for __libc_read and __libc_write. diff --git a/linuxthreads/internals.h b/linuxthreads/internals.h index 6e9dc102de..b127512c11 100644 --- a/linuxthreads/internals.h +++ b/linuxthreads/internals.h @@ -72,7 +72,7 @@ struct pthread_key_struct { }; -#define PTHREAD_START_ARGS_INITIALIZER { NULL, NULL, {{0, }}, 0, { 0 } } +#define PTHREAD_START_ARGS_INITIALIZER(fct) { fct, NULL, {{0, }}, 0, { 0 } } /* The type of thread descriptors */ @@ -114,7 +114,6 @@ struct _pthread_descr_struct { size_t p_guardsize; /* size of guard area */ pthread_descr p_self; /* Pointer to this structure */ int p_nr; /* Index of descriptor in __pthread_handles */ - void *(*p_startfct) (void *); /* The startup function of this thread. */ } __attribute__ ((aligned(32))); /* We need to align the structure so that doubles are aligned properly. This is 8 bytes on MIPS and 16 bytes on MIPS64. diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c index 52c541ce8e..daa12bc1f5 100644 --- a/linuxthreads/manager.c +++ b/linuxthreads/manager.c @@ -342,7 +342,6 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, new_thread->p_guardsize = guardsize; new_thread->p_self = new_thread; new_thread->p_nr = sseg; - new_thread->p_startfct = start_routine; /* Initialize the thread handle */ __pthread_init_lock(&__pthread_handles[sseg].h_lock); __pthread_handles[sseg].h_descr = new_thread; diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index aea6db12ab..2741b211b6 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -61,7 +61,8 @@ struct _pthread_descr_struct __pthread_initial_thread = { 0, /* int p_h_errno */ NULL, /* char * p_in_sighandler */ 0, /* char p_sigwaiting */ - PTHREAD_START_ARGS_INITIALIZER, /* struct pthread_start_args p_start_args */ + PTHREAD_START_ARGS_INITIALIZER(NULL), + /* struct pthread_start_args p_start_args */ {NULL}, /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */ {NULL}, /* void * p_libc_specific[_LIBC_TSD_KEY_N] */ 0, /* int p_userstack */ @@ -103,7 +104,8 @@ struct _pthread_descr_struct __pthread_manager_thread = { 0, /* int p_h_errno */ NULL, /* char * p_in_sighandler */ 0, /* char p_sigwaiting */ - PTHREAD_START_ARGS_INITIALIZER, /* struct pthread_start_args p_start_args */ + PTHREAD_START_ARGS_INITIALIZER(__pthread_manager), + /* struct pthread_start_args p_start_args */ {NULL}, /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */ {NULL}, /* void * p_libc_specific[_LIBC_TSD_KEY_N] */ 0, /* int p_userstack */ diff --git a/linuxthreads_db/ChangeLog b/linuxthreads_db/ChangeLog index a5486c93d2..c7836d3abd 100644 --- a/linuxthreads_db/ChangeLog +++ b/linuxthreads_db/ChangeLog @@ -1,3 +1,12 @@ +1999-10-14 Ulrich Drepper + + * td_thr_get_info.c: Always initialize start function. + + * td_ta_thr_iter.c: Don't return threads which exited (but are not + joined). + + * td_thr_validate.c: Don't skip manager thread. + 1999-10-13 Ulrich Drepper * td_ta_thr_iter.c: Use size of descriptor from *TA. diff --git a/linuxthreads_db/td_ta_thr_iter.c b/linuxthreads_db/td_ta_thr_iter.c index 678dd7f01b..f9b5673ebf 100644 --- a/linuxthreads_db/td_ta_thr_iter.c +++ b/linuxthreads_db/td_ta_thr_iter.c @@ -66,9 +66,15 @@ td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback, /* Test the state. XXX This is incomplete. */ - if (state != TD_THR_ANY_STATE - && (state != TD_THR_ZOMBIE || pds.p_exited == 0) - && (state != TD_THR_RUN || pds.p_exited != 0)) + if (state != TD_THR_ANY_STATE) + continue; + + /* XXX For now we ignore threads which are not running anymore. + The reason is that gdb tries to get the registers and fails. + In future we should have a special mode of the thread library + in which we keep the process around until the actual join + operation happened. */ + if (pds.p_exited != 0) continue; /* Yep, it matches. Call the callback function. */ diff --git a/linuxthreads_db/td_thr_get_info.c b/linuxthreads_db/td_thr_get_info.c index 973323e1d6..606ca81f78 100644 --- a/linuxthreads_db/td_thr_get_info.c +++ b/linuxthreads_db/td_thr_get_info.c @@ -43,29 +43,29 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop) descriptor in older versions is not fully initialized. */ if (pds.p_nr == 1) { - infop->ti_ta_p = th->th_ta_p; infop->ti_tid = th->th_ta_p->pthread_threads_max * 2 + 1; - infop->ti_lid = pds.p_pid; infop->ti_type = TD_THR_SYSTEM; infop->ti_state = TD_THR_RUN; } else { - infop->ti_ta_p = th->th_ta_p; infop->ti_tid = pds.p_tid; - infop->ti_lid = pds.p_pid; infop->ti_tls = (char *) pds.p_specific; infop->ti_pri = pds.p_priority; infop->ti_type = TD_THR_USER; if (pds.p_exited) + /* This should not happen. */ infop->ti_state = TD_THR_ZOMBIE; else /* XXX For now there is no way to get more information. */ infop->ti_state = TD_THR_RUN; - - infop->ti_startfunc = pds.p_start_args.start_routine; } + /* Initialization which are the same in both cases. */ + infop->ti_lid = pds.p_pid; + infop->ti_ta_p = th->th_ta_p; + infop->ti_startfunc = pds.p_start_args.start_routine; + return TD_OK; } diff --git a/linuxthreads_db/td_thr_validate.c b/linuxthreads_db/td_thr_validate.c index f6f0d9094d..81c3b50214 100644 --- a/linuxthreads_db/td_thr_validate.c +++ b/linuxthreads_db/td_thr_validate.c @@ -35,10 +35,6 @@ td_thr_validate (const td_thrhandle_t *th) { struct pthread_handle_struct phc; - if (cnt == 1) - /* Skip the manager thread. */ - continue; - if (ps_pdread (th->th_ta_p->ph, handles, &phc, sizeof (struct pthread_handle_struct)) != PS_OK) return TD_ERR; /* XXX Other error value? */ diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c index 68f63101a2..60f0cbe3b4 100644 --- a/resolv/inet_addr.c +++ b/resolv/inet_addr.c @@ -168,7 +168,7 @@ inet_aton(cp, addr) * a.b.c (with c treated as 16 bits) * a.b (with b treated as 24 bits) */ - if (pp >> res.bytes + 3 + if (pp > res.bytes + 3 || val > 0xff) goto ret_0; *pp++ = val; -- cgit v1.2.3