Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2012 18:30:12 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r243820 - stable/9/usr.sbin/watchdogd
Message-ID:  <201212031830.qB3IUCGp004163@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Dec  3 18:30:12 2012
New Revision: 243820
URL: http://svnweb.freebsd.org/changeset/base/243820

Log:
  MFC r242519:
  
  Replace log(3) with flsll(3) for watchdogd(8) and drop libm dependency.

Modified:
  stable/9/usr.sbin/watchdogd/Makefile
  stable/9/usr.sbin/watchdogd/watchdogd.c
Directory Properties:
  stable/9/usr.sbin/watchdogd/   (props changed)

Modified: stable/9/usr.sbin/watchdogd/Makefile
==============================================================================
--- stable/9/usr.sbin/watchdogd/Makefile	Mon Dec  3 18:28:54 2012	(r243819)
+++ stable/9/usr.sbin/watchdogd/Makefile	Mon Dec  3 18:30:12 2012	(r243820)
@@ -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 <bsd.prog.mk>
 

Modified: stable/9/usr.sbin/watchdogd/watchdogd.c
==============================================================================
--- stable/9/usr.sbin/watchdogd/watchdogd.c	Mon Dec  3 18:28:54 2012	(r243819)
+++ stable/9/usr.sbin/watchdogd/watchdogd.c	Mon Dec  3 18:30:12 2012	(r243820)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <sysexits.h>
 #include <unistd.h>
 
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212031830.qB3IUCGp004163>