author  Mike Sullivan <Mike.Sullivan@Oracle.COM> 
Mon, 11 Mar 2013 10:38:09 0700  
branch  s11update 
changeset 2520  ceec631e74d1 
parent 276  18dcd0ca5b0c 
permissions  rwrr 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

1 
diff git Python2.6.4/Modules/python.c Python2.6.4/Modules/python.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

2 
 Python2.6.4/Modules/python.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

3 
+++ Python2.6.4/Modules/python.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

4 
@@ 6,6 +6,13 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

5 
#include <floatingpoint.h> 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

6 
#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

7 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

8 
+#if defined(sun) && defined(__SVR4) && !defined(_LP64) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

9 
+#define USE_EXTENDED_FILE_STDIO 1 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

10 
+#include <stdio.h> 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

11 
+#include <stdio_ext.h> 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

12 
+#include <signal.h> 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

13 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

14 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

15 
int 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

16 
main(int argc, char **argv) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

17 
{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

18 
@@ 20,5 +27,16 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

19 
m = fpgetmask(); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

20 
fpsetmask(m & ~FP_X_OFL); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

21 
#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

22 
+#ifdef USE_EXTENDED_FILE_STDIO 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

23 
+ /* enable extended FILE facility on Solaris so that Python 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

24 
+ apps can keep more than 256 file descriptors open */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

25 
+ struct rlimit rlp; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

26 
+ (void) getrlimit(RLIMIT_NOFILE, &rlp); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

27 
+ rlp.rlim_cur = rlp.rlim_max; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

28 
+ if (setrlimit(RLIMIT_NOFILE, &rlp) != 1) { 
276
18dcd0ca5b0c
7048937 python should not die from SIGABRT when user passes bogus fd to os.fstat
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
115
diff
changeset

29 
+ enable_extended_FILE_stdio(1, 0); 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

30 
+ } 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

31 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

32 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

33 
return Py_Main(argc, argv); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

34 
} 