plan9-thread.acid 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. sizeof_1_ = 8;
  2. aggr _1_
  3. {
  4. 'U' 0 lo;
  5. 'U' 4 hi;
  6. };
  7. defn
  8. _1_(addr) {
  9. complex _1_ addr;
  10. print(" lo ", addr.lo, "\n");
  11. print(" hi ", addr.hi, "\n");
  12. };
  13. sizeofFPdbleword = 8;
  14. aggr FPdbleword
  15. {
  16. 'F' 0 x;
  17. {
  18. 'U' 0 lo;
  19. 'U' 4 hi;
  20. };
  21. };
  22. defn
  23. FPdbleword(addr) {
  24. complex FPdbleword addr;
  25. print(" x ", addr.x, "\n");
  26. print("_1_ {\n");
  27. _1_(addr+0);
  28. print("}\n");
  29. };
  30. UTFmax = 3;
  31. Runesync = 128;
  32. Runeself = 128;
  33. Runeerror = 65533;
  34. sizeofFmt = 48;
  35. aggr Fmt
  36. {
  37. 'b' 0 runes;
  38. 'X' 4 start;
  39. 'X' 8 to;
  40. 'X' 12 stop;
  41. 'X' 16 flush;
  42. 'X' 20 farg;
  43. 'D' 24 nfmt;
  44. 'X' 28 args;
  45. 'D' 32 r;
  46. 'D' 36 width;
  47. 'D' 40 prec;
  48. 'U' 44 flags;
  49. };
  50. defn
  51. Fmt(addr) {
  52. complex Fmt addr;
  53. print(" runes ", addr.runes, "\n");
  54. print(" start ", addr.start\X, "\n");
  55. print(" to ", addr.to\X, "\n");
  56. print(" stop ", addr.stop\X, "\n");
  57. print(" flush ", addr.flush\X, "\n");
  58. print(" farg ", addr.farg\X, "\n");
  59. print(" nfmt ", addr.nfmt, "\n");
  60. print(" args ", addr.args\X, "\n");
  61. print(" r ", addr.r, "\n");
  62. print(" width ", addr.width, "\n");
  63. print(" prec ", addr.prec, "\n");
  64. print(" flags ", addr.flags, "\n");
  65. };
  66. FmtWidth = 1;
  67. FmtLeft = 2;
  68. FmtPrec = 4;
  69. FmtSharp = 8;
  70. FmtSpace = 16;
  71. FmtSign = 32;
  72. FmtZero = 64;
  73. FmtUnsigned = 128;
  74. FmtShort = 256;
  75. FmtLong = 512;
  76. FmtVLong = 1024;
  77. FmtComma = 2048;
  78. FmtByte = 4096;
  79. FmtFlag = 8192;
  80. sizeofTm = 40;
  81. aggr Tm
  82. {
  83. 'D' 0 sec;
  84. 'D' 4 min;
  85. 'D' 8 hour;
  86. 'D' 12 mday;
  87. 'D' 16 mon;
  88. 'D' 20 year;
  89. 'D' 24 wday;
  90. 'D' 28 yday;
  91. 'a' 32 zone;
  92. 'D' 36 tzoff;
  93. };
  94. defn
  95. Tm(addr) {
  96. complex Tm addr;
  97. print(" sec ", addr.sec, "\n");
  98. print(" min ", addr.min, "\n");
  99. print(" hour ", addr.hour, "\n");
  100. print(" mday ", addr.mday, "\n");
  101. print(" mon ", addr.mon, "\n");
  102. print(" year ", addr.year, "\n");
  103. print(" wday ", addr.wday, "\n");
  104. print(" yday ", addr.yday, "\n");
  105. print(" zone ", addr.zone, "\n");
  106. print(" tzoff ", addr.tzoff, "\n");
  107. };
  108. PNPROC = 1;
  109. PNGROUP = 2;
  110. Profoff = 0;
  111. Profuser = 1;
  112. Profkernel = 2;
  113. Proftime = 3;
  114. Profsample = 4;
  115. sizeofLock = 4;
  116. aggr Lock
  117. {
  118. 'D' 0 val;
  119. };
  120. defn
  121. Lock(addr) {
  122. complex Lock addr;
  123. print(" val ", addr.val, "\n");
  124. };
  125. sizeofQLp = 12;
  126. aggr QLp
  127. {
  128. 'D' 0 inuse;
  129. 'A' QLp 4 next;
  130. 'C' 8 state;
  131. };
  132. defn
  133. QLp(addr) {
  134. complex QLp addr;
  135. print(" inuse ", addr.inuse, "\n");
  136. print(" next ", addr.next\X, "\n");
  137. print(" state ", addr.state, "\n");
  138. };
  139. sizeofQLock = 16;
  140. aggr QLock
  141. {
  142. Lock 0 lock;
  143. 'D' 4 locked;
  144. 'A' QLp 8 $head;
  145. 'A' QLp 12 $tail;
  146. };
  147. defn
  148. QLock(addr) {
  149. complex QLock addr;
  150. print("Lock lock {\n");
  151. Lock(addr.lock);
  152. print("}\n");
  153. print(" locked ", addr.locked, "\n");
  154. print(" $head ", addr.$head\X, "\n");
  155. print(" $tail ", addr.$tail\X, "\n");
  156. };
  157. sizeofRWLock = 20;
  158. aggr RWLock
  159. {
  160. Lock 0 lock;
  161. 'D' 4 readers;
  162. 'D' 8 writer;
  163. 'A' QLp 12 $head;
  164. 'A' QLp 16 $tail;
  165. };
  166. defn
  167. RWLock(addr) {
  168. complex RWLock addr;
  169. print("Lock lock {\n");
  170. Lock(addr.lock);
  171. print("}\n");
  172. print(" readers ", addr.readers, "\n");
  173. print(" writer ", addr.writer, "\n");
  174. print(" $head ", addr.$head\X, "\n");
  175. print(" $tail ", addr.$tail\X, "\n");
  176. };
  177. sizeofRendez = 12;
  178. aggr Rendez
  179. {
  180. 'A' QLock 0 l;
  181. 'A' QLp 4 $head;
  182. 'A' QLp 8 $tail;
  183. };
  184. defn
  185. Rendez(addr) {
  186. complex Rendez addr;
  187. print(" l ", addr.l\X, "\n");
  188. print(" $head ", addr.$head\X, "\n");
  189. print(" $tail ", addr.$tail\X, "\n");
  190. };
  191. sizeofNetConnInfo = 36;
  192. aggr NetConnInfo
  193. {
  194. 'X' 0 dir;
  195. 'X' 4 root;
  196. 'X' 8 spec;
  197. 'X' 12 lsys;
  198. 'X' 16 lserv;
  199. 'X' 20 rsys;
  200. 'X' 24 rserv;
  201. 'X' 28 laddr;
  202. 'X' 32 raddr;
  203. };
  204. defn
  205. NetConnInfo(addr) {
  206. complex NetConnInfo addr;
  207. print(" dir ", addr.dir\X, "\n");
  208. print(" root ", addr.root\X, "\n");
  209. print(" spec ", addr.spec\X, "\n");
  210. print(" lsys ", addr.lsys\X, "\n");
  211. print(" lserv ", addr.lserv\X, "\n");
  212. print(" rsys ", addr.rsys\X, "\n");
  213. print(" rserv ", addr.rserv\X, "\n");
  214. print(" laddr ", addr.laddr\X, "\n");
  215. print(" raddr ", addr.raddr\X, "\n");
  216. };
  217. RFNAMEG = 1;
  218. RFENVG = 2;
  219. RFFDG = 4;
  220. RFNOTEG = 8;
  221. RFPROC = 16;
  222. RFMEM = 32;
  223. RFNOWAIT = 64;
  224. RFCNAMEG = 1024;
  225. RFCENVG = 2048;
  226. RFCFDG = 4096;
  227. RFREND = 8192;
  228. RFNOMNT = 16384;
  229. sizeofQid = 16;
  230. aggr Qid
  231. {
  232. 'W' 0 path;
  233. 'U' 8 vers;
  234. 'b' 12 type;
  235. };
  236. defn
  237. Qid(addr) {
  238. complex Qid addr;
  239. print(" path ", addr.path, "\n");
  240. print(" vers ", addr.vers, "\n");
  241. print(" type ", addr.type, "\n");
  242. };
  243. sizeofDir = 60;
  244. aggr Dir
  245. {
  246. 'u' 0 type;
  247. 'U' 4 dev;
  248. Qid 8 qid;
  249. 'U' 24 mode;
  250. 'U' 28 atime;
  251. 'U' 32 mtime;
  252. 'V' 36 length;
  253. 'X' 44 name;
  254. 'X' 48 uid;
  255. 'X' 52 gid;
  256. 'X' 56 muid;
  257. };
  258. defn
  259. Dir(addr) {
  260. complex Dir addr;
  261. print(" type ", addr.type, "\n");
  262. print(" dev ", addr.dev, "\n");
  263. print("Qid qid {\n");
  264. Qid(addr.qid);
  265. print("}\n");
  266. print(" mode ", addr.mode, "\n");
  267. print(" atime ", addr.atime, "\n");
  268. print(" mtime ", addr.mtime, "\n");
  269. print(" length ", addr.length, "\n");
  270. print(" name ", addr.name\X, "\n");
  271. print(" uid ", addr.uid\X, "\n");
  272. print(" gid ", addr.gid\X, "\n");
  273. print(" muid ", addr.muid\X, "\n");
  274. };
  275. sizeofWaitmsg = 20;
  276. aggr Waitmsg
  277. {
  278. 'D' 0 pid;
  279. 'a' 4 time;
  280. 'X' 16 msg;
  281. };
  282. defn
  283. Waitmsg(addr) {
  284. complex Waitmsg addr;
  285. print(" pid ", addr.pid, "\n");
  286. print(" time ", addr.time, "\n");
  287. print(" msg ", addr.msg\X, "\n");
  288. };
  289. sizeofIOchunk = 8;
  290. aggr IOchunk
  291. {
  292. 'X' 0 addr;
  293. 'U' 4 len;
  294. };
  295. defn
  296. IOchunk(addr) {
  297. complex IOchunk addr;
  298. print(" addr ", addr.addr\X, "\n");
  299. print(" len ", addr.len, "\n");
  300. };
  301. VtScoreSize = 20;
  302. VtMaxLumpSize = 57344;
  303. VtPointerDepth = 7;
  304. VtEntrySize = 40;
  305. VtRootSize = 300;
  306. VtMaxStringSize = 1000;
  307. VtAuthSize = 1024;
  308. MaxFragSize = 9216;
  309. VtMaxFileSize = 281474976710655;
  310. VtRootVersion = 2;
  311. VtCryptoStrengthNone = 0;
  312. VtCryptoStrengthAuth = 1;
  313. VtCryptoStrengthWeak = 2;
  314. VtCryptoStrengthStrong = 3;
  315. VtCryptoNone = 0;
  316. VtCryptoSSL3 = 1;
  317. VtCryptoTLS1 = 2;
  318. VtCryptoMax = 3;
  319. VtCodecNone = 0;
  320. VtCodecDeflate = 1;
  321. VtCodecThwack = 2;
  322. VtCodecMax = 3;
  323. VtErrType = 0;
  324. VtRootType = 1;
  325. VtDirType = 2;
  326. VtPointerType0 = 3;
  327. VtPointerType1 = 4;
  328. VtPointerType2 = 5;
  329. VtPointerType3 = 6;
  330. VtPointerType4 = 7;
  331. VtPointerType5 = 8;
  332. VtPointerType6 = 9;
  333. VtPointerType7 = 10;
  334. VtPointerType8 = 11;
  335. VtPointerType9 = 12;
  336. VtDataType = 13;
  337. VtMaxType = 14;
  338. VtEntryActive = 1;
  339. VtEntryDir = 2;
  340. VtEntryDepthShift = 2;
  341. VtEntryDepthMask = 28;
  342. VtEntryLocal = 32;
  343. VtEntryNoArchive = 64;
  344. sizeofVtRoot = 300;
  345. aggr VtRoot
  346. {
  347. 'u' 0 version;
  348. 'a' 2 name;
  349. 'a' 130 type;
  350. 'a' 258 score;
  351. 'u' 278 blockSize;
  352. 'a' 280 prev;
  353. };
  354. defn
  355. VtRoot(addr) {
  356. complex VtRoot addr;
  357. print(" version ", addr.version, "\n");
  358. print(" name ", addr.name, "\n");
  359. print(" type ", addr.type, "\n");
  360. print(" score ", addr.score, "\n");
  361. print(" blockSize ", addr.blockSize, "\n");
  362. print(" prev ", addr.prev, "\n");
  363. };
  364. sizeofVtEntry = 40;
  365. aggr VtEntry
  366. {
  367. 'U' 0 gen;
  368. 'u' 4 psize;
  369. 'u' 6 dsize;
  370. 'b' 8 depth;
  371. 'b' 9 flags;
  372. 'W' 12 size;
  373. 'a' 20 score;
  374. };
  375. defn
  376. VtEntry(addr) {
  377. complex VtEntry addr;
  378. print(" gen ", addr.gen, "\n");
  379. print(" psize ", addr.psize, "\n");
  380. print(" dsize ", addr.dsize, "\n");
  381. print(" depth ", addr.depth, "\n");
  382. print(" flags ", addr.flags, "\n");
  383. print(" size ", addr.size, "\n");
  384. print(" score ", addr.score, "\n");
  385. };
  386. sizeofVtServerVtbl = 16;
  387. aggr VtServerVtbl
  388. {
  389. 'X' 0 read;
  390. 'X' 4 write;
  391. 'X' 8 closing;
  392. 'X' 12 sync;
  393. };
  394. defn
  395. VtServerVtbl(addr) {
  396. complex VtServerVtbl addr;
  397. print(" read ", addr.read\X, "\n");
  398. print(" write ", addr.write\X, "\n");
  399. print(" closing ", addr.closing\X, "\n");
  400. print(" sync ", addr.sync\X, "\n");
  401. };
  402. VtVersion01 = 1;
  403. VtVersion02 = 2;
  404. QueuingW = 0;
  405. QueuingR = 1;
  406. sizeofThread = 20;
  407. aggr Thread
  408. {
  409. 'D' 0 pid;
  410. 'D' 4 ref;
  411. 'X' 8 error;
  412. 'D' 12 state;
  413. 'A' Thread 16 next;
  414. };
  415. defn
  416. Thread(addr) {
  417. complex Thread addr;
  418. print(" pid ", addr.pid, "\n");
  419. print(" ref ", addr.ref, "\n");
  420. print(" error ", addr.error\X, "\n");
  421. print(" state ", addr.state, "\n");
  422. print(" next ", addr.next\X, "\n");
  423. };
  424. sizeofVtLock = 20;
  425. aggr VtLock
  426. {
  427. Lock 0 lk;
  428. 'A' Thread 4 writer;
  429. 'D' 8 readers;
  430. 'A' Thread 12 qfirst;
  431. 'A' Thread 16 qlast;
  432. };
  433. defn
  434. VtLock(addr) {
  435. complex VtLock addr;
  436. print("Lock lk {\n");
  437. Lock(addr.lk);
  438. print("}\n");
  439. print(" writer ", addr.writer\X, "\n");
  440. print(" readers ", addr.readers, "\n");
  441. print(" qfirst ", addr.qfirst\X, "\n");
  442. print(" qlast ", addr.qlast\X, "\n");
  443. };
  444. sizeofVtRendez = 12;
  445. aggr VtRendez
  446. {
  447. 'A' VtLock 0 lk;
  448. 'A' Thread 4 wfirst;
  449. 'A' Thread 8 wlast;
  450. };
  451. defn
  452. VtRendez(addr) {
  453. complex VtRendez addr;
  454. print(" lk ", addr.lk\X, "\n");
  455. print(" wfirst ", addr.wfirst\X, "\n");
  456. print(" wlast ", addr.wlast\X, "\n");
  457. };
  458. ERROR = 0;
  459. complex Thread vtRock;
  460. complex Thread vtAttach:p;
  461. complex Lock lk$4;
  462. complex Thread vtDetach:p;
  463. complex Thread vtSetError:p;
  464. complex Lock lk$12;
  465. complex VtLock vtLockFree:p;
  466. complex VtLock vtRendezAlloc:p;
  467. complex VtRendez vtRendezAlloc:q;
  468. complex VtRendez vtRendezFree:q;
  469. complex VtLock vtCanLock:p;
  470. complex Thread vtCanLock:t;
  471. complex VtLock vtLock:p;
  472. complex Thread vtLock:t;
  473. complex VtLock vtCanRLock:p;
  474. complex VtLock vtRLock:p;
  475. complex Thread vtRLock:t;
  476. complex VtLock vtUnlock:p;
  477. complex Thread vtUnlock:t;
  478. complex Thread vtUnlock:tt;
  479. complex VtLock vtRUnlock:p;
  480. complex Thread vtRUnlock:t;
  481. complex VtRendez vtSleep:q;
  482. complex Thread vtSleep:s;
  483. complex Thread vtSleep:t;
  484. complex Thread vtSleep:tt;
  485. complex VtLock vtSleep:p;
  486. complex VtRendez vtWakeup:q;
  487. complex Thread vtWakeup:t;
  488. complex VtLock vtWakeup:p;
  489. complex VtRendez vtWakeupAll:q;
  490. complex Thread threadSleep:t;
  491. complex Thread threadWakeup:t;