Rev 5197 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5197 | Rev 5199 | ||
---|---|---|---|
Line 74... | Line 74... | ||
74 | /* Set max_open_files, if not already set, to 12.5% of the allowed open |
74 | /* Set max_open_files, if not already set, to 12.5% of the allowed open |
75 | file descriptors, but at least 10, and return the value. */ |
75 | file descriptors, but at least 10, and return the value. */ |
76 | static int |
76 | static int |
77 | bfd_cache_max_open (void) |
77 | bfd_cache_max_open (void) |
78 | { |
78 | { |
79 | if (max_open_files == 0) |
- | |
80 | { |
79 | |
81 | int max; |
- | |
82 | #ifdef HAVE_GETRLIMIT |
- | |
83 | struct rlimit rlim; |
- | |
84 | if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 |
- | |
85 | && rlim.rlim_cur != RLIM_INFINITY) |
- | |
86 | max = rlim.rlim_cur / 8; |
- | |
87 | else |
- | |
88 | #endif /* HAVE_GETRLIMIT */ |
- | |
89 | #ifdef _SC_OPEN_MAX |
- | |
90 | max = sysconf (_SC_OPEN_MAX) / 8; |
- | |
91 | #else |
- | |
92 | max = 10; |
- | |
93 | #endif /* _SC_OPEN_MAX */ |
- | |
94 | max_open_files = max < 10 ? 10 : max; |
80 | max_open_files = 16; |
95 | } |
- | |
Line 96... | Line 81... | ||
96 | 81 | ||
97 | return max_open_files; |
82 | return max_open_files; |
Line 98... | Line 83... | ||
98 | } |
83 | } |