Browse Source

Allow ntpd to log sensor offsets and adjtime calls to syslog at LOG_DEBUG

priority.
ok gwk, mbalmer, weingart
"explicit non-ok from" henning
OPENBSD_4_3
ckuethe 17 years ago
parent
commit
05c8b9ebe9
3 changed files with 17 additions and 8 deletions
  1. +3
    -2
      src/usr.sbin/ntpd/log.c
  2. +7
    -3
      src/usr.sbin/ntpd/ntpd.8
  3. +7
    -3
      src/usr.sbin/ntpd/ntpd.c

+ 3
- 2
src/usr.sbin/ntpd/log.c View File

@ -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> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -27,6 +27,7 @@
#include "ntpd.h" #include "ntpd.h"
int debug; int debug;
extern int debugsyslog;
void logit(int, const char *, ...); void logit(int, const char *, ...);
@ -122,7 +123,7 @@ log_debug(const char *emsg, ...)
{ {
va_list ap; va_list ap;
if (debug) {
if (debug || debugsyslog) {
va_start(ap, emsg); va_start(ap, emsg);
vlog(LOG_DEBUG, emsg, ap); vlog(LOG_DEBUG, emsg, ap);
va_end(ap); va_end(ap);


+ 7
- 3
src/usr.sbin/ntpd/ntpd.8 View File

@ -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> .\" 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 .\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" 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 .Dt NTPD 8
.Os .Os
.Sh NAME .Sh NAME
@ -23,7 +23,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm ntpd .Nm ntpd
.Bk -words .Bk -words
.Op Fl dSs
.Op Fl dSsv
.Op Fl f Ar file .Op Fl f Ar file
.Ek .Ek
.Sh DESCRIPTION .Sh DESCRIPTION
@ -100,6 +100,10 @@ eliminating the need to run
.Xr rdate 8 .Xr rdate 8
before starting before starting
.Nm . .Nm .
.It Fl v
This option allows
.Nm
to send DEBUG priority messages to syslog.
.El .El
.Sh FILES .Sh FILES
.Bl -tag -width "/var/db/ntpd.driftXXX" -compact .Bl -tag -width "/var/db/ntpd.driftXXX" -compact


+ 7
- 3
src/usr.sbin/ntpd/ntpd.c View File

@ -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> * 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 reconfig = 0;
volatile sig_atomic_t sigchld = 0; volatile sig_atomic_t sigchld = 0;
struct imsgbuf *ibuf; struct imsgbuf *ibuf;
int debugsyslog = 0;
void void
sighdlr(int sig) sighdlr(int sig)
@ -71,7 +72,7 @@ usage(void)
{ {
extern char *__progname; extern char *__progname;
fprintf(stderr, "usage: %s [-dSs] [-f file]\n", __progname);
fprintf(stderr, "usage: %s [-dSsv] [-f file]\n", __progname);
exit(1); exit(1);
} }
@ -95,7 +96,7 @@ main(int argc, char *argv[])
log_init(1); /* log to stderr until daemonized */ log_init(1); /* log to stderr until daemonized */
res_init(); /* XXX */ res_init(); /* XXX */
while ((ch = getopt(argc, argv, "df:sS")) != -1) {
while ((ch = getopt(argc, argv, "df:sSv")) != -1) {
switch (ch) { switch (ch) {
case 'd': case 'd':
lconf.debug = 1; lconf.debug = 1;
@ -109,6 +110,9 @@ main(int argc, char *argv[])
case 'S': case 'S':
lconf.settime = 0; lconf.settime = 0;
break; break;
case 'v':
debugsyslog = 1;
break;
default: default:
usage(); usage();
/* NOTREACHED */ /* NOTREACHED */


Loading…
Cancel
Save