Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 2010 02:21:35 +0300
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Colin Percival <cperciva@freebsd.org>
Subject:   Re: svn commit: r201999 - head/lib/libc/stdio
Message-ID:  <20100110232134.GA48128@nagual.pp.ru>
In-Reply-To: <20100110230618.GA6756@stack.nl>
References:  <201001101430.o0AEUURS051917@svn.freebsd.org> <20100110212548.GA47331@nagual.pp.ru> <4B4A5252.9070205@freebsd.org> <20100110230618.GA6756@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100110232134.GA48128>