2 # Determine approximately how many files may be open simultaneously
3 # in one process. This is approximate, since while running this test,
4 # the configure script already has a few files open.
7 AC_DEFUN([UTILS_SYS_OPEN_MAX],
9 AC_CACHE_CHECK([determine how many files may be open simultaneously],
10 utils_cv_sys_open_max,
12 AC_RUN_IFELSE([AC_LANG_SOURCE([[
19 FILE *result = fopen ("conftest.omax", "w");
21 /* Impose an arbitrary limit, in case some system has no
22 effective limit on the number of simultaneously open files. */
25 FILE *s = fopen ("conftest.op", "w");
30 fprintf (result, "%d\n", i);
31 exit (fclose (result) == EOF);
34 [utils_cv_sys_open_max=`cat conftest.omax`],
35 [utils_cv_sys_open_max='internal error in open-max.m4'],
36 [utils_cv_sys_open_max='cross compiling run-test in open-max.m4'])])
38 AC_DEFINE_UNQUOTED([UTILS_OPEN_MAX],
39 $utils_cv_sys_open_max,
40 [the maximum number of simultaneously open files per process])