From: kevin lyda (kevin at domain suberic.net)
Date: Thu 17 Feb 2000 - 13:40:53 GMT
"John P. Looney" wrote:
> On Thu, Feb 17, 2000 at 12:38:09PM +0000, Niall mentioned:
> > Jeez J. give me a break - I know what it is - I'm wondering why it is !
> > I've looked in the sources (not very intensively, I admit) and I can't see
> > why a signed long is used.
> Does stat return size of -1 if it's an invalid file or something nasty ?
> It's prolly an historic reason...
read and write return the number of bytes written/read. in a
non-blocking mode that can be 0 up to the size of the buffer. and of
course, like all good functions it will notify the programmer that
there's an error: in this case with a return value of -1. (we all check
return codes, right?)
also, lseek takes it's offset as either positive or negative.
so, if one wanted to completely change the function signatures of read,
write, and lseek, then sure, go with unsigned longs. of course
considering that huge flamewars errupt when people change internal
kernel data structures, and doing the above would pretty much invalidate
every book on unix programming to date, i suspect it will be a hard
perhaps changing the typedefs of off_t, size_t, ssize_t, etc. to 64 or
128 bit numbers would be better? while that would break some programs,
they're the ones not using the correct types to begin with so that's
semi-ok. it would also increase the max file size by 2^32 instead of
-- kevin at domain suberic.net "we were goin' for breakfast. in canada. we fork()'ed on 37058400 made a deal: if she'd stop hookin', i'd stop meatspace place: home shootin' people. maybe we were aiming high." --porter, "payback"
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:05:26 GMT