components/python/python26/patches/Python26-19-ext-stdio.patch
changeset 115 c360825c3a3f
parent 99 c15c9099bb44
child 276 18dcd0ca5b0c
equal deleted inserted replaced
114:6cc95ec7b1bb 115:c360825c3a3f
       
     1 diff --git Python-2.6.4/Modules/python.c Python-2.6.4/Modules/python.c
       
     2 --- Python-2.6.4/Modules/python.c
       
     3 +++ Python-2.6.4/Modules/python.c
       
     4 @@ -6,6 +6,13 @@
       
     5  #include <floatingpoint.h>
       
     6  #endif
       
     7  
       
     8 +#if defined(sun) && defined(__SVR4) && !defined(_LP64)
       
     9 +#define USE_EXTENDED_FILE_STDIO 1
       
    10 +#include <stdio.h>
       
    11 +#include <stdio_ext.h>
       
    12 +#include <signal.h>
       
    13 +#endif
       
    14 +
       
    15  int
       
    16  main(int argc, char **argv)
       
    17  {
       
    18 @@ -20,5 +27,16 @@
       
    19  	m = fpgetmask();
       
    20  	fpsetmask(m & ~FP_X_OFL);
       
    21  #endif
       
    22 +#ifdef USE_EXTENDED_FILE_STDIO
       
    23 +	/* enable extended FILE facility on Solaris so that Python
       
    24 +           apps can keep more than 256 file descriptors open */
       
    25 +	struct rlimit rlp;
       
    26 +	(void) getrlimit(RLIMIT_NOFILE, &rlp);
       
    27 +	rlp.rlim_cur = rlp.rlim_max;
       
    28 +	if (setrlimit(RLIMIT_NOFILE, &rlp) != -1) {
       
    29 +		enable_extended_FILE_stdio(-1, SIGABRT);
       
    30 +	}
       
    31 +#endif
       
    32 +
       
    33  	return Py_Main(argc, argv);
       
    34  }