Re: poll(2) only can handle 256 fds?



On 11 Mar 2005 02:12:48 +0100, Markus Lausser
<sgop users sourceforge net> wrote:
run without problems: ./test 256
run with endless loop: ./test 257

FWIW, I get:

  no problems: ./test 1024
  breaks: ./test 1025

Linux constable 2.4.21-273-smp4G

I have something like this near the start of programs of mine which
need lots of file descriptors:

#ifdef HAVE_GETRLIMIT
        /* Make sure we have lots of file descriptors.
         */
        if( getrlimit( RLIMIT_NOFILE, &rlp ) == 0 ) {
                rlp.rlim_cur = rlp.rlim_max;
                if( setrlimit( RLIMIT_NOFILE, &rlp ) == 0 ) {
#ifdef DEBUG
                        printf( "set max file descriptors to %d\n",
                                (int) rlp.rlim_max );
#endif /*DEBUG*/
                }
                else {
                        g_warning( _( "unable to change max file "
                                "descriptors\n"
                                "max file descriptors still set to %d" ),
                                (int) rlp.rlim_cur );
                }
        }
        else {
                g_warning( _( "unable to read max file descriptors" ) );
        }
#endif /*HAVE_GETRLIMIT*/

Although I'm not sure how much it helps or on what systems :-(

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]