* than 255 arguments
*/
/* 2-bytes hole */
+ int est_fd_usage; /* rough estimate of reserved FDs (listeners, pollers etc) */
int cfg_curr_line; /* line number currently being parsed */
const char *cfg_curr_file; /* config file currently being parsed or NULL */
char *cfg_curr_section; /* config section name currently being parsed or NULL */
global.maxsock += p->peers_fe->maxconn;
}
+ /* count listeners, checks, plus 1 poller and one wake-up pipe (2fd) per thread */
+ global.est_fd_usage = global.maxsock + 3 * global.nbthread;
+
/* Compute the global.maxconn and possibly global.maxsslconn values */
set_global_maxconn();
global.maxsock = compute_ideal_maxsock(global.maxconn);
/* considers global.maxsocks, global.maxpipes, async engines, SSL frontends and
* rlimits and computes an ideal maxconn. It's meant to be called only when
- * maxsock contains the sum of listening FDs, before it is updated based on
- * maxconn and pipes. If there are not enough FDs left, DEFAULT_MAXCONN (by
- * default 100) is returned as it is expected that it will even run on tight
+ * global.est_fd_usage contains the sum of listening FDs, before it is updated
+ * based on maxconn and pipes. If there are not enough FDs left, DEFAULT_MAXCONN
+ * (by default 100) is returned as it is expected that it will even run on tight
* environments, and will maintain compatibility with previous packages that
* used to rely on this value as the default one. The system will emit a
* warning indicating how many FDs are missing anyway if needed.
}
/* subtract listeners and checks */
- remain -= global.maxsock;
-
- /* one epoll_fd/kqueue_fd per thread */
- remain -= global.nbthread;
-
- /* one wake-up pipe (2 fd) per thread */
- remain -= 2 * global.nbthread;
+ remain -= global.est_fd_usage;
/* Fixed pipes values : we only subtract them if they're not larger
* than the remaining FDs because pipes are optional.