>>693OK, I got it.. : )
How about you use
setrlimit(2)?
I modified in main.m of The Unarchiver.
Modify it for your adequate use, please.
static int setOpenmax(rlim_t limit)
{
struct rlimit rl;
int status;
rl.rlim_max = RLIM_INFINITY;
rl.rlim_cur = ( limit < RLIM_INFINITY) ? limit : RLIM_INFINITY ;
if ((status = setrlimit(RLIMIT_NOFILE, &rl)) == -1) {
if (getrlimit(RLIMIT_NOFILE, &rl) == -1)
NSLog(@"getrlimit: NOFILE");
rl.rlim_cur = rl.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
NSLog(@"setrlimit: NOFILE");
}
return status;
}
int main(int argc,const char **argv)
{
rlim_t limit = ( OPEN_MAX < RLIM_INFINITY) ? OPEN_MAX : RLIM_INFINITY;
if (setOpenmax( limit ) == -1)
NSLog(@"Failed to change OPEN_MAX");
...continues...