diff options
author | Clint Adams <clint@users.sourceforge.net> | 2000-08-08 14:57:02 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2000-08-08 14:57:02 +0000 |
commit | cb89544d32619822541153118b0bc9c936573c64 (patch) | |
tree | dbab588ad5cff4f9e801a9b9804e0dfc12a2bac5 /Src/compat.c | |
parent | 3bca186819e7e1e0fc6321592ccc62d75e0525be (diff) | |
download | zsh-cb89544d32619822541153118b0bc9c936573c64.tar.gz zsh-cb89544d32619822541153118b0bc9c936573c64.tar.xz zsh-cb89544d32619822541153118b0bc9c936573c64.zip |
12568: check sysconf(_SC_OPEN_MAX) if available instead of OPEN_MAX/NOFILES.
Diffstat (limited to 'Src/compat.c')
-rw-r--r-- | Src/compat.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Src/compat.c b/Src/compat.c index e9c275df4..88ceac2c8 100644 --- a/Src/compat.c +++ b/Src/compat.c @@ -171,6 +171,27 @@ zpathmax(char *dir) } #endif +#ifdef HAVE_SYSCONF +/* This is replaced by a macro from system.h if not HAVE_PATHCONF. * + * 0 is returned if _SC_OPEN_MAX is unavailable * + * -1 is returned on error * + * * + * Neither of these should happen, but resort to OPEN_MAX rather * + * than return 0 or -1 just in case. */ + +/**/ +mod_export long +zopenmax(void) +{ + long openmax; + + openmax = sysconf(_SC_OPEN_MAX); + if(openmax < 1) + return OPEN_MAX; + else + return openmax; +} +#endif /**/ mod_export char * |