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, 0);
  30 +       }
  31 +#endif
  32 +
  33         return Py_Main(argc, argv);
  34  }