aboutsummaryrefslogtreecommitdiff
path: root/acid/pthread-linux-386
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-02-11 16:51:43 +0000
committerrsc <devnull@localhost>2005-02-11 16:51:43 +0000
commit2a931b7266c8a6550aca5f75b2ce3bf8655aa45b (patch)
tree707c22bb882f7a0d9fce75b5ce876b8c28080ed0 /acid/pthread-linux-386
parent2709e6e3689c2f7957758de452ee740136e5eec0 (diff)
downloadplan9port-2a931b7266c8a6550aca5f75b2ce3bf8655aa45b.tar.gz
plan9port-2a931b7266c8a6550aca5f75b2ce3bf8655aa45b.tar.bz2
plan9port-2a931b7266c8a6550aca5f75b2ce3bf8655aa45b.zip
clean up pthread for linux
Diffstat (limited to 'acid/pthread-linux-386')
-rw-r--r--acid/pthread-linux-38653
1 files changed, 53 insertions, 0 deletions
diff --git a/acid/pthread-linux-386 b/acid/pthread-linux-386
new file mode 100644
index 00000000..90d87686
--- /dev/null
+++ b/acid/pthread-linux-386
@@ -0,0 +1,53 @@
+// Linux NPTL 2.3.2
+complex list_head {
+ 'X' 0 next;
+ 'X' 4 prev;
+};
+complex nptl_pthread {
+ 'X' 0 loopback;
+ 'X' 0x48 tid;
+};
+
+// cannot be done at load time -- need shared library symbols
+defn guessnptl() {
+ if var("nptl_version") then {
+ pthreadlibrary = "nptl";
+ isnptl = 1;
+ } else {
+ pthreadlibrary = "linuxclone";
+ isnptl = 0;
+ }
+}
+
+defn pthread2tid(p) {
+ guessnptl();
+ if p == 0 then
+ return 0;
+ if isnptl then {
+ complex nptl_pthread p;
+ if p.loopback != p then
+ error("bad pthread "+itoa(p, "%x"));
+ return p.tid;
+ }else {
+ return p\X;
+ }
+}
+
+defn pthreadlist() {
+ local all, p, n, l;
+
+ if isnptl then {
+ all = {};
+ l = (list_head)stack_used;
+ l = (list_head)l.next;
+ while l != stack_used do {
+ p = l - *_thread_db_pthread_list;
+ all = append all, p;
+ l = (list_head)l.next;
+ }
+ } else {
+ all = {};
+ }
+ return all;
+}
+