mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Patch from Dag-Erling Smorgrav that implements feature, unbound -dd
does not fork in the background and also logs to stderr. git-svn-id: file:///svn/unbound/trunk@3197 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
ec3b6d8bf7
commit
dad3e92df7
3 changed files with 18 additions and 8 deletions
|
|
@ -269,8 +269,6 @@ checkrlimits(struct config_file* cfg)
|
||||||
#ifdef HAVE_SETRLIMIT
|
#ifdef HAVE_SETRLIMIT
|
||||||
if(setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
|
if(setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
|
||||||
log_warn("setrlimit: %s", strerror(errno));
|
log_warn("setrlimit: %s", strerror(errno));
|
||||||
#else
|
|
||||||
if(1) {
|
|
||||||
#endif
|
#endif
|
||||||
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);
|
||||||
|
|
@ -286,7 +284,9 @@ checkrlimits(struct config_file* cfg)
|
||||||
log_warn("increase ulimit or decrease threads, "
|
log_warn("increase ulimit or decrease threads, "
|
||||||
"ports in config to remove this warning");
|
"ports in config to remove this warning");
|
||||||
return;
|
return;
|
||||||
|
#ifdef HAVE_SETRLIMIT
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
log_warn("increased limit(open files) from %u to %u",
|
log_warn("increased limit(open files) from %u to %u",
|
||||||
(unsigned)avail, (unsigned)total+10);
|
(unsigned)avail, (unsigned)total+10);
|
||||||
}
|
}
|
||||||
|
|
@ -299,10 +299,14 @@ checkrlimits(struct config_file* cfg)
|
||||||
/** set verbosity, check rlimits, cache settings */
|
/** set verbosity, check rlimits, cache settings */
|
||||||
static void
|
static void
|
||||||
apply_settings(struct daemon* daemon, struct config_file* cfg,
|
apply_settings(struct daemon* daemon, struct config_file* cfg,
|
||||||
int cmdline_verbose)
|
int cmdline_verbose, int debug_mode)
|
||||||
{
|
{
|
||||||
/* apply if they have changed */
|
/* apply if they have changed */
|
||||||
verbosity = cmdline_verbose + cfg->verbosity;
|
verbosity = cmdline_verbose + cfg->verbosity;
|
||||||
|
if (debug_mode > 1) {
|
||||||
|
cfg->use_syslog = 0;
|
||||||
|
cfg->logfile = NULL;
|
||||||
|
}
|
||||||
daemon_apply_cfg(daemon, cfg);
|
daemon_apply_cfg(daemon, cfg);
|
||||||
checkrlimits(cfg);
|
checkrlimits(cfg);
|
||||||
}
|
}
|
||||||
|
|
@ -661,7 +665,7 @@ run_daemon(const char* cfgfile, int cmdline_verbose, int debug_mode)
|
||||||
cfgfile);
|
cfgfile);
|
||||||
log_warn("Continuing with default config settings");
|
log_warn("Continuing with default config settings");
|
||||||
}
|
}
|
||||||
apply_settings(daemon, cfg, cmdline_verbose);
|
apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
|
||||||
|
|
||||||
/* prepare */
|
/* prepare */
|
||||||
if(!daemon_open_shared_ports(daemon))
|
if(!daemon_open_shared_ports(daemon))
|
||||||
|
|
@ -741,7 +745,7 @@ main(int argc, char* argv[])
|
||||||
verbosity++;
|
verbosity++;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
debug_mode = 1;
|
debug_mode++;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
winopt = optarg;
|
winopt = optarg;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
29 July 2014: Wouter
|
||||||
|
- Patch from Dag-Erling Smorgrav that implements feature, unbound -dd
|
||||||
|
does not fork in the background and also logs to stderr.
|
||||||
|
|
||||||
21 July 2014: Wouter
|
21 July 2014: Wouter
|
||||||
- Fix endian.h include for OpenBSD.
|
- Fix endian.h include for OpenBSD.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,11 @@ file at the default location, @ub_conf_file@. The syntax is
|
||||||
described in \fIunbound.conf\fR(5).
|
described in \fIunbound.conf\fR(5).
|
||||||
.TP
|
.TP
|
||||||
.B \-d
|
.B \-d
|
||||||
Debug flag, do not fork into the background, but stay attached to the
|
Debug flag: do not fork into the background, but stay attached to
|
||||||
console. This flag will also delay writing to the logfile until the
|
the console. This flag will also delay writing to the log file until
|
||||||
thread\-spawn time. So that most config and setup errors appear on stderr.
|
the thread\-spawn time, so that most config and setup errors appear on
|
||||||
|
stderr. If given twice or more, logging does not switch to the log file
|
||||||
|
or to syslog, but the log messages are printed to stderr all the time.
|
||||||
.TP
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
Increase verbosity. If given multiple times, more information is logged.
|
Increase verbosity. If given multiple times, more information is logged.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue