/* set the open-file limit to the largest safe size wrt FD_SETSIZE */
if (!getrlimit (RLIMIT_NOFILE, &limit))
{
const int old_limit = (int) limit.rlim_cur;
const int new_limit = MIN (limit.rlim_max, FD_SETSIZE);
if (new_limit != old_limit)
{
limit.rlim_cur = new_limit;
setrlimit (RLIMIT_NOFILE, &limit);
getrlimit (RLIMIT_NOFILE, &limit);
tr_inf ("Changed open file limit from %d to %d", old_limit, (int)limit.rlim_cur);
}
...............