Subject: ps, vmstat, negative lseek
To: None <port-alpha@NetBSD.ORG>
From: Ross Harvey <ross@teraflop.com>
List: port-alpha
Date: 04/09/1997 14:40:43
OK, I give up, and I really hope I'm not doing something stupid...

ps and vmstat work fine with the generic kernel I saved from the 970305
snapshot I started from, but not with newly compiled kernels.

OK, I say, rebuild libkvm, ps, vmstat. They still don't work, and the
reason they fail is....via vmstat>libkvmm>kvm_read>sys_lseek...we end
up trying to seek to a kva, always negative on alpha, but sys_lseek always
shoots down negative seeks with EINVAL.

So how did it ever work? How does the snapshot kernel take kseg addresses
in, seek to them in /dev/kmem, and work?

Disassembling sys_lseek in generic(970305), I see that the code is
different from mine; there isn't a signed comparison at the bottom. 

If I comment out the test at the end of sys_lseek:

	/*if (newoff < 0)
		return (EINVAL);*/
	

   [1] ps and vmstat start working

   [2] the generated code is closer, but not identical

If off_t was supposed to be unsigned...but it isn't and I can't seem to
find an error involving a skipped "make includes" or any other pilot error.

One thing is a big laugh! Does anyone else see the irony of disassembling
a free OS for which both mine and the organization's source code are on-line!?