Plan 9 from Bell Labs’s /usr/web/sources/contrib/quanstro/locktest/mcs.acid6

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


sizeof_1_ = 8;
aggr _1_
{
	'U' 0 lo;
	'U' 4 hi;
};

defn
_1_(addr) {
	complex _1_ addr;
	print("	lo	", addr.lo, "\n");
	print("	hi	", addr.hi, "\n");
};

sizeofFPdbleword = 8;
aggr FPdbleword
{
	'F' 0 x;
	{
	'U' 0 lo;
	'U' 4 hi;
	};
};

defn
FPdbleword(addr) {
	complex FPdbleword addr;
	print("	x	", addr.x, "\n");
	print("_1_ {\n");
		_1_(addr+0);
	print("}\n");
};

UTFmax = 4;
Runesync = 128;
Runeself = 128;
Runeerror = 65533;
Runemax = 1114111;
sizeofFmt = 80;
aggr Fmt
{
	'b' 0 runes;
	'Y' 8 start;
	'Y' 16 to;
	'Y' 24 stop;
	'Y' 32 flush;
	'Y' 40 farg;
	'D' 48 nfmt;
	'Y' 56 args;
	'D' 64 r;
	'D' 68 width;
	'D' 72 prec;
	'U' 76 flags;
};

defn
Fmt(addr) {
	complex Fmt addr;
	print("	runes	", addr.runes, "\n");
	print("	start	", addr.start\X, "\n");
	print("	to	", addr.to\X, "\n");
	print("	stop	", addr.stop\X, "\n");
	print("	flush	", addr.flush\X, "\n");
	print("	farg	", addr.farg\X, "\n");
	print("	nfmt	", addr.nfmt, "\n");
	print("	args	", addr.args\X, "\n");
	print("	r	", addr.r, "\n");
	print("	width	", addr.width, "\n");
	print("	prec	", addr.prec, "\n");
	print("	flags	", addr.flags, "\n");
};

FmtWidth = 1;
FmtLeft = 2;
FmtPrec = 4;
FmtSharp = 8;
FmtSpace = 16;
FmtSign = 32;
FmtZero = 64;
FmtUnsigned = 128;
FmtShort = 256;
FmtLong = 512;
FmtVLong = 1024;
FmtComma = 2048;
FmtByte = 4096;
FmtFlag = 8192;
sizeofTm = 40;
aggr Tm
{
	'D' 0 sec;
	'D' 4 min;
	'D' 8 hour;
	'D' 12 mday;
	'D' 16 mon;
	'D' 20 year;
	'D' 24 wday;
	'D' 28 yday;
	'a' 32 zone;
	'D' 36 tzoff;
};

defn
Tm(addr) {
	complex Tm addr;
	print("	sec	", addr.sec, "\n");
	print("	min	", addr.min, "\n");
	print("	hour	", addr.hour, "\n");
	print("	mday	", addr.mday, "\n");
	print("	mon	", addr.mon, "\n");
	print("	year	", addr.year, "\n");
	print("	wday	", addr.wday, "\n");
	print("	yday	", addr.yday, "\n");
	print("	zone	", addr.zone, "\n");
	print("	tzoff	", addr.tzoff, "\n");
};

PNPROC = 1;
PNGROUP = 2;
Profoff = 0;
Profuser = 1;
Profkernel = 2;
Proftime = 3;
Profsample = 4;
sizeofLock = 8;
aggr Lock
{
	'D' 0 val;
};

defn
Lock(addr) {
	complex Lock addr;
	print("	val	", addr.val, "\n");
};

sizeofQLp = 24;
aggr QLp
{
	'D' 0 inuse;
	'A' QLp 8 next;
	'C' 16 state;
};

defn
QLp(addr) {
	complex QLp addr;
	print("	inuse	", addr.inuse, "\n");
	print("	next	", addr.next\X, "\n");
	print("	state	", addr.state, "\n");
};

sizeofQLock = 32;
aggr QLock
{
	Lock 0 lock;
	'D' 8 locked;
	'A' QLp 16 $head;
	'A' QLp 24 $tail;
};

defn
QLock(addr) {
	complex QLock addr;
	print("Lock lock {\n");
	Lock(addr.lock);
	print("}\n");
	print("	locked	", addr.locked, "\n");
	print("	$head	", addr.$head\X, "\n");
	print("	$tail	", addr.$tail\X, "\n");
};

sizeofRWLock = 32;
aggr RWLock
{
	Lock 0 lock;
	'D' 8 readers;
	'D' 12 writer;
	'A' QLp 16 $head;
	'A' QLp 24 $tail;
};

