author | John Beck <John.Beck@Oracle.COM> |
Mon, 06 Oct 2014 13:15:36 -0700 | |
branch | s11u2-sru |
changeset 3379 | e99da14b537a |
parent 458 | 2edc011b559e |
child 6445 | 0edecb568b2e |
permissions | -rw-r--r-- |
3379
e99da14b537a
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
458
diff
changeset
|
1 |
This patch provides extended file stdio support. |
e99da14b537a
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
458
diff
changeset
|
2 |
As it is Solaris-specific, it is not suitable for upstream. |
e99da14b537a
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
458
diff
changeset
|
3 |
|
458 | 4 |
--- Python-2.7.1/Modules/python.c.orig Tue Jun 21 21:35:45 2011 |
5 |
+++ Python-2.7.1/Modules/python.c Tue Jun 21 21:39:29 2011 |
|
6 |
@@ -6,6 +6,13 @@ |
|
7 |
#include <floatingpoint.h> |
|
8 |
#endif |
|
9 |
||
10 |
+#if defined(sun) && defined(__SVR4) && !defined(_LP64) |
|
11 |
+#define USE_EXTENDED_FILE_STDIO 1 |
|
12 |
+#include <stdio.h> |
|
13 |
+#include <stdio_ext.h> |
|
14 |
+#include <signal.h> |
|
15 |
+#endif |
|
16 |
+ |
|
17 |
int |
|
18 |
main(int argc, char **argv) |
|
19 |
{ |
|
20 |
@@ -20,5 +27,18 @@ |
|
21 |
m = fpgetmask(); |
|
22 |
fpsetmask(m & ~FP_X_OFL); |
|
23 |
#endif |
|
24 |
+#ifdef USE_EXTENDED_FILE_STDIO |
|
25 |
+ /* |
|
26 |
+ * enable extended FILE facility on Solaris so that Python |
|
27 |
+ * apps can keep more than 256 file descriptors open |
|
28 |
+ */ |
|
29 |
+ struct rlimit rlp; |
|
30 |
+ (void) getrlimit(RLIMIT_NOFILE, &rlp); |
|
31 |
+ rlp.rlim_cur = rlp.rlim_max; |
|
32 |
+ if (setrlimit(RLIMIT_NOFILE, &rlp) != -1) { |
|
33 |
+ enable_extended_FILE_stdio(-1, 0); |
|
34 |
+ } |
|
35 |
+#endif |
|
36 |
+ |
|
37 |
return Py_Main(argc, argv); |
|
38 |
} |