about summary refs log tree commit diff
path: root/Src/system.h
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-02-22 10:12:22 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-02-22 10:12:22 +0000
commit7977ce07470558dbc26b3bc97548aa6e263f4d4c (patch)
tree9e605ef2a3e1aff5b924fd490df9375c4c4a3abb /Src/system.h
parent349b6649c3e69e20370a8f94cb4b2906d7b5f60b (diff)
downloadzsh-7977ce07470558dbc26b3bc97548aa6e263f4d4c.tar.gz
zsh-7977ce07470558dbc26b3bc97548aa6e263f4d4c.tar.xz
zsh-7977ce07470558dbc26b3bc97548aa6e263f4d4c.zip
27721: rationalise initialisation of file descriptors
Diffstat (limited to 'Src/system.h')
-rw-r--r--Src/system.h10
1 files changed, 8 insertions, 2 deletions
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