~ubuntu-branches/debian/sid/postfix/sid

« back to all changes in this revision

Viewing changes to src/util/open_limit.c

  • Committer: Package Import Robot
  • Author(s): LaMont Jones, LaMont Jones, localization folks
  • Date: 2014-02-11 07:44:30 UTC
  • mfrom: (1.1.41)
  • Revision ID: package-import@ubuntu.com-20140211074430-91tdwgjriazawdz4
Tags: 2.11.0-1
[LaMont Jones]

* New upstream release: 2.11.0

[localization folks]

* l10n: Updated German translations.  Closes: #734893 (Helge Kreutzmann)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include <sys/resource.h>
35
35
#include <errno.h>
36
36
 
 
37
#ifdef USE_MAX_FILES_PER_PROC
 
38
#include <sys/sysctl.h>
 
39
#define MAX_FILES_PER_PROC      "kern.maxfilesperproc"
 
40
#endif
 
41
 
37
42
/* Application-specific. */
38
43
 
39
44
#include "iostuff.h"
63
68
    if (getrlimit(RLIMIT_NOFILE, &rl) < 0)
64
69
        return (-1);
65
70
    if (limit > 0) {
 
71
 
 
72
        /*
 
73
         * MacOSX incorrectly reports rlim_max as RLIM_INFINITY. The true
 
74
         * hard limit is finite and equals the kern.maxfilesperproc value.
 
75
         */
 
76
#ifdef USE_MAX_FILES_PER_PROC
 
77
        int     max_files_per_proc;
 
78
        size_t  len = sizeof(max_files_per_proc);
 
79
 
 
80
        if (sysctlbyname(MAX_FILES_PER_PROC, &max_files_per_proc, &len,
 
81
                         (void *) 0, (size_t) 0) < 0)
 
82
            return (-1);
 
83
        if (limit > max_files_per_proc)
 
84
            limit = max_files_per_proc;
 
85
#endif
66
86
        if (limit > rl.rlim_max)
67
87
            rl.rlim_cur = rl.rlim_max;
68
88
        else