"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 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."
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!