| 191 | } |
| 192 | |
| 193 | static bool |
| 194 | thread_count_inc(void) |
| 195 | { |
| 196 | static struct timeval lastfail; |
| 197 | static int curfail; |
| 198 | |
| 199 | thread_reap(); |
| 200 | if (thread_count_inc_try()) { |
| 201 | return (true); |
| 202 | } |
| 203 | |
| 204 | thread_reap_all(); |
| 205 | if (thread_count_inc_try()) { |
| 206 | return (true); |
| 207 | } |
| 208 | |
| 209 | if (ppsratecheck(&lastfail, &curfail, 1)) { |
| 210 | printf("maxthread limit exceeded by uid %u " |
| 211 | "(pid %d); consider increasing kern.maxthread\n", |
| 212 | curthread->td_ucred->cr_ruid, curproc->p_pid); |
| 213 | } |
| 214 | return (false); |
| 215 | } |
| 216 | |
| 217 | static void |
| 218 | thread_count_sub(int n) |
no test coverage detected