9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] who command for fossil
@ 2003-03-14  8:49 Fco.J.Ballesteros
  0 siblings, 0 replies; only message in thread
From: Fco.J.Ballesteros @ 2003-03-14  8:49 UTC (permalink / raw)
  To: 9fans

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.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-14  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-14  8:49 [9fans] who command for fossil Fco.J.Ballesteros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).