From 7977ce07470558dbc26b3bc97548aa6e263f4d4c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 22 Feb 2010 10:12:22 +0000 Subject: 27721: rationalise initialisation of file descriptors --- Src/system.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Src/system.h') diff --git a/Src/system.h b/Src/system.h index 2707d20c9..1c737087f 100644 --- a/Src/system.h +++ b/Src/system.h @@ -304,16 +304,22 @@ struct timezone { # endif #endif +/* + * The number of file descriptors we'll allocate initially. + * We will reallocate later if necessary. + */ +#define ZSH_INITIAL_OPEN_MAX 64 #ifndef OPEN_MAX # ifdef NOFILE # define OPEN_MAX NOFILE # else /* so we will just pick something */ -# define OPEN_MAX 64 +# define OPEN_MAX ZSH_INITIAL_OPEN_MAX # endif #endif #ifndef HAVE_SYSCONF -# define zopenmax() ((long) OPEN_MAX) +# define zopenmax() ((long) (OPEN_MAX > ZSH_INITIAL_OPEN_MAX ? \ + ZSH_INITIAL_OPEN_MAX : OPEN_MAX)) #endif #ifdef HAVE_FCNTL_H -- cgit 1.4.1