Ignore:
Timestamp:
Apr 19, 2011, 3:23:04 PM (11 years ago)
Author:
jordan
Message:

(trunk libt) #4164 "FD_SETSIZE impact on open-file-limit and peer-limit-global" -- commit patch by romanr to take FD_SETSIZE into account before calling setrlimit()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r12364 r12373  
    782782        struct rlimit rlim;
    783783        const int NOFILE_BUFFER = 512;
    784         const int open_max = sysconf( _SC_OPEN_MAX );
     784        const int open_max = MIN( FD_SETSIZE, sysconf( _SC_OPEN_MAX ) );
    785785        getrlimit( RLIMIT_NOFILE, &rlim );
    786786        rlim.rlim_cur = MAX( 1024, open_max );
    787787        rlim.rlim_cur = MIN( rlim.rlim_cur, rlim.rlim_max );
    788788        setrlimit( RLIMIT_NOFILE, &rlim );
    789         tr_dbg( "setrlimit( RLIMIT_NOFILE, %d )", (int)rlim.rlim_cur );
     789        tr_dbg( "setrlimit( RLIMIT_NOFILE, %d ); FD_SETSIZE = %d", (int)rlim.rlim_cur, FD_SETSIZE );
    790790        gFd->socket_limit = MIN( socket_limit, (int)rlim.rlim_cur - NOFILE_BUFFER );
    791791    }
Note: See TracChangeset for help on using the changeset viewer.