Mail Archives: djgpp-workers/2000/12/26/18:20:55
> > Unfortunately /dev/zero's man page (FYI zero(4)) does not mention these
> > functions.
>
> Well, you could write a short test program to see what GNU/Linux
> does. We could also say we don't care ;-)
We care, but only enough to know that the results are well-defined.
Returning a fixed value in all cases is sufficient.
> > read() does not have to return the number of bytes asked for.
>
> It doesn't? I've seen gobs of programs which depend on the fact it
> does.
It doesn't. It returns the number of bytes read, not the number you
asked for. They don't have to match. Network sockets are *notorious*
for returning less than you asked for. So is stdin. A temporary EOF
causes this also (i.e. someone else writes to the file while you're
reading from it).
> > So, when >= INT_MAX is requested, it will
> > return INT_MAX. Since the programmer should be aware that read() may not
> > return everything asked for, this avoids the overflow problem.
>
> I don't think it's a good idea. I also don't see any reason for such
> a drastic change in behavior, just to prevent buggy programs from
> getting what they asked for.
We have machines with more than 2G of memory running djgpp?
- Raw text -