2012-04-04 14 views
0

Im folgenden Code:Warum ist RLIMIT_NOFILE rlim_max von -1 auf BSD?

139  struct rlimit limit; 
140 
141  method = "rlimit"; 
142  if (getrlimit(RLIMIT_NOFILE, &limit) < 0) { 
143  perror("calling getrlimit"); 
144  exit(1); 
145  } 
146 
147  /* set the current to the maximum or specified value */ 
148  if (max_desired_fds) 
149  limit.rlim_cur = max_desired_fds; 
150  else { 
151   limit.rlim_cur = limit.rlim_max; 
152  } 
153 
154  if (setrlimit(RLIMIT_NOFILE, &limit) < 0) { 
155  perror("calling setrlimit"); 
156  exit(1); 
157  } 

die setrlimit Linie versagt (I der Fehler "Aufruf setrlimit" erhalten). Weitere Untersuchungen zeigen, dass limit.rlim_max -1 ist, was kein gültiger Wert ist. Irgendwelche Ideen warum wäre das? Dies ist unter Mac OSX.

Antwort