From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu From: Fco.J.Ballesteros MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] who command for fossil Date: Fri, 14 Mar 2003 09:49:58 +0100 Topicbox-Message-UUID: 7ffdb2c4-eacb-11e9-9e20-41e7f4b1d025 I find this useful to know who's using the fossil before rebooting it. diff /n/dump/2003/0314/sys/src/cmd/fossil /sys/src/cmd/fossil diff /n/dump/2003/0314/sys/src/cmd/fossil/9proc.c /sys/src/cmd/fossil/9proc.c 732a733,763 > static int > cmdWho(int argc, char* argv[]) > { > Con *con; > Fid *fid, *hash; > char *usage = "usage: who"; > int i; > > ARGBEGIN{ > default: > return cliError(usage); > }ARGEND; > > if (argc > 0) > return cliError(usage); > vtRLock(cbox.clock); > for(con = cbox.chead; con != nil; con = con->cnext){ > consPrint("\t%s\n", con->name); > vtLock(con->fidlock); > for (i = 0; i < NFidHash; i++){ > hash = con->fidhash[i]; > for(fid = hash; fid != nil; fid = fid->hash) > if(fid->fidno != NOFID && fid->uname != nil) > consPrint("\t\t%d: %s\n", fid->fidno, fid->uname); > } > vtUnlock(con->fidlock); > } > vtRUnlock(cbox.clock); > return 1; > } > 744a776 > cliAddCmd("who", cmdWho); diff /n/dump/2003/0314/sys/man/8/fossilcons /sys/man/8/fossilcons 261a262,263 > .PP > .B who 836a839,842 > .PP > .I Who > prints the set of active fids for each connection along with > the user name for each fid.