about summary refs log tree commit diff
path: root/linuxthreads_db/td_ta_thr_iter.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-07-15 23:37:22 +0000
committerUlrich Drepper <drepper@redhat.com>2002-07-15 23:37:22 +0000
commit706d1dee4692cc5419275fcddc4518933ff2a39e (patch)
treec795b0e8236092f2345ac7803181e41c13c5427c /linuxthreads_db/td_ta_thr_iter.c
parentc3da4f0cba685e6918d2babb286bd731ae7eab71 (diff)
downloadglibc-706d1dee4692cc5419275fcddc4518933ff2a39e.tar.gz
glibc-706d1dee4692cc5419275fcddc4518933ff2a39e.tar.xz
glibc-706d1dee4692cc5419275fcddc4518933ff2a39e.zip
Update.
2002-07-15  Ulrich Drepper  <drepper@redhat.com>

	* libio/wfileops.c (_IO_wfile_seekoff): Reposition wide pointers
	and adjust state for seek position.  [PR libc/4070]
	* libio/Makefile (tests): Add bug-rewind.
	* libio/bug-rewind.c: New file.
Diffstat (limited to 'linuxthreads_db/td_ta_thr_iter.c')
-rw-r--r--linuxthreads_db/td_ta_thr_iter.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/linuxthreads_db/td_ta_thr_iter.c b/linuxthreads_db/td_ta_thr_iter.c
index 7d7085870f..977711261e 100644
--- a/linuxthreads_db/td_ta_thr_iter.c
+++ b/linuxthreads_db/td_ta_thr_iter.c
@@ -31,6 +31,37 @@ handle_descr (const td_thragent_t *ta, td_thr_iter_f *callback,
   size_t sizeof_descr = ta->sizeof_descr;
   td_thrhandle_t th;
 
+  if (descr == NULL)
+    {
+      /* No descriptor (yet).  */
+      if (cnt == 0)
+	{
+	  /* This is the main thread.  Create a fake descriptor.  */
+	  memset (&pds, '\0', sizeof (pds));
+
+	  /* Empty thread descriptor the thread library would create.  */
+	  pds.p_header.data.self = &pds;
+	  pds.p_nextlive = pds.p_prevlive = &pds;
+	  pds.p_tid = PTHREAD_THREADS_MAX;
+	  /* The init code also sets up p_lock, p_errnop, p_herrnop, and
+	     p_userstack but this should not be necessary here.  */
+
+	  th.th_ta_p = (td_thragent_t *) ta;
+	  th.th_unique = &pds;
+	  if (callback (&th, cbdata_p) != 0)
+	    return TD_DBERR;
+
+	  /* All done successfully.  */
+	  return TD_OK;
+	}
+      else if (cnt == 1)
+	/* The manager is not yet started.  No big deal.  */
+	return TD_OK;
+      else
+	/* For every other thread this should not happen.  */
+	return TD_ERR;
+    }
+
   if (ps_pdread (ta->ph, descr, &pds, sizeof_descr) != PS_OK)
     return TD_ERR;	/* XXX Other error value?  */