summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/iked/control.c4
-rw-r--r--sbin/iked/iked.c4
-rw-r--r--sbin/iked/iked.h5
-rw-r--r--sbin/iked/log.c17
-rw-r--r--sbin/iked/proc.c4
-rw-r--r--sbin/iked/util.c16
-rw-r--r--usr.sbin/httpd/control.c4
-rw-r--r--usr.sbin/httpd/httpd.c4
-rw-r--r--usr.sbin/httpd/httpd.h5
-rw-r--r--usr.sbin/httpd/log.c17
-rw-r--r--usr.sbin/httpd/proc.c4
-rw-r--r--usr.sbin/httpd/server.c5
-rw-r--r--usr.sbin/ntpd/log.c17
-rw-r--r--usr.sbin/ntpd/ntpd.c8
-rw-r--r--usr.sbin/ntpd/ntpd.h5
-rw-r--r--usr.sbin/relayd/control.c4
-rw-r--r--usr.sbin/relayd/log.c17
-rw-r--r--usr.sbin/relayd/proc.c4
-rw-r--r--usr.sbin/relayd/relay.c6
-rw-r--r--usr.sbin/relayd/relay_udp.c7
-rw-r--r--usr.sbin/relayd/relayd.c4
-rw-r--r--usr.sbin/relayd/relayd.h5
-rw-r--r--usr.sbin/relayd/ssl.c5
-rw-r--r--usr.sbin/smtpd/log.c17
-rw-r--r--usr.sbin/smtpd/log.h5
-rw-r--r--usr.sbin/smtpd/scheduler.c4
-rw-r--r--usr.sbin/smtpd/util.c4
-rw-r--r--usr.sbin/snmpd/control.c4
-rw-r--r--usr.sbin/snmpd/log.c17
-rw-r--r--usr.sbin/snmpd/proc.c4
-rw-r--r--usr.sbin/snmpd/snmpd.c5
-rw-r--r--usr.sbin/snmpd/snmpd.h8
-rw-r--r--usr.sbin/snmpd/traphandler.c12
-rw-r--r--usr.sbin/snmpd/util.c10
-rw-r--r--usr.sbin/switchd/control.c4
-rw-r--r--usr.sbin/switchd/log.c17
-rw-r--r--usr.sbin/switchd/proc.c4
-rw-r--r--usr.sbin/switchd/proc.h5
-rw-r--r--usr.sbin/switchd/switchd.c4
-rw-r--r--usr.sbin/switchd/util.c12
-rw-r--r--usr.sbin/vmd/control.c4
-rw-r--r--usr.sbin/vmd/log.c17
-rw-r--r--usr.sbin/vmd/proc.c4
-rw-r--r--usr.sbin/vmd/proc.h5
-rw-r--r--usr.sbin/vmd/vmd.c4
45 files changed, 196 insertions, 145 deletions
diff --git a/sbin/iked/control.c b/sbin/iked/control.c
index ed8713716db..4126d35ae1e 100644
--- a/sbin/iked/control.c
+++ b/sbin/iked/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.23 2017/01/09 14:04:31 krw Exp $ */
+/* $OpenBSD: control.c,v 1.24 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -304,7 +304,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
IMSG_SIZE_CHECK(&imsg, &v);
memcpy(&v, imsg.data, sizeof(v));
- log_verbose(v);
+ log_setverbose(v);
proc_forward_imsg(&env->sc_ps, &imsg, PROC_PARENT, -1);
break;
diff --git a/sbin/iked/iked.c b/sbin/iked/iked.c
index 8929975dfa9..246b861cc62 100644
--- a/sbin/iked/iked.c
+++ b/sbin/iked/iked.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iked.c,v 1.32 2017/01/03 17:51:38 reyk Exp $ */
+/* $OpenBSD: iked.c,v 1.33 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -140,7 +140,7 @@ main(int argc, char *argv[])
ps->ps_csock.cs_name = IKED_SOCKET;
log_init(debug, LOG_DAEMON);
- log_verbose(verbose);
+ log_setverbose(verbose);
if (!debug && daemon(0, 0) == -1)
err(1, "failed to daemonize");
diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h
index 14bc41b026a..1e0b782b947 100644
--- a/sbin/iked/iked.h
+++ b/sbin/iked/iked.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iked.h,v 1.99 2017/01/03 17:51:38 reyk Exp $ */
+/* $OpenBSD: iked.h,v 1.100 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -963,7 +963,8 @@ void ibuf_zero(struct ibuf *);
/* log.c */
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
diff --git a/sbin/iked/log.c b/sbin/iked/log.c
index e644eb6c299..d0494caaedc 100644
--- a/sbin/iked/log.c
+++ b/sbin/iked/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.10 2017/01/08 20:31:03 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.11 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -24,13 +24,14 @@
#include <errno.h>
#include <time.h>
-int debug;
-int verbose;
+static int debug;
+static int verbose;
const char *log_procname;
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
@@ -71,11 +72,17 @@ log_procinit(const char *procname)
}
void
-log_verbose(int v)
+log_setverbose(int v)
{
verbose = v;
}
+int
+log_getverbose(void)
+{
+ return (verbose);
+}
+
void
logit(int pri, const char *fmt, ...)
{
diff --git a/sbin/iked/proc.c b/sbin/iked/proc.c
index d02fc88a18e..d23c0bcfc84 100644
--- a/sbin/iked/proc.c
+++ b/sbin/iked/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.29 2015/12/07 16:05:56 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.30 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -495,7 +495,7 @@ proc_dispatch(int fd, short event, void *arg)
case IMSG_CTL_VERBOSE:
IMSG_SIZE_CHECK(&imsg, &verbose);
memcpy(&verbose, imsg.data, sizeof(verbose));
- log_verbose(verbose);
+ log_setverbose(verbose);
break;
default:
log_warnx("%s: %s %d got invalid imsg %d peerid %d "
diff --git a/sbin/iked/util.c b/sbin/iked/util.c
index e7804459e81..5f232a314b7 100644
--- a/sbin/iked/util.c
+++ b/sbin/iked/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.32 2016/09/26 16:55:21 jca Exp $ */
+/* $OpenBSD: util.c,v 1.33 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -35,10 +35,6 @@
#include "iked.h"
#include "ikev2.h"
-/* log.c */
-extern int debug;
-extern int verbose;
-
int
socket_af(struct sockaddr *sa, in_port_t port)
{
@@ -474,9 +470,8 @@ void
print_hex(uint8_t *buf, off_t offset, size_t length)
{
unsigned int i;
- extern int verbose;
- if (verbose < 3 || !length)
+ if (log_getverbose() < 3 || !length)
return;
for (i = 0; i < length; i++) {
@@ -495,9 +490,8 @@ void
print_hexval(uint8_t *buf, off_t offset, size_t length)
{
unsigned int i;
- extern int verbose;
- if (verbose < 2 || !length)
+ if (log_getverbose() < 2 || !length)
return;
print_debug("0x");
@@ -759,7 +753,7 @@ print_debug(const char *emsg, ...)
{
va_list ap;
- if (debug && verbose > 2) {
+ if (log_getverbose() > 2) {
va_start(ap, emsg);
vfprintf(stderr, emsg, ap);
va_end(ap);
@@ -771,7 +765,7 @@ print_verbose(const char *emsg, ...)
{
va_list ap;
- if (verbose) {
+ if (log_getverbose()) {
va_start(ap, emsg);
vfprintf(stderr, emsg, ap);
va_end(ap);
diff --git a/usr.sbin/httpd/control.c b/usr.sbin/httpd/control.c
index 3f3302ffd2a..7eea19a21d6 100644
--- a/usr.sbin/httpd/control.c
+++ b/usr.sbin/httpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.12 2017/01/09 14:04:31 krw Exp $ */
+/* $OpenBSD: control.c,v 1.13 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -290,7 +290,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
memcpy(imsg.data, &verbose, sizeof(verbose));
control_imsg_forward(env->sc_ps, &imsg);
- log_verbose(verbose);
+ log_setverbose(verbose);
break;
default:
log_debug("%s: error handling imsg %d",
diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c
index 3f73a520382..47d6676444b 100644
--- a/usr.sbin/httpd/httpd.c
+++ b/usr.sbin/httpd/httpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.c,v 1.62 2016/09/28 12:01:04 reyk Exp $ */
+/* $OpenBSD: httpd.c,v 1.63 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
@@ -191,7 +191,7 @@ main(int argc, char *argv[])
ps->ps_csock.cs_name = NULL;
log_init(debug, LOG_DAEMON);
- log_verbose(verbose);
+ log_setverbose(verbose);
if (env->sc_opts & HTTPD_OPT_NOACTION)
ps->ps_noaction = 1;
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h
index d0892b6f3f6..75b1b893743 100644
--- a/usr.sbin/httpd/httpd.h
+++ b/usr.sbin/httpd/httpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.h,v 1.124 2016/11/17 14:52:48 jsing Exp $ */
+/* $OpenBSD: httpd.h,v 1.125 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -685,7 +685,8 @@ extern struct httpd *httpd_env;
/* log.c */
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
diff --git a/usr.sbin/httpd/log.c b/usr.sbin/httpd/log.c
index 04cb7b212d6..f46f58f65a5 100644
--- a/usr.sbin/httpd/log.c
+++ b/usr.sbin/httpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.12 2017/01/08 20:31:03 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.13 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -24,13 +24,14 @@
#include <errno.h>
#include <time.h>
-int debug;
-int verbose;
+static int debug;
+static int verbose;
const char *log_procname;
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
@@ -71,11 +72,17 @@ log_procinit(const char *procname)
}
void
-log_verbose(int v)
+log_setverbose(int v)
{
verbose = v;
}
+int
+log_getverbose(void)
+{
+ return (verbose);
+}
+
void
logit(int pri, const char *fmt, ...)
{
diff --git a/usr.sbin/httpd/proc.c b/usr.sbin/httpd/proc.c
index 7f88461a852..a1014eb30ab 100644
--- a/usr.sbin/httpd/proc.c
+++ b/usr.sbin/httpd/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.34 2016/10/12 10:57:30 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.35 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -662,7 +662,7 @@ proc_dispatch(int fd, short event, void *arg)
case IMSG_CTL_VERBOSE:
IMSG_SIZE_CHECK(&imsg, &verbose);
memcpy(&verbose, imsg.data, sizeof(verbose));
- log_verbose(verbose);
+ log_setverbose(verbose);
break;
case IMSG_CTL_PROCFD:
IMSG_SIZE_CHECK(&imsg, &pf);
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c
index 6fdb1464138..9afc7c179fa 100644
--- a/usr.sbin/httpd/server.c
+++ b/usr.sbin/httpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.100 2016/11/17 14:58:37 jsing Exp $ */
+/* $OpenBSD: server.c,v 1.101 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -1153,14 +1153,13 @@ server_log(struct client *clt, const char *msg)
struct server_config *srv_conf = clt->clt_srv_conf;
char *ptr = NULL, *vmsg = NULL;
int debug_cmd = -1;
- extern int verbose;
switch (srv_conf->logformat) {
case LOG_FORMAT_CONNECTION:
debug_cmd = IMSG_LOG_ACCESS;
break;
default:
- if (verbose > 1)
+ if (log_getverbose() > 1)
debug_cmd = IMSG_LOG_ERROR;
if (EVBUFFER_LENGTH(clt->clt_log)) {
while ((ptr =
diff --git a/usr.sbin/ntpd/log.c b/usr.sbin/ntpd/log.c
index 6e56032cd2c..270df657f1e 100644
--- a/usr.sbin/ntpd/log.c
+++ b/usr.sbin/ntpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.15 2017/01/08 20:31:03 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.16 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -24,13 +24,14 @@
#include <errno.h>
#include <time.h>
-int debug;
-int verbose;
+static int debug;
+static int verbose;
const char *log_procname;
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
@@ -71,11 +72,17 @@ log_procinit(const char *procname)
}
void
-log_verbose(int v)
+log_setverbose(int v)
{
verbose = v;
}
+int
+log_getverbose(void)
+{
+ return (verbose);
+}
+
void
logit(int pri, const char *fmt, ...)
{
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index 59f12ab4603..0ec3ede03b4 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.112 2016/12/01 16:24:48 mestre Exp $ */
+/* $OpenBSD: ntpd.c,v 1.113 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -209,7 +209,7 @@ main(int argc, char *argv[])
reset_adjtime();
if (!lconf.settime) {
log_init(lconf.debug, LOG_DAEMON);
- log_verbose(lconf.verbose);
+ log_setverbose(lconf.verbose);
if (!lconf.debug)
if (daemon(1, 0))
fatal("daemon");
@@ -284,7 +284,7 @@ main(int argc, char *argv[])
lconf.settime = 0;
timeout = INFTIM;
log_init(lconf.debug, LOG_DAEMON);
- log_verbose(lconf.verbose);
+ log_setverbose(lconf.verbose);
log_warnx("no reply received in time, skipping initial "
"time setting");
if (!lconf.debug)
@@ -384,7 +384,7 @@ dispatch_imsg(struct ntpd_conf *lconf, int argc, char **argv)
if (!lconf->settime)
break;
log_init(lconf->debug, LOG_DAEMON);
- log_verbose(lconf->verbose);
+ log_setverbose(lconf->verbose);
memcpy(&d, imsg.data, sizeof(d));
ntpd_settime(d);
/* daemonize now */
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index 965bb72a6bb..fb9cd87118a 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.133 2016/09/26 17:17:01 rzalamena Exp $ */
+/* $OpenBSD: ntpd.h,v 1.134 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -408,7 +408,8 @@ void build_show_sensor(struct ctl_show_sensor *,
/* log.c */
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c
index 04bb2c853d4..85a6f65ab25 100644
--- a/usr.sbin/relayd/control.c
+++ b/usr.sbin/relayd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.55 2017/01/09 14:04:31 krw Exp $ */
+/* $OpenBSD: control.c,v 1.56 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -387,7 +387,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
memcpy(imsg.data, &verbose, sizeof(verbose));
control_imsg_forward(ps, &imsg);
- log_verbose(verbose);
+ log_setverbose(verbose);
break;
default:
log_debug("%s: error handling imsg %d",
diff --git a/usr.sbin/relayd/log.c b/usr.sbin/relayd/log.c
index 5d7c9bbccba..03b23bec130 100644
--- a/usr.sbin/relayd/log.c
+++ b/usr.sbin/relayd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.33 2017/01/08 20:31:03 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.34 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -24,13 +24,14 @@
#include <errno.h>
#include <time.h>
-int debug;
-int verbose;
+static int debug;
+static int verbose;
const char *log_procname;
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
@@ -71,11 +72,17 @@ log_procinit(const char *procname)
}
void
-log_verbose(int v)
+log_setverbose(int v)
{
verbose = v;
}
+int
+log_getverbose(void)
+{
+ return (verbose);
+}
+
void
logit(int pri, const char *fmt, ...)
{
diff --git a/usr.sbin/relayd/proc.c b/usr.sbin/relayd/proc.c
index 67550afbd03..3f135d3e360 100644
--- a/usr.sbin/relayd/proc.c
+++ b/usr.sbin/relayd/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.37 2016/11/24 21:01:18 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.38 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -662,7 +662,7 @@ proc_dispatch(int fd, short event, void *arg)
case IMSG_CTL_VERBOSE:
IMSG_SIZE_CHECK(&imsg, &verbose);
memcpy(&verbose, imsg.data, sizeof(verbose));
- log_verbose(verbose);
+ log_setverbose(verbose);
break;
case IMSG_CTL_PROCFD:
IMSG_SIZE_CHECK(&imsg, &pf);
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index e0a0a87483c..116a01d61cb 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.217 2016/11/10 13:21:58 jca Exp $ */
+/* $OpenBSD: relay.c,v 1.218 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -287,11 +287,9 @@ relay_protodebug(struct relay *rlay)
int
relay_privinit(struct relay *rlay)
{
- extern int debug;
-
log_debug("%s: adding relay %s", __func__, rlay->rl_conf.name);
- if (debug)
+ if (log_getverbose() > 1)
relay_protodebug(rlay);
switch (rlay->rl_proto->type) {
diff --git a/usr.sbin/relayd/relay_udp.c b/usr.sbin/relayd/relay_udp.c
index 754bdf9f564..2589e51de79 100644
--- a/usr.sbin/relayd/relay_udp.c
+++ b/usr.sbin/relayd/relay_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay_udp.c,v 1.44 2016/11/10 13:21:58 jca Exp $ */
+/* $OpenBSD: relay_udp.c,v 1.45 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2007 - 2013 Reyk Floeter <reyk@openbsd.org>
@@ -39,7 +39,6 @@
extern volatile sig_atomic_t relay_sessions;
extern objid_t relay_conid;
-extern int debug;
static struct relayd *env = NULL;
struct shuffle relay_shuffle;
@@ -467,7 +466,7 @@ relay_dns_request(struct rsession *con)
if (buf == NULL || priv == NULL || len < 1)
return (-1);
- if (debug)
+ if (log_getverbose() > 1)
relay_dns_log(con, buf, len);
getmonotime(&con->se_tv_start);
@@ -522,7 +521,7 @@ relay_dns_result(struct rsession *con, u_int8_t *buf, size_t len)
if (priv == NULL)
fatalx("relay_dns_result: response to invalid session");
- if (debug)
+ if (log_getverbose() > 1)
relay_dns_log(con, buf, len);
/*
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index 39d4b35d28e..3a66500e60c 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.163 2016/11/24 21:01:18 reyk Exp $ */
+/* $OpenBSD: relayd.c,v 1.164 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2007 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -203,7 +203,7 @@ main(int argc, char *argv[])
ps->ps_csock.cs_name = RELAYD_SOCKET;
log_init(debug, LOG_DAEMON);
- log_verbose(verbose);
+ log_setverbose(verbose);
if (env->sc_conf.opts & RELAYD_OPT_NOACTION)
ps->ps_noaction = 1;
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index 2c0246df99c..1a438bbc0c8 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.236 2016/11/24 21:01:18 reyk Exp $ */
+/* $OpenBSD: relayd.h,v 1.237 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2006 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -1352,7 +1352,8 @@ u_int16_t shuffle_generate16(struct shuffle *);
/* log.c */
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
diff --git a/usr.sbin/relayd/ssl.c b/usr.sbin/relayd/ssl.c
index dbc5f4469c5..f5dad7e36f0 100644
--- a/usr.sbin/relayd/ssl.c
+++ b/usr.sbin/relayd/ssl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl.c,v 1.30 2015/12/30 12:08:34 benno Exp $ */
+/* $OpenBSD: ssl.c,v 1.31 2017/01/09 14:49:21 reyk Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -225,9 +225,8 @@ ssl_error(const char *where, const char *what)
{
char errbuf[128];
unsigned long code;
- extern int debug;
- if (!debug)
+ if (log_getverbose() < 2)
return;
for (; (code = ERR_get_error()) != 0 ;) {
ERR_error_string_n(code, errbuf, sizeof(errbuf));
diff --git a/usr.sbin/smtpd/log.c b/usr.sbin/smtpd/log.c
index b4094db8030..d2761937749 100644
--- a/usr.sbin/smtpd/log.c
+++ b/usr.sbin/smtpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.18 2017/01/09 09:53:23 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.19 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -24,13 +24,14 @@
#include <errno.h>
#include <time.h>
-int debug;
-int verbose;
+static int debug;
+static int verbose;
const char *log_procname;
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
@@ -71,11 +72,17 @@ log_procinit(const char *procname)
}
void
-log_verbose(int v)
+log_setverbose(int v)
{
verbose = v;
}
+int
+log_getverbose(void)
+{
+ return (verbose);
+}
+
void
logit(int pri, const char *fmt, ...)
{
diff --git a/usr.sbin/smtpd/log.h b/usr.sbin/smtpd/log.h
index 4b2bbe840bb..8120653cc9e 100644
--- a/usr.sbin/smtpd/log.h
+++ b/usr.sbin/smtpd/log.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.h,v 1.6 2017/01/09 09:53:23 reyk Exp $ */
+/* $OpenBSD: log.h,v 1.7 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010 Gilles Chehade <gilles@poolp.org>
@@ -21,7 +21,8 @@
/* log.c */
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
diff --git a/usr.sbin/smtpd/scheduler.c b/usr.sbin/smtpd/scheduler.c
index f8516f2ddd6..f6c11de853e 100644
--- a/usr.sbin/smtpd/scheduler.c
+++ b/usr.sbin/smtpd/scheduler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scheduler.c,v 1.55 2016/09/08 12:06:43 eric Exp $ */
+/* $OpenBSD: scheduler.c,v 1.56 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -306,7 +306,7 @@ scheduler_imsg(struct mproc *p, struct imsg *imsg)
m_msg(&m, imsg);
m_get_int(&m, &v);
m_end(&m);
- log_verbose(v);
+ log_setverbose(v);
return;
case IMSG_CTL_PROFILE:
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index c4d4824fdc2..4a509ed4520 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.131 2017/01/09 09:53:23 reyk Exp $ */
+/* $OpenBSD: util.c,v 1.132 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -812,5 +812,5 @@ log_trace_verbose(int v)
tracing = v;
/* Set debug logging in log.c */
- log_verbose(v & TRACE_DEBUG ? 2 : foreground_log);
+ log_setverbose(v & TRACE_DEBUG ? 2 : foreground_log);
}
diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c
index 833d2be7725..a4d04dc835e 100644
--- a/usr.sbin/snmpd/control.c
+++ b/usr.sbin/snmpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.40 2016/11/18 16:16:39 jca Exp $ */
+/* $OpenBSD: control.c,v 1.41 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -331,7 +331,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
return control_close(c, "invalid size", &imsg);
memcpy(&v, imsg.data, sizeof(v));
- log_verbose(v);
+ log_setverbose(v);
for (i = 0; i < PROC_MAX; i++) {
if (privsep_process == PROC_CONTROL)
diff --git a/usr.sbin/snmpd/log.c b/usr.sbin/snmpd/log.c
index 5c105f81686..92e2c876e1f 100644
--- a/usr.sbin/snmpd/log.c
+++ b/usr.sbin/snmpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.14 2017/01/08 20:31:03 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.15 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -24,13 +24,14 @@
#include <errno.h>
#include <time.h>
-int debug;
-int verbose;
+static int debug;
+static int verbose;
const char *log_procname;
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
@@ -71,11 +72,17 @@ log_procinit(const char *procname)
}
void
-log_verbose(int v)
+log_setverbose(int v)
{
verbose = v;
}
+int
+log_getverbose(void)
+{
+ return (verbose);
+}
+
void
logit(int pri, const char *fmt, ...)
{
diff --git a/usr.sbin/snmpd/proc.c b/usr.sbin/snmpd/proc.c
index b2f3a65044d..cd5b7606163 100644
--- a/usr.sbin/snmpd/proc.c
+++ b/usr.sbin/snmpd/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.21 2016/10/28 09:07:08 rzalamena Exp $ */
+/* $OpenBSD: proc.c,v 1.22 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -662,7 +662,7 @@ proc_dispatch(int fd, short event, void *arg)
case IMSG_CTL_VERBOSE:
IMSG_SIZE_CHECK(&imsg, &verbose);
memcpy(&verbose, imsg.data, sizeof(verbose));
- log_verbose(verbose);
+ log_setverbose(verbose);
break;
case IMSG_CTL_PROCFD:
IMSG_SIZE_CHECK(&imsg, &pf);
diff --git a/usr.sbin/snmpd/snmpd.c b/usr.sbin/snmpd/snmpd.c
index d80338698ee..96caeeacf67 100644
--- a/usr.sbin/snmpd/snmpd.c
+++ b/usr.sbin/snmpd/snmpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpd.c,v 1.34 2016/10/28 09:07:08 rzalamena Exp $ */
+/* $OpenBSD: snmpd.c,v 1.35 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -158,6 +158,7 @@ main(int argc, char *argv[])
switch (c) {
case 'd':
debug++;
+ flags |= SNMPD_F_DEBUG;
break;
case 'D':
if (cmdline_symset(optarg) < 0)
@@ -221,7 +222,7 @@ main(int argc, char *argv[])
errx(1, "unknown user %s", SNMPD_USER);
log_init(debug, LOG_DAEMON);
- log_verbose(verbose);
+ log_setverbose(verbose);
gettimeofday(&env->sc_starttime, NULL);
env->sc_engine_boots = 0;
diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h
index 46782c3f46d..471f1f1bc44 100644
--- a/usr.sbin/snmpd/snmpd.h
+++ b/usr.sbin/snmpd/snmpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpd.h,v 1.73 2016/11/18 16:16:39 jca Exp $ */
+/* $OpenBSD: snmpd.h,v 1.74 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -560,7 +560,8 @@ struct usmuser {
struct snmpd {
u_int8_t sc_flags;
#define SNMPD_F_VERBOSE 0x01
-#define SNMPD_F_NONAMES 0x02
+#define SNMPD_F_DEBUG 0x02
+#define SNMPD_F_NONAMES 0x04
const char *sc_confpath;
struct addresslist sc_addresses;
@@ -617,7 +618,8 @@ int cmdline_symset(char *);
/* log.c */
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
diff --git a/usr.sbin/snmpd/traphandler.c b/usr.sbin/snmpd/traphandler.c
index 76f48bfa031..e76ceb1ceac 100644
--- a/usr.sbin/snmpd/traphandler.c
+++ b/usr.sbin/snmpd/traphandler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traphandler.c,v 1.7 2016/11/18 16:16:39 jca Exp $ */
+/* $OpenBSD: traphandler.c,v 1.8 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2014 Bret Stephen Lambert <blambert@openbsd.org>
@@ -294,6 +294,8 @@ traphandler_priv_recvmsg(struct privsep_proc *p, struct imsg *imsg)
int
traphandler_fork_handler(struct privsep_proc *p, struct imsg *imsg)
{
+ struct privsep *ps = p->p_ps;
+ struct snmpd *env = ps->ps_env;
char oidbuf[SNMP_MAX_OID_STRLEN];
struct sockaddr *sa;
char *buf;
@@ -303,9 +305,10 @@ traphandler_fork_handler(struct privsep_proc *p, struct imsg *imsg)
struct ber_oid trapoid;
u_int uptime;
struct passwd *pw;
- extern int debug;
+ int verbose;
- pw = p->p_ps->ps_pw;
+ pw = ps->ps_pw;
+ verbose = log_getverbose();
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
@@ -314,7 +317,8 @@ traphandler_fork_handler(struct privsep_proc *p, struct imsg *imsg)
closefrom(STDERR_FILENO + 1);
- log_init(debug, LOG_DAEMON);
+ log_init((env->sc_flags & SNMPD_F_DEBUG) ? 1 : 0, LOG_DAEMON);
+ log_setverbose(verbose);
log_procinit(p->p_title);
n = IMSG_DATA_SIZE(imsg);
diff --git a/usr.sbin/snmpd/util.c b/usr.sbin/snmpd/util.c
index 288cac3a840..d6965b11d39 100644
--- a/usr.sbin/snmpd/util.c
+++ b/usr.sbin/snmpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.6 2016/11/09 20:31:56 jca Exp $ */
+/* $OpenBSD: util.c,v 1.7 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2014 Bret Stephen Lambert <blambert@openbsd.org>
*
@@ -30,10 +30,6 @@
#include "snmp.h"
#include "snmpd.h"
-/* log.c */
-extern int debug;
-extern int verbose;
-
/*
* Convert variable bindings from AgentX to SNMP dialect.
*/
@@ -283,7 +279,7 @@ print_debug(const char *emsg, ...)
{
va_list ap;
- if (debug && verbose > 2) {
+ if (log_getverbose() > 2) {
va_start(ap, emsg);
vfprintf(stderr, emsg, ap);
va_end(ap);
@@ -295,7 +291,7 @@ print_verbose(const char *emsg, ...)
{
va_list ap;
- if (verbose) {
+ if (log_getverbose()) {
va_start(ap, emsg);
vfprintf(stderr, emsg, ap);
va_end(ap);
diff --git a/usr.sbin/switchd/control.c b/usr.sbin/switchd/control.c
index 0fdcf4ae19e..9367f32c16e 100644
--- a/usr.sbin/switchd/control.c
+++ b/usr.sbin/switchd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.6 2017/01/09 14:04:31 krw Exp $ */
+/* $OpenBSD: control.c,v 1.7 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010-2016 Reyk Floeter <reyk@openbsd.org>
@@ -361,7 +361,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
IMSG_SIZE_CHECK(&imsg, &v);
memcpy(&v, imsg.data, sizeof(v));
- log_verbose(v);
+ log_setverbose(v);
proc_forward_imsg(&env->sc_ps, &imsg, PROC_PARENT, -1);
proc_forward_imsg(&env->sc_ps, &imsg, PROC_OFP, -1);
diff --git a/usr.sbin/switchd/log.c b/usr.sbin/switchd/log.c
index 459cd67708c..168366f91d2 100644
--- a/usr.sbin/switchd/log.c
+++ b/usr.sbin/switchd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.3 2017/01/08 20:31:03 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.4 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -24,13 +24,14 @@
#include <errno.h>
#include <time.h>
-int debug;
-int verbose;
+static int debug;
+static int verbose;
const char *log_procname;
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
@@ -71,11 +72,17 @@ log_procinit(const char *procname)
}
void
-log_verbose(int v)
+log_setverbose(int v)
{
verbose = v;
}
+int
+log_getverbose(void)
+{
+ return (verbose);
+}
+
void
logit(int pri, const char *fmt, ...)
{
diff --git a/usr.sbin/switchd/proc.c b/usr.sbin/switchd/proc.c
index 7ad9bf33424..4f36a83cd42 100644
--- a/usr.sbin/switchd/proc.c
+++ b/usr.sbin/switchd/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.9 2016/11/16 15:32:42 rzalamena Exp $ */
+/* $OpenBSD: proc.c,v 1.10 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -662,7 +662,7 @@ proc_dispatch(int fd, short event, void *arg)
case IMSG_CTL_VERBOSE:
IMSG_SIZE_CHECK(&imsg, &verbose);
memcpy(&verbose, imsg.data, sizeof(verbose));
- log_verbose(verbose);
+ log_setverbose(verbose);
break;
case IMSG_CTL_PROCFD:
IMSG_SIZE_CHECK(&imsg, &pf);
diff --git a/usr.sbin/switchd/proc.h b/usr.sbin/switchd/proc.h
index db2489337e6..f219d1c379d 100644
--- a/usr.sbin/switchd/proc.h
+++ b/usr.sbin/switchd/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.5 2016/11/16 15:32:42 rzalamena Exp $ */
+/* $OpenBSD: proc.h,v 1.6 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
@@ -168,7 +168,8 @@ void control(struct privsep *, struct privsep_proc *);
/* log.c */
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
diff --git a/usr.sbin/switchd/switchd.c b/usr.sbin/switchd/switchd.c
index 64b26fbf452..5d4fde3a272 100644
--- a/usr.sbin/switchd/switchd.c
+++ b/usr.sbin/switchd/switchd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchd.c,v 1.14 2016/10/12 19:07:42 reyk Exp $ */
+/* $OpenBSD: switchd.c,v 1.15 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -175,7 +175,7 @@ main(int argc, char *argv[])
fatalx("unknown user " SWITCHD_USER);
log_init(debug, LOG_DAEMON);
- log_verbose(verbose);
+ log_setverbose(verbose);
/* Configure the control socket */
ps->ps_csock.cs_name = SWITCHD_SOCKET;
diff --git a/usr.sbin/switchd/util.c b/usr.sbin/switchd/util.c
index d8ab3762aef..d53e674ecf4 100644
--- a/usr.sbin/switchd/util.c
+++ b/usr.sbin/switchd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.5 2016/11/15 09:05:14 reyk Exp $ */
+/* $OpenBSD: util.c,v 1.6 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -37,9 +37,6 @@
#include "switchd.h"
-extern int debug;
-extern int verbose;
-
void
socket_set_blockmode(int fd, enum blockmodes bm)
{
@@ -313,7 +310,7 @@ print_debug(const char *emsg, ...)
{
va_list ap;
- if (debug && verbose > 2) {
+ if (log_getverbose() > 2) {
va_start(ap, emsg);
vfprintf(stderr, emsg, ap);
va_end(ap);
@@ -325,7 +322,7 @@ print_verbose(const char *emsg, ...)
{
va_list ap;
- if (verbose) {
+ if (log_getverbose()) {
va_start(ap, emsg);
vfprintf(stderr, emsg, ap);
va_end(ap);
@@ -336,9 +333,8 @@ void
print_hex(uint8_t *buf, off_t offset, size_t length)
{
unsigned int i;
- extern int verbose;
- if (verbose < 3 || !length)
+ if (log_getverbose() < 3 || !length)
return;
for (i = 0; i < length; i++) {
diff --git a/usr.sbin/vmd/control.c b/usr.sbin/vmd/control.c
index af0a2d1da10..2108194b6af 100644
--- a/usr.sbin/vmd/control.c
+++ b/usr.sbin/vmd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.10 2017/01/09 14:04:31 krw Exp $ */
+/* $OpenBSD: control.c,v 1.11 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
@@ -350,7 +350,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
IMSG_SIZE_CHECK(&imsg, &v);
memcpy(&v, imsg.data, sizeof(v));
- log_verbose(v);
+ log_setverbose(v);
proc_forward_imsg(ps, &imsg, PROC_PARENT, -1);
break;
diff --git a/usr.sbin/vmd/log.c b/usr.sbin/vmd/log.c
index c8621240213..4b2182a78d2 100644
--- a/usr.sbin/vmd/log.c
+++ b/usr.sbin/vmd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.6 2016/11/24 21:39:45 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.7 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -24,13 +24,14 @@
#include <errno.h>
#include <time.h>
-int debug;
-int verbose;
+static int debug;
+static int verbose;
const char *log_procname;
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
@@ -71,11 +72,17 @@ log_procinit(const char *procname)
}
void
-log_verbose(int v)
+log_setverbose(int v)
{
verbose = v;
}
+int
+log_getverbose(void)
+{
+ return (verbose);
+}
+
void
logit(int pri, const char *fmt, ...)
{
diff --git a/usr.sbin/vmd/proc.c b/usr.sbin/vmd/proc.c
index a41b4d5a09f..5248491d08c 100644
--- a/usr.sbin/vmd/proc.c
+++ b/usr.sbin/vmd/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.11 2016/11/16 15:32:42 rzalamena Exp $ */
+/* $OpenBSD: proc.c,v 1.12 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -662,7 +662,7 @@ proc_dispatch(int fd, short event, void *arg)
case IMSG_CTL_VERBOSE:
IMSG_SIZE_CHECK(&imsg, &verbose);
memcpy(&verbose, imsg.data, sizeof(verbose));
- log_verbose(verbose);
+ log_setverbose(verbose);
break;
case IMSG_CTL_PROCFD:
IMSG_SIZE_CHECK(&imsg, &pf);
diff --git a/usr.sbin/vmd/proc.h b/usr.sbin/vmd/proc.h
index 8ed9140f94d..6fce6a93b59 100644
--- a/usr.sbin/vmd/proc.h
+++ b/usr.sbin/vmd/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.10 2016/11/16 15:32:42 rzalamena Exp $ */
+/* $OpenBSD: proc.h,v 1.11 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
@@ -198,7 +198,8 @@ void control_cleanup(struct control_sock *);
/* log.c */
void log_init(int, int);
void log_procinit(const char *);
-void log_verbose(int);
+void log_setverbose(int);
+int log_getverbose(void);
void log_warn(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_warnx(const char *, ...)
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 26de91144d4..88cf224ca47 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.47 2016/12/14 21:17:25 reyk Exp $ */
+/* $OpenBSD: vmd.c,v 1.48 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -421,7 +421,7 @@ main(int argc, char **argv)
env->vmd_conffile = conffile;
log_init(env->vmd_debug, LOG_DAEMON);
- log_verbose(env->vmd_verbose);
+ log_setverbose(env->vmd_verbose);
if (env->vmd_noaction)
ps->ps_noaction = 1;