Thread (16 messages) flat view 16 messages, 5 authors, 2016-06-15

Re: read() MAX_IO_SIZE bytes, more than SSIZE_MAX?

From: Joachim Schmitz <hidden>
Date: 2016-06-15 23:03:45

Junio C Hamano <gitster <at> pobox.com> writes:
On Sat, Feb 7, 2015 at 12:32 PM, Torsten Bögershausen <tboegi <at> 
web.de> wrote:
quoted
I don't know every platform of the planet well enough to be helpful 
here,
quoted
especially the ones which don't follow all the specifications.

In other words: As long as we can not guarantee that SSIZE_MAX is 
defined,
quoted
(and is defined to somethong useful for xread()/xwrite() )
we should be more defensive here:

tweak only on platform where we know it is needed and we know that it 
works.
Yup, I agree that is a sensible way to go.

 (1) if Makefile overrides the size, use it; otherwise
 (2) if SSIZE_MAX is defined, and it is smaller than our internal
default, use it; otherwise
 (3) use our internal default.

And leave our internal default to 8MB.

That way, nobody needs to do anything differently from his current build 
set-up,
and I suspect that it would make step (1) optional.
something like this:

/* allow overwriting from e.g. Makefile */
#if !defined(MAX_IO_SIZE)
# define MAX_IO_SIZE (8*1024*1024)
#endif
/* for plattforms that have SSIZE and have it smaller */
#if defined(SSIZE_MAX && (SSIZE_MAX < MAX_IO_SIZE) 
# undef MAX_IO_SIZE /* avoid warning */
# define MAX_IO_SIZE SSIZE_MAX
#endif

Steps 2 and 3 only , indeed step 1 not needed...

Bye, Jojo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help