diff options
-rw-r--r-- | mbone/dbeacon/Makefile | 4 | ||||
-rw-r--r-- | mbone/dbeacon/distinfo | 4 | ||||
-rw-r--r-- | mbone/dbeacon/patches/patch-dbeacon__posix.cpp | 36 |
3 files changed, 27 insertions, 17 deletions
diff --git a/mbone/dbeacon/Makefile b/mbone/dbeacon/Makefile index 1c054c7406f..ec01a468726 100644 --- a/mbone/dbeacon/Makefile +++ b/mbone/dbeacon/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.5 2014/12/09 10:45:51 he Exp $ +# $NetBSD: Makefile,v 1.6 2015/01/13 20:25:13 he Exp $ # DISTNAME= dbeacon-0.3.9.1 -PKGREVISION= 3 +PKGREVISION= 4 CATEGORIES= mbone MASTER_SITES= http://fivebits.net/files/dbeacon/ diff --git a/mbone/dbeacon/distinfo b/mbone/dbeacon/distinfo index 66d4f346fec..eef36d88441 100644 --- a/mbone/dbeacon/distinfo +++ b/mbone/dbeacon/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.4 2014/12/09 10:45:51 he Exp $ +$NetBSD: distinfo,v 1.5 2015/01/13 20:25:13 he Exp $ SHA1 (dbeacon-0.3.9.1.tar.gz) = d6131e723a251c01d245fcb3ead864f1348e2565 RMD160 (dbeacon-0.3.9.1.tar.gz) = 81ec4cfe1c2890c7cdb5afbbd98fd2d0cf2a57a3 @@ -6,4 +6,4 @@ Size (dbeacon-0.3.9.1.tar.gz) = 43893 bytes SHA1 (patch-contrib_matrix.pl) = 50a5db8c19e7500ef210b873c8dd114edde5dc40 SHA1 (patch-dbeacon.cpp) = a666e67d9523d7cd2d11cd60b61e01c4f7f933c7 SHA1 (patch-dbeacon.h) = 8396f6702402100f37cbae30d19cd2b0bb28fb4a -SHA1 (patch-dbeacon__posix.cpp) = e98bb2e6da3cc2119bbb962249b5c831a8feefc2 +SHA1 (patch-dbeacon__posix.cpp) = 634eb939c71d59d191c3e44242290ab07cb77b08 diff --git a/mbone/dbeacon/patches/patch-dbeacon__posix.cpp b/mbone/dbeacon/patches/patch-dbeacon__posix.cpp index 85aeecd4080..3376d96d320 100644 --- a/mbone/dbeacon/patches/patch-dbeacon__posix.cpp +++ b/mbone/dbeacon/patches/patch-dbeacon__posix.cpp @@ -1,7 +1,12 @@ -$NetBSD: patch-dbeacon__posix.cpp,v 1.1 2014/12/09 10:45:51 he Exp $ +$NetBSD: patch-dbeacon__posix.cpp,v 1.2 2015/01/13 20:25:13 he Exp $ -Retry if times() returns with an error. -It has been known to return ((uint32_t)-1). +Replace use of times() with gettimeofday(), since all we use it +for is to get a millisecond timestamp, and with a 32-bit unsigned +clock_t and 100Hz tick, times() wraps around every 500 days or so, +and the code then falls into an assert() in dbeacon.cpp. + +Still retry a few times if gettimeofday() for some reason should +decide to fail. --- dbeacon_posix.cpp.orig 2007-06-09 11:35:57.000000000 +0000 +++ dbeacon_posix.cpp @@ -13,26 +18,31 @@ It has been known to return ((uint32_t)-1). #include <sys/uio.h> #include <sys/times.h> -@@ -516,10 +517,19 @@ void address::set(const sockaddr *sa) { +@@ -515,11 +516,24 @@ void address::set(const sockaddr *sa) { + } uint64_t get_timestamp() { - struct tms tmp; -+ clock_t clk; +- struct tms tmp; ++ struct timeval tv; ++ uint64_t timestamp; + int n = 0; - uint64_t v = times(&tmp); -- -- return (v * 1000) / sysconf(_SC_CLK_TCK); + retry: -+ clk = times(&tmp); -+ if (errno != 0) { -+ log(LOG_WARNING, "times() failed: %m"); ++ if (gettimeofday(&tv, 0) != 0) { ++ log(LOG_WARNING, "gettimeofday() failed: %m"); + if (++n < 5) + goto retry; + else -+ log(LOG_ERR, "times() failed after 5 retries: %m"); ++ log(LOG_ERR, ++ "gettimeofday() failed after 5 retries: %m"); + } -+ return (clk * 1000) / sysconf(_SC_CLK_TCK); ++ timestamp = tv.tv_sec; ++ timestamp *= 1000; ++ timestamp += tv.tv_usec / 1000; + +- return (v * 1000) / sysconf(_SC_CLK_TCK); ++ return timestamp; } uint64_t get_time_of_day() { |