libgit2: update to 1.9.0
[oi-userland.git] / components / developer / binutils / patches / 03-stdio-limit.patch
blob756630f5465433dadeb9f44722b6b9100a99ccb1
1 imported from OmniOS
2 Try to get more FILE's on 32bit systems, or limit itself to not cross the limit if it fails
4 --- binutils-2.43.1/bfd/cache.c.orig
5 +++ binutils-2.43.1/bfd/cache.c
6 @@ -95,7 +95,24 @@
8 if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
9 && rlim.rlim_cur != (rlim_t) RLIM_INFINITY)
10 + {
11 +#if defined(__illumos__) && defined(_ILP32)
12 + /*
13 + * illumos stdio for 32-bit has an ABI-constrained limit that
14 + * the UNIX file descriptor must be 255 or less.
15 + *
16 + * This can be corrected by enabling extended FILE stdio, which
17 + * we do here if the reported rlimit allows us to do so.
18 + */
19 + if (rlim.rlim_cur > 256 &&
20 + enable_extended_FILE_stdio(-1, -1) == -1) {
21 + perror("Can't enable extended FILE");
22 + /* Cap it at 250 to not break stdio. */
23 + max = 250;
24 + } else
25 +#endif /* __illumos__ */
26 max = rlim.rlim_cur / 8;
27 + }
28 else
29 #endif
30 #ifdef _SC_OPEN_MAX