- 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:
Wouter Wijngaards 2014-07-29 11:48:43 +00:00
parent ec3b6d8bf7
commit dad3e92df7
3 changed files with 18 additions and 8 deletions

View File

@ -269,8 +269,6 @@ checkrlimits(struct config_file* cfg)
#ifdef HAVE_SETRLIMIT
if(setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
log_warn("setrlimit: %s", strerror(errno));
#else
if(1) {
#endif
log_warn("cannot increase max open fds from %u to %u",
(unsigned)avail, (unsigned)total+10);
@ -286,7 +284,9 @@ checkrlimits(struct config_file* cfg)
log_warn("increase ulimit or decrease threads, "
"ports in config to remove this warning");
return;
#ifdef HAVE_SETRLIMIT
}
#endif
log_warn("increased limit(open files) from %u to %u",
(unsigned)avail, (unsigned)total+10);
}
@ -299,10 +299,14 @@ checkrlimits(struct config_file* cfg)
/** set verbosity, check rlimits, cache settings */
static void
apply_settings(struct daemon* daemon, struct config_file* cfg,
int cmdline_verbose)
int cmdline_verbose, int debug_mode)
{
/* apply if they have changed */
verbosity = cmdline_verbose + cfg->verbosity;
if (debug_mode > 1) {
cfg->use_syslog = 0;
cfg->logfile = NULL;
}
daemon_apply_cfg(daemon, cfg);
checkrlimits(cfg);
}
@ -661,7 +665,7 @@ run_daemon(const char* cfgfile, int cmdline_verbose, int debug_mode)
cfgfile);
log_warn("Continuing with default config settings");
}
apply_settings(daemon, cfg, cmdline_verbose);
apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
/* prepare */
if(!daemon_open_shared_ports(daemon))
@ -741,7 +745,7 @@ main(int argc, char* argv[])
verbosity++;
break;
case 'd':
debug_mode = 1;
debug_mode++;
break;
case 'w':
winopt = optarg;

View File

@ -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
- Fix endian.h include for OpenBSD.

View File

@ -36,9 +36,11 @@ file at the default location, @ub_conf_file@. The syntax is
described in \fIunbound.conf\fR(5).
.TP
.B \-d
Debug flag, do not fork into the background, but stay attached to the
console. This flag will also delay writing to the logfile until the
thread\-spawn time. So that most config and setup errors appear on stderr.
Debug flag: do not fork into the background, but stay attached to
the console. This flag will also delay writing to the log file until
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
.B \-v
Increase verbosity. If given multiple times, more information is logged.