Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nathanw_sa]: src/lib/libpthread_dbg Implement td_map_lwps().



details:   https://anonhg.NetBSD.org/src/rev/06a81fe520dc
branches:  nathanw_sa
changeset: 506345:06a81fe520dc
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Wed Oct 16 19:34:15 2002 +0000

description:
Implement td_map_lwps().

diffstat:

 lib/libpthread_dbg/pthread_dbg.c |  28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diffs (42 lines):

diff -r 5aaad0de9733 -r 06a81fe520dc lib/libpthread_dbg/pthread_dbg.c
--- a/lib/libpthread_dbg/pthread_dbg.c  Wed Oct 16 19:32:24 2002 +0000
+++ b/lib/libpthread_dbg/pthread_dbg.c  Wed Oct 16 19:34:15 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_dbg.c,v 1.1.2.6 2002/10/08 19:53:54 nathanw Exp $      */
+/*     $NetBSD: pthread_dbg.c,v 1.1.2.7 2002/10/16 19:34:15 nathanw Exp $      */
 
 /*-
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -706,6 +706,32 @@
        return 0;
 }
 
+int
+td_map_lwps(td_proc_t *proc)
+{
+       int i, val, nlwps;
+       caddr_t addr;
+       td_thread_t *thread;
+
+       val = LOOKUP(proc, "pthread__maxlwps", &addr);
+       if (val != 0)
+               return val;
+
+       val = READ(proc, addr, &nlwps, sizeof(int));
+       if (val != 0)
+               return val;
+
+       for (i = 1; i <= nlwps; i++) {
+               /*
+                * Errors are deliberately ignored for the call to
+                * td_map_lwp2thr(); it is entirely likely that not
+                * all LWPs in the range 1..nlwps exist, and that's
+                * not a problem.
+                */
+               td_map_lwp2thr(proc, i, &thread);
+       }
+       return 0;
+}
 
 int
 td_tsd_iter(td_proc_t *proc,



Home | Main Index | Thread Index | Old Index