diff options
author | Jim Meyering <jim@meyering.net> | 2003-02-01 11:00:45 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-02-01 11:00:45 +0000 |
commit | ba61c1af868bf43ebecd1171b0494f8ab1433704 (patch) | |
tree | 9ca919d7b80141de323f151dc777cd65d38570b6 /m4/open-max.m4 | |
parent | 1973da17d06d5d4a78df6584fc696e82c431fe56 (diff) | |
download | coreutils-ba61c1af868bf43ebecd1171b0494f8ab1433704.tar.xz |
add comments
Diffstat (limited to 'm4/open-max.m4')
-rw-r--r-- | m4/open-max.m4 | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/m4/open-max.m4 b/m4/open-max.m4 new file mode 100644 index 000000000..218f75bfd --- /dev/null +++ b/m4/open-max.m4 @@ -0,0 +1,41 @@ +#serial 1 +# Determine approximately how many files may be open simultaneously +# in one process. This is approximate, since while running this test, +# the configure script already has a few files open. +# From Jim Meyering + +AC_DEFUN([UTILS_SYS_OPEN_MAX], +[ + AC_CACHE_CHECK([determine how many files may be open simultaneously], + utils_cv_sys_open_max, + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + int + main () + { + FILE *result = fopen ("conftest.omax", "w"); + int i = 1; + /* Impose an arbitrary limit, in case some system has no + effective limit on the number of simultaneously open files. */ + while (i < 30000) + { + FILE *s = fopen ("conftest.op", "w"); + if (!s) + break; + ++i; + } + fprintf (result, "%d\n", i); + exit (fclose (result) == EOF); + } + ]])], + [utils_cv_sys_open_max=`cat conftest.omax`], + [utils_cv_sys_open_max='cross compiling run-test in open-max.m4'], + [utils_cv_sys_open_max='internal error in open-max.m4'])]) + + AC_DEFINE_UNQUOTED([UTILS_OPEN_MAX], + $utils_cv_sys_open_max, + [the maximum number of simultaneously open files per process]) +]) |