From owner-svn-src-head@FreeBSD.ORG Sat Nov 3 18:46:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 07510800; Sat, 3 Nov 2012 18:46:23 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id AC55D8FC0C; Sat, 3 Nov 2012 18:46:22 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qA3IkL1Q037561; Sat, 3 Nov 2012 12:46:22 -0600 (MDT) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id qA3IjxuD010140; Sat, 3 Nov 2012 12:45:59 -0600 (MDT) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: svn commit: r242519 - head/usr.sbin/watchdogd From: Ian Lepore To: Xin LI In-Reply-To: <201211031838.qA3IcSUR021854@svn.freebsd.org> References: <201211031838.qA3IcSUR021854@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Sat, 03 Nov 2012 12:45:59 -0600 Message-ID: <1351968359.1120.106.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Nov 2012 18:46:23 -0000 On Sat, 2012-11-03 at 18:38 +0000, Xin LI wrote: > Author: delphij > Date: Sat Nov 3 18:38:28 2012 > New Revision: 242519 > URL: http://svn.freebsd.org/changeset/base/242519 > > Log: > Replace log(3) with flsll(3) for watchdogd(8) and drop libm dependency. > > MFC after: 2 weeks > > Modified: > head/usr.sbin/watchdogd/Makefile > head/usr.sbin/watchdogd/watchdogd.c > > Modified: head/usr.sbin/watchdogd/Makefile > ============================================================================== > --- head/usr.sbin/watchdogd/Makefile Sat Nov 3 18:21:32 2012 (r242518) > +++ head/usr.sbin/watchdogd/Makefile Sat Nov 3 18:38:28 2012 (r242519) > @@ -4,8 +4,8 @@ PROG= watchdogd > LINKS= ${BINDIR}/watchdogd ${BINDIR}/watchdog > MAN= watchdogd.8 watchdog.8 > > -LDADD= -lm -lutil > -DPADD= ${LIBM} ${LIBUTIL} > +LDADD= -lutil > +DPADD= ${LIBUTIL} > > .include > > > Modified: head/usr.sbin/watchdogd/watchdogd.c > ============================================================================== > --- head/usr.sbin/watchdogd/watchdogd.c Sat Nov 3 18:21:32 2012 (r242518) > +++ head/usr.sbin/watchdogd/watchdogd.c Sat Nov 3 18:38:28 2012 (r242519) > @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -280,7 +281,7 @@ parseargs(int argc, char *argv[]) > if (a == 0) > timeout = WD_TO_NEVER; > else > - timeout = 1.0 + log(a * 1e9) / log(2.0); > + timeout = flsll(a * 1e9); > if (debugging) > printf("Timeout is 2^%d nanoseconds\n", > timeout); Shouldn't we also change the type of the variable 'a' from double to int64 (and the strtod() and the 1e9 constant), thus removing all dregs of floating point where it isn't really needed? (Sorry, but 20 years of working on wimpy embedded systems without FP hardware just make me blurt out these things automatically). -- Ian