Re: Ok, making ready for pre-2.4 and code-freeze..

Rogier Wolff (R.E.Wolff@bitwizard.nl)
Tue, 21 Dec 1999 23:50:24 +0100 (MET)


Tigran Aivazian wrote:
> On Tue, 21 Dec 1999, Rogier Wolff wrote:
> > On Linux at least the errno value will be set to preposterous
> > values, whenever you enter the "negative" area of "kmem".
>
> what do you mean? On Linux lseek(2) takes offset as off_t which is
> signed long (on x86) but I use it all the time passing very large values
> (e.g. c481ad8c which is even above 3G not 2G) to dump out data structures
> belonging to modules and it works just fine i.e. memory_lseek() method
> takes loff_t offsets.

Yes, lseek takes a signed as an argument: You need to be able to seek
to "10 bytes before where i'm now." and things like that.

lseek returns the resulting offset from the beginning of the file.

So, in this case it should return 0xc481ad8c, which is a negative number.
So the library would set errno to 3b7e5274 and return -1. My guess is that
lseek returns 0 in that case. So lseek is no longer conforming to the
manpage which states that it will return the offset from the beginning.

> what are these "preposterous values" you are talking about? lseek(2) on
> large offsets in /dev/kmem does not return -1 which is what I check for
> and if something does not return -1 we are not supposed to check errno.
>
> Perhaps you meant that lseek(2) returns 0 on those offsets? errno does not
> matter as 0 is not an error case.

Linux is "breaking the rules" a bit to provide useful functionality. But
in reality, it is not posix-compliant.

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
 "I didn't say it was your fault. I said I was going to blame it on you."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/