| 52 | namespace { |
| 53 | |
| 54 | void |
| 55 | check_nfile(size_t nfile) |
| 56 | { |
| 57 | struct rlimit rl = { }; |
| 58 | const int r = getrlimit(RLIMIT_NOFILE, &rl); |
| 59 | if (r != 0) { |
| 60 | fatal_abort("check_nfile: getrlimit failed"); |
| 61 | } |
| 62 | if (rl.rlim_cur < static_cast<rlim_t>(nfile + 1000)) { |
| 63 | fprintf(stderr, |
| 64 | "[Warning] handlersocket: open_files_limit is too small.\n"); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | }; |
| 69 |