[Midnightbsd-cvs] src [7794] trunk/usr.sbin/watchdogd: Replace log(3) with flsll(3) for watchdogd(8) and drop libm dependency.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Sep 5 13:00:54 EDT 2016


Revision: 7794
          http://svnweb.midnightbsd.org/src/?rev=7794
Author:   laffer1
Date:     2016-09-05 13:00:54 -0400 (Mon, 05 Sep 2016)
Log Message:
-----------
Replace log(3) with flsll(3) for watchdogd(8) and drop libm dependency. Obtained from: FreeBSD

Modified Paths:
--------------
    trunk/usr.sbin/watchdogd/Makefile
    trunk/usr.sbin/watchdogd/watchdogd.c

Modified: trunk/usr.sbin/watchdogd/Makefile
===================================================================
--- trunk/usr.sbin/watchdogd/Makefile	2016-09-05 16:59:20 UTC (rev 7793)
+++ trunk/usr.sbin/watchdogd/Makefile	2016-09-05 17:00:54 UTC (rev 7794)
@@ -4,8 +4,8 @@
 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: trunk/usr.sbin/watchdogd/watchdogd.c
===================================================================
--- trunk/usr.sbin/watchdogd/watchdogd.c	2016-09-05 16:59:20 UTC (rev 7793)
+++ trunk/usr.sbin/watchdogd/watchdogd.c	2016-09-05 17:00:54 UTC (rev 7794)
@@ -48,6 +48,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <sysexits.h>
 #include <unistd.h>
 
@@ -278,7 +279,7 @@
 			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);



More information about the Midnightbsd-cvs mailing list