~kris/9p

9hist

f9dff981b317f3f50ac314f2c4e6b396864fb7b4 — David du Colombier 27 years ago f9d03d2
Plan 9 from Bell Labs 1999-05-09
2 files changed, 37 insertions(+), 2 deletions(-)

M port/devcons.c
M port/tod.c
M port/devcons.c => port/devcons.c +37 -0
@@ 340,6 340,7 @@ enum{
	Qauth,
	Qauthcheck,
	Qauthent,
	Qtiming,
	Qclock,
	Qcons,
	Qconsctl,


@@ 391,6 392,7 @@ static Dirtab consdir[]={
	"sysname",	{Qsysname},	0,		0664,
	"sysstat",	{Qsysstat},	0,		0666,
	"time",		{Qtime},	NUMSIZE,	0664,
	"timing",	{Qtiming},	3*8,		0664,
	"user",		{Quser},	NAMELEN,	0666,
};



@@ 528,6 530,21 @@ consclose(Chan *c)
	}
}


uvlong order = 0x0001020304050607ULL;

void
vlong2le(char *t, vlong from)
{
	uchar *f, *o;
	int i;

	f = (uchar*)&from;
	o = (uchar*)ℴ
	for(i = 0; i < 8; i++)
		t[i] = f[o[i]];
}

static long
consread(Chan *c, void *buf, long n, vlong off)
{


@@ 655,6 672,26 @@ consread(Chan *c, void *buf, long n, vlong off)
		memmove(buf, tmp+k, n);
		return n;

	case Qtiming:
		k = 0;
		if(n >= 3*8){
			ticks = fastticks((uvlong*)&fasthz);
			vlong2le(cbuf+16, fasthz);
			vlong2le(cbuf+8, ticks);
			k += 2*8;
		} else if(n >= 2*8){
			ticks = fastticks(nil);
			vlong2le(cbuf+8, ticks);
			k += 8;
		}
		if(n >= 8){
			ticks = todget();
			vlong2le(cbuf, ticks);
			k += 8;
		}
		return k;
			

	case Qkey:
		return keyread(buf, n, offset);


M port/tod.c => port/tod.c +0 -2
@@ 55,8 55,6 @@ todinit(void)
void
todsetfreq(vlong f)
{
	int lf;

	// the shift is an attempt to maintain precision
	// during the caculations.  the number of bits in
	// the multiplier should be log(TODFREQ) + 31 - log(f).