defn
RWLock(addr) {
	complex RWLock addr;
	print("Lock lock {\n");
	Lock(addr.lock);
	print("}\n");
	print("	readers	", addr.readers, "\n");
	print("	writer	", addr.writer, "\n");
	print("	$head	", addr.$head\X, "\n");
	print("	$tail	", addr.$tail\X, "\n");
};

sizeofRendez = 24;
aggr Rendez
{
	'A' QLock 0 l;
	'A' QLp 8 $head;
	'A' QLp 16 $tail;
};

defn
Rendez(addr) {
	complex Rendez addr;
	print("	l	", addr.l\X, "\n");
	print("	$head	", addr.$head\X, "\n");
	print("	$tail	", addr.$tail\X, "\n");
};

sizeofNetConnInfo = 72;
aggr NetConnInfo
{
	'Y' 0 dir;
	'Y' 8 root;
	'Y' 16 spec;
	'Y' 24 lsys;
	'Y' 32 lserv;
	'Y' 40 rsys;
	'Y' 48 rserv;
	'Y' 56 laddr;
	'Y' 64 raddr;
};

defn
NetConnInfo(addr) {
	complex NetConnInfo addr;
	print("	dir	", addr.dir\X, "\n");
	print("	root	", addr.root\X, "\n");
	print("	spec	", addr.spec\X, "\n");
	print("	lsys	", addr.lsys\X, "\n");
	print("	lserv	", addr.lserv\X, "\n");
	print("	rsys	", addr.rsys\X, "\n");
	print("	rserv	", addr.rserv\X, "\n");
	print("	laddr	", addr.laddr\X, "\n");
	print("	raddr	", addr.raddr\X, "\n");
};

RFNAMEG = 1;
RFENVG = 2;
RFFDG = 4;
RFNOTEG = 8;
RFPROC = 16;
RFMEM = 32;
RFNOWAIT = 64;
RFCNAMEG = 1024;
RFCENVG = 2048;
RFCFDG = 4096;
RFREND = 8192;
RFNOMNT = 16384;
sizeofQid = 16;
aggr Qid
{
	'W' 0 path;
	'U' 8 vers;
	'b' 12 type;
};

defn
Qid(addr) {
	complex Qid addr;
	print("	path	", addr.path, "\n");
	print("	vers	", addr.vers, "\n");
	print("	type	", addr.type, "\n");
};

sizeofDir = 80;
aggr Dir
{
	'u' 0 type;
	'U' 4 dev;
	Qid 8 qid;
	'U' 24 mode;
	'U' 28 atime;
	'U' 32 mtime;
	'V' 40 length;
	'Y' 48 name;
	'Y' 56 uid;
	'Y' 64 gid;
	'Y' 72 muid;
};

defn
Dir(addr) {
	complex Dir addr;
	print("	type	", addr.type, "\n");
	print("	dev	", addr.dev, "\n");
	print("Qid qid {\n");
	Qid(addr.qid);
	print("}\n");
	print("	mode	", addr.mode, "\n");
	print("	atime	", addr.atime, "\n");
	print("	mtime	", addr.mtime, "\n");
	print("	length	", addr.length, "\n");
	print("	name	", addr.name\X, "\n");
	print("	uid	", addr.uid\X, "\n");
	print("	gid	", addr.gid\X, "\n");
	print("	muid	", addr.muid\X, "\n");
};

sizeofWaitmsg = 24;
aggr Waitmsg
{
	'D' 0 pid;
	'a' 4 time;
	'Y' 16 msg;
};

defn
Waitmsg(addr) {
	complex Waitmsg addr;
	print("	pid	", addr.pid, "\n");
	print("	time	", addr.time, "\n");
	print("	msg	", addr.msg\X, "\n");
};

sizeofIOchunk = 16;
aggr IOchunk
{
	'Y' 0 addr;
	'U' 8 len;
};

defn
IOchunk(addr) {
	complex IOchunk addr;
	print("	addr	", addr.addr\X, "\n");
	print("	len	", addr.len, "\n");
};

sizeofQnode = 16;
aggr Qnode
{
	'A' Qnode 0 next;
	'D' 8 locked;
};

defn
Qnode(addr) {
	complex Qnode addr;
	print("	next	", addr.next\X, "\n");
	print("	locked	", addr.locked, "\n");
};

complex Qnode ·mcslock:L;
complex Qnode ·mcslock:l;
complex Qnode ·mcslock:prev;
complex Qnode ·mcsunlock:L;
complex Qnode ·mcsunlock:l;

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].