mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
rlimit formula
git-svn-id: file:///svn/unbound/trunk@1365 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
e25608d1be
commit
4ea644f5a2
2 changed files with 8 additions and 4 deletions
|
|
@ -97,11 +97,12 @@ static void
|
||||||
checkrlimits(struct config_file* cfg)
|
checkrlimits(struct config_file* cfg)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GETRLIMIT
|
#ifdef HAVE_GETRLIMIT
|
||||||
int list = ((cfg->do_ip4?1:0) + (cfg->do_ip6?1:0)) *
|
int list = ((cfg->do_udp?1:0) + (cfg->do_tcp?1 +
|
||||||
((cfg->do_udp?1:0) + (cfg->do_tcp?1 +
|
|
||||||
(int)cfg->incoming_num_tcp:0));
|
(int)cfg->incoming_num_tcp:0));
|
||||||
size_t ifs = (size_t)(cfg->num_ifs==0?1:cfg->num_ifs);
|
size_t listen_ifs = (size_t)(cfg->num_ifs==0?
|
||||||
size_t listen_num = list*ifs;
|
((cfg->do_ip4 && !cfg->if_automatic?1:0) +
|
||||||
|
(cfg->do_ip6?1:0)):cfg->num_ifs);
|
||||||
|
size_t listen_num = list*listen_ifs;
|
||||||
size_t outudpnum = (size_t)cfg->outgoing_num_ports;
|
size_t outudpnum = (size_t)cfg->outgoing_num_ports;
|
||||||
size_t outtcpnum = cfg->outgoing_num_tcp;
|
size_t outtcpnum = cfg->outgoing_num_tcp;
|
||||||
size_t misc = 4; /* logfile, pidfile, stdout... */
|
size_t misc = 4; /* logfile, pidfile, stdout... */
|
||||||
|
|
@ -132,6 +133,8 @@ checkrlimits(struct config_file* cfg)
|
||||||
log_warn("setrlimit: %s", strerror(errno));
|
log_warn("setrlimit: %s", strerror(errno));
|
||||||
log_warn("cannot increase max open fds from %u to %u",
|
log_warn("cannot increase max open fds from %u to %u",
|
||||||
(unsigned)avail, (unsigned)total+10);
|
(unsigned)avail, (unsigned)total+10);
|
||||||
|
if(numthread*perthread_noudp+15 > avail)
|
||||||
|
fatal_exit("too much tcp. not enough fds.");
|
||||||
cfg->outgoing_num_ports = (int)((avail
|
cfg->outgoing_num_ports = (int)((avail
|
||||||
- numthread*perthread_noudp
|
- numthread*perthread_noudp
|
||||||
- 10 /* safety margin */) /numthread);
|
- 10 /* safety margin */) /numthread);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
20 November 2008: Wouter
|
20 November 2008: Wouter
|
||||||
- fixup fatal error due to faulty error checking after tcp accept.
|
- fixup fatal error due to faulty error checking after tcp accept.
|
||||||
|
- add check in rlimit to avoid integer underflow. Better formula.
|
||||||
|
|
||||||
19 November 2008: Wouter
|
19 November 2008: Wouter
|
||||||
- bug #219: fixed so that syslog which delays opening until the first
|
- bug #219: fixed so that syslog which delays opening until the first
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue