GnuPG 2.1.0 "modern" released

Werner Koch wk at gnupg.org
Wed Dec 3 21:17:33 CET 2014


On Wed,  3 Dec 2014 11:40, aixtools at gmail.com said:

> max. file descriptors: 2147483647
>
> Is this perhaps a bug - at least for the test logic - because this is an
> unusual number. And, is the test goinf to try an open that many file
> descriptors? I ulimit will stop much earlier - also because it says the max
> is 2000 not INT32_MAX!

This test is t-exechelp.c which uses the function below from
exechelp-posix.c:


--8<---------------cut here---------------start------------->8---
/* Return the maximum number of currently allowed open file
   descriptors.  Only useful on POSIX systems but returns a value on
   other systems too.  */
int
get_max_fds (void)
{
  int max_fds = -1;
#ifdef HAVE_GETRLIMIT
  struct rlimit rl;

# ifdef RLIMIT_NOFILE
  if (!getrlimit (RLIMIT_NOFILE, &rl))
    max_fds = rl.rlim_max;
# endif

# ifdef RLIMIT_OFILE
  if (max_fds == -1 && !getrlimit (RLIMIT_OFILE, &rl))
    max_fds = rl.rlim_max;

# endif
#endif /*HAVE_GETRLIMIT*/

#ifdef _SC_OPEN_MAX
  if (max_fds == -1)
    {
      long int scres = sysconf (_SC_OPEN_MAX);
      if (scres >= 0)
        max_fds = scres;
    }
#endif

#ifdef _POSIX_OPEN_MAX
  if (max_fds == -1)
    max_fds = _POSIX_OPEN_MAX;
#endif

#ifdef OPEN_MAX
  if (max_fds == -1)
    max_fds = OPEN_MAX;
#endif

  if (max_fds == -1)
    max_fds = 256;  /* Arbitrary limit.  */

  return max_fds;
}
--8<---------------cut here---------------end--------------->8---

To return the number of possible open file descriptors.  This is
required to close all file descriptors after a fork and before the exec.
Can you check which part of it is responsible for returning INT32_MAX?

> nofiles(descriptors) 2000

I would have expected that HAVE_GETRLIMIT and RLIMIT_NOFILE are both
defined in config.h because your ulimit seems to use it.


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-users mailing list