From owner-svn-src-all@FreeBSD.ORG Wed Jan 13 18:15:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD34310656A6; Wed, 13 Jan 2010 18:15:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92C958FC25; Wed, 13 Jan 2010 18:15:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0DIFkfd084271; Wed, 13 Jan 2010 18:15:46 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0DIFkng084268; Wed, 13 Jan 2010 18:15:46 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201001131815.o0DIFkng084268@svn.freebsd.org> From: Ed Schouten Date: Wed, 13 Jan 2010 18:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202204 - head/usr.sbin/timed/timed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2010 18:15:46 -0000 Author: ed Date: Wed Jan 13 18:15:46 2010 New Revision: 202204 URL: http://svn.freebsd.org/changeset/base/202204 Log: Port timed away from logwtmp(3). Let it use utmpx. Modified: head/usr.sbin/timed/timed/master.c head/usr.sbin/timed/timed/slave.c Modified: head/usr.sbin/timed/timed/master.c ============================================================================== --- head/usr.sbin/timed/timed/master.c Wed Jan 13 18:14:59 2010 (r202203) +++ head/usr.sbin/timed/timed/master.c Wed Jan 13 18:15:46 2010 (r202204) @@ -44,6 +44,7 @@ static const char rcsid[] = #include #include #include +#include #include "pathnames.h" extern int measure_delta; @@ -56,8 +57,6 @@ static int slvcount; /* slaves listeni static void mchgdate(struct tsp *); -extern void logwtmp(char *, char *, char *); - /* * The main function of `master' is to periodically compute the differences * (deltas) between its clock and the clocks of the slaves, to compute the @@ -350,6 +349,7 @@ mchgdate(msg) char tname[MAXHOSTNAMELEN]; char olddate[32]; struct timeval otime, ntime, tmptv; + struct utmpx utx; (void)strcpy(tname, msg->tsp_name); @@ -371,9 +371,13 @@ mchgdate(msg) dictate = 3; synch(tvtomsround(ntime)); } else { - logwtmp("|", "date", ""); + utx.ut_type = OLD_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); (void)settimeofday(&tmptv, 0); - logwtmp("{", "date", ""); + utx.ut_type = NEW_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); spreadtime(); } Modified: head/usr.sbin/timed/timed/slave.c ============================================================================== --- head/usr.sbin/timed/timed/slave.c Wed Jan 13 18:14:59 2010 (r202203) +++ head/usr.sbin/timed/timed/slave.c Wed Jan 13 18:15:46 2010 (r202204) @@ -41,6 +41,7 @@ static const char rcsid[] = #include "globals.h" #include +#include #include "pathnames.h" extern jmp_buf jmpenv; @@ -57,8 +58,6 @@ static void schgdate(struct tsp *, char static void setmaster(struct tsp *); static void answerdelay(void); -extern void logwtmp(char *, char *, char *); - int slave() { @@ -80,6 +79,7 @@ slave() char newdate[32]; struct netinfo *ntp; struct hosttbl *htp; + struct utmpx utx; old_slavenet = 0; @@ -280,9 +280,13 @@ loop: */ synch(tvtomsround(ntime)); } else { - logwtmp("|", "date", ""); - (void)settimeofday(&tmptv, 0); - logwtmp("{", "date", ""); + utx.ut_type = OLD_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); + (void)settimeofday(&tmptv, 0); + utx.ut_type = NEW_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); syslog(LOG_NOTICE, "date changed by %s from %s", msg->tsp_name, olddate);