summaryrefslogtreecommitdiff
path: root/mbone
diff options
context:
space:
mode:
authorhe <he@pkgsrc.org>2015-07-01 09:22:20 +0000
committerhe <he@pkgsrc.org>2015-07-01 09:22:20 +0000
commit5c18fc3addb12f877702d574aac6928a237cae1d (patch)
treeedbcdf3057c02c88daa1ac09f8be0c4a84b8ee25 /mbone
parentba7208f355980ce6ff1c25d7542bbddc7108c376 (diff)
downloadpkgsrc-5c18fc3addb12f877702d574aac6928a237cae1d.tar.gz
It looks like we need another round of changes to get_timestamp(),
this time from using gettimeofday() to using cloc_gettime(CLOCK_MONOTONIC), to avoid the effects of UTC leap second insertion which IIUC steps the system clock back one second, and will cause the single assert() in dbeacon.cpp to fire. Unfortunately, my core dump was incomplete due to a full root file system... PKGREVISION bumped.
Diffstat (limited to 'mbone')
-rw-r--r--mbone/dbeacon/Makefile4
-rw-r--r--mbone/dbeacon/distinfo4
-rw-r--r--mbone/dbeacon/patches/patch-dbeacon__posix.cpp32
3 files changed, 22 insertions, 18 deletions
diff --git a/mbone/dbeacon/Makefile b/mbone/dbeacon/Makefile
index ec01a468726..077669af24a 100644
--- a/mbone/dbeacon/Makefile
+++ b/mbone/dbeacon/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.6 2015/01/13 20:25:13 he Exp $
+# $NetBSD: Makefile,v 1.7 2015/07/01 09:22:20 he Exp $
#
DISTNAME= dbeacon-0.3.9.1
-PKGREVISION= 4
+PKGREVISION= 5
CATEGORIES= mbone
MASTER_SITES= http://fivebits.net/files/dbeacon/
diff --git a/mbone/dbeacon/distinfo b/mbone/dbeacon/distinfo
index eef36d88441..7cc3a1c7d14 100644
--- a/mbone/dbeacon/distinfo
+++ b/mbone/dbeacon/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.5 2015/01/13 20:25:13 he Exp $
+$NetBSD: distinfo,v 1.6 2015/07/01 09:22:20 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) = 634eb939c71d59d191c3e44242290ab07cb77b08
+SHA1 (patch-dbeacon__posix.cpp) = 757a4f91078348a00bbb2258496f3916bec49ef5
diff --git a/mbone/dbeacon/patches/patch-dbeacon__posix.cpp b/mbone/dbeacon/patches/patch-dbeacon__posix.cpp
index 3376d96d320..e2fbe2ce8d3 100644
--- a/mbone/dbeacon/patches/patch-dbeacon__posix.cpp
+++ b/mbone/dbeacon/patches/patch-dbeacon__posix.cpp
@@ -1,45 +1,49 @@
-$NetBSD: patch-dbeacon__posix.cpp,v 1.2 2015/01/13 20:25:13 he Exp $
+$NetBSD: patch-dbeacon__posix.cpp,v 1.3 2015/07/01 09:22:20 he Exp $
-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.
+Replace use of times() with clock_gettime(CLOCK_MONOTONIC), 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
+Still retry a few times if clock_gettime() for some reason should
decide to fail.
--- dbeacon_posix.cpp.orig 2007-06-09 11:35:57.000000000 +0000
+++ dbeacon_posix.cpp
-@@ -25,6 +25,7 @@
+@@ -23,8 +23,10 @@
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
#include <sys/time.h>
++#include <time.h>
#include <netdb.h>
#include <unistd.h>
+#include <syslog.h>
#include <sys/uio.h>
#include <sys/times.h>
-@@ -515,11 +516,24 @@ void address::set(const sockaddr *sa) {
+@@ -515,11 +517,24 @@ void address::set(const sockaddr *sa) {
}
uint64_t get_timestamp() {
- struct tms tmp;
-+ struct timeval tv;
++ struct timespec ts;
+ uint64_t timestamp;
+ int n = 0;
- uint64_t v = times(&tmp);
+ retry:
-+ if (gettimeofday(&tv, 0) != 0) {
-+ log(LOG_WARNING, "gettimeofday() failed: %m");
++ if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
++ log(LOG_WARNING, "clock_gettime(CLOCK_MONOTONIC) failed: %m");
+ if (++n < 5)
+ goto retry;
+ else
+ log(LOG_ERR,
-+ "gettimeofday() failed after 5 retries: %m");
++ "clock_gettime(CLOCK_MONOTONIC) failed after 5 retries: %m");
+ }
-+ timestamp = tv.tv_sec;
++ timestamp = ts.tv_sec;
+ timestamp *= 1000;
-+ timestamp += tv.tv_usec / 1000;
++ timestamp += ts.tv_nsec / 1000000;
- return (v * 1000) / sysconf(_SC_CLK_TCK);
+ return timestamp;