svn commit: r201999 - head/lib/libc/stdio

Andrey Chernov ache at nagual.pp.ru
Sun Jan 10 23:21:41 UTC 2010


On Mon, Jan 11, 2010 at 12:06:18AM +0100, Jilles Tjoelker wrote:
> > I picked EINVAL because this is the code used by read(2) and write(2) if they
> > are passed nbytes > INT_MAX.  It would seem odd to use one error code for a
> > number of bytes between INT_MAX and SIZE_MAX and then switch to a different
> > error code for > SIZE_MAX bytes.
> 
> I think the fact that you can only read(2)/write(2) INT_MAX at a time is
> a bug, so basing additional code on it seems inappropriate.
> 
> Even then, fread()/fwrite() will not generate such large
> read(2)/write(2) requests as they always go through the buffer which is
> filled using smaller requests.
> 
> Also, EOVERFLOW will give a more understandable error message for users.

Agreed. 
F.e. POSIX limit for write(2) is {SSIZE_MAX}, not INT_MAX.

-- 
http://ache.pp.ru/


More information about the svn-src-all mailing list