summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd
diff options
context:
space:
mode:
authorChris Kuethe <ckuethe@cvs.openbsd.org>2007-08-22 21:04:31 +0000
committerChris Kuethe <ckuethe@cvs.openbsd.org>2007-08-22 21:04:31 +0000
commit1b1ce1d4eabef2f290d1d18cb0015f7efc83cfa5 (patch)
treea31e3c699c9d393d95b0980f4e03be24cd2ce404 /usr.sbin/ntpd
parent195cb071271cf73b0a4551338b5b8c2abfedb1e6 (diff)
Allow ntpd to log sensor offsets and adjtime calls to syslog at LOG_DEBUG
priority. ok gwk, mbalmer, weingart "explicit non-ok from" henning
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r--usr.sbin/ntpd/log.c5
-rw-r--r--usr.sbin/ntpd/ntpd.810
-rw-r--r--usr.sbin/ntpd/ntpd.c10
3 files changed, 17 insertions, 8 deletions
diff --git a/usr.sbin/ntpd/log.c b/usr.sbin/ntpd/log.c
index 59f69282fee..c297efe739d 100644
--- a/usr.sbin/ntpd/log.c
+++ b/usr.sbin/ntpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.7 2005/03/31 12:14:01 henning Exp $ */
+/* $OpenBSD: log.c,v 1.8 2007/08/22 21:04:30 ckuethe Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -27,6 +27,7 @@
#include "ntpd.h"
int debug;
+extern int debugsyslog;
void logit(int, const char *, ...);
@@ -122,7 +123,7 @@ log_debug(const char *emsg, ...)
{
va_list ap;
- if (debug) {
+ if (debug || debugsyslog) {
va_start(ap, emsg);
vlog(LOG_DEBUG, emsg, ap);
va_end(ap);
diff --git a/usr.sbin/ntpd/ntpd.8 b/usr.sbin/ntpd/ntpd.8
index 24b90169bca..60fffd13687 100644
--- a/usr.sbin/ntpd/ntpd.8
+++ b/usr.sbin/ntpd/ntpd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ntpd.8,v 1.18 2007/05/31 19:20:26 jmc Exp $
+.\" $OpenBSD: ntpd.8,v 1.19 2007/08/22 21:04:30 ckuethe Exp $
.\"
.\" Copyright (c) 2003, 2004, 2006 Henning Brauer <henning@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: August 22 2007 $
.Dt NTPD 8
.Os
.Sh NAME
@@ -23,7 +23,7 @@
.Sh SYNOPSIS
.Nm ntpd
.Bk -words
-.Op Fl dSs
+.Op Fl dSsv
.Op Fl f Ar file
.Ek
.Sh DESCRIPTION
@@ -100,6 +100,10 @@ eliminating the need to run
.Xr rdate 8
before starting
.Nm .
+.It Fl v
+This option allows
+.Nm
+to send DEBUG priority messages to syslog.
.El
.Sh FILES
.Bl -tag -width "/var/db/ntpd.driftXXX" -compact
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index 75930d1f5c2..cae33baade4 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.49 2007/01/15 08:19:11 otto Exp $ */
+/* $OpenBSD: ntpd.c,v 1.50 2007/08/22 21:04:30 ckuethe Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -48,6 +48,7 @@ volatile sig_atomic_t quit = 0;
volatile sig_atomic_t reconfig = 0;
volatile sig_atomic_t sigchld = 0;
struct imsgbuf *ibuf;
+int debugsyslog = 0;
void
sighdlr(int sig)
@@ -71,7 +72,7 @@ usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-dSs] [-f file]\n", __progname);
+ fprintf(stderr, "usage: %s [-dSsv] [-f file]\n", __progname);
exit(1);
}
@@ -95,7 +96,7 @@ main(int argc, char *argv[])
log_init(1); /* log to stderr until daemonized */
res_init(); /* XXX */
- while ((ch = getopt(argc, argv, "df:sS")) != -1) {
+ while ((ch = getopt(argc, argv, "df:sSv")) != -1) {
switch (ch) {
case 'd':
lconf.debug = 1;
@@ -109,6 +110,9 @@ main(int argc, char *argv[])
case 'S':
lconf.settime = 0;
break;
+ case 'v':
+ debugsyslog = 1;
+ break;
default:
usage();
/* NOTREACHED */