pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mbone/dbeacon It can happen that times() returns ((uin...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/870235813252
branches:  trunk
changeset: 642986:870235813252
user:      he <he%pkgsrc.org@localhost>
date:      Tue Dec 09 10:45:51 2014 +0000

description:
It can happen that times() returns ((uint32_t)-1).  If that happens,
retry a limited number of times, and log the events.  Export log() from
the main program for use in dbeacon_posix.cpp.

Fix the matrix.pl script since qw() no longer acts as parenteses, so add
some of our own where called for.

Bump PKGREVISION.

diffstat:

 mbone/dbeacon/Makefile                         |   6 ++-
 mbone/dbeacon/distinfo                         |   8 +++--
 mbone/dbeacon/patches/patch-contrib_matrix.pl  |  35 +++++++++++++++++------
 mbone/dbeacon/patches/patch-dbeacon.cpp        |  12 +++++++-
 mbone/dbeacon/patches/patch-dbeacon.h          |  14 +++++++++
 mbone/dbeacon/patches/patch-dbeacon__posix.cpp |  38 ++++++++++++++++++++++++++
 6 files changed, 97 insertions(+), 16 deletions(-)

diffs (208 lines):

diff -r d1957d042912 -r 870235813252 mbone/dbeacon/Makefile
--- a/mbone/dbeacon/Makefile    Tue Dec 09 10:11:27 2014 +0000
+++ b/mbone/dbeacon/Makefile    Tue Dec 09 10:45:51 2014 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.4 2014/10/06 10:04:17 he Exp $
+# $NetBSD: Makefile,v 1.5 2014/12/09 10:45:51 he Exp $
 #
 
 DISTNAME=      dbeacon-0.3.9.1
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    mbone
 MASTER_SITES=  http://fivebits.net/files/dbeacon/
 
@@ -19,6 +19,8 @@
 INSTALLATION_DIRS=     bin ${PKGMANDIR}/man1 share/examples/dbeacon
 INSTALLATION_DIRS+=    share/doc/dbeacon
 
+#INSTALL_UNSTRIPPED=   yes
+
 do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/dbeacon ${DESTDIR}${PREFIX}/bin
        ${INSTALL_MAN} ${WRKSRC}/docs/dbeacon.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
diff -r d1957d042912 -r 870235813252 mbone/dbeacon/distinfo
--- a/mbone/dbeacon/distinfo    Tue Dec 09 10:11:27 2014 +0000
+++ b/mbone/dbeacon/distinfo    Tue Dec 09 10:45:51 2014 +0000
@@ -1,7 +1,9 @@
-$NetBSD: distinfo,v 1.3 2014/10/06 10:04:17 he Exp $
+$NetBSD: distinfo,v 1.4 2014/12/09 10:45:51 he Exp $
 
 SHA1 (dbeacon-0.3.9.1.tar.gz) = d6131e723a251c01d245fcb3ead864f1348e2565
 RMD160 (dbeacon-0.3.9.1.tar.gz) = 81ec4cfe1c2890c7cdb5afbbd98fd2d0cf2a57a3
 Size (dbeacon-0.3.9.1.tar.gz) = 43893 bytes
-SHA1 (patch-contrib_matrix.pl) = 74fe26b6794470a254a95cf42483340d31837506
-SHA1 (patch-dbeacon.cpp) = 4e39bf5b4662ff7c0fae95a987e653c337bc33c2
+SHA1 (patch-contrib_matrix.pl) = 50a5db8c19e7500ef210b873c8dd114edde5dc40
+SHA1 (patch-dbeacon.cpp) = a666e67d9523d7cd2d11cd60b61e01c4f7f933c7
+SHA1 (patch-dbeacon.h) = 8396f6702402100f37cbae30d19cd2b0bb28fb4a
+SHA1 (patch-dbeacon__posix.cpp) = e98bb2e6da3cc2119bbb962249b5c831a8feefc2
diff -r d1957d042912 -r 870235813252 mbone/dbeacon/patches/patch-contrib_matrix.pl
--- a/mbone/dbeacon/patches/patch-contrib_matrix.pl     Tue Dec 09 10:11:27 2014 +0000
+++ b/mbone/dbeacon/patches/patch-contrib_matrix.pl     Tue Dec 09 10:45:51 2014 +0000
@@ -1,12 +1,13 @@
-$NetBSD: patch-contrib_matrix.pl,v 1.1 2014/10/06 10:04:17 he Exp $
+$NetBSD: patch-contrib_matrix.pl,v 1.2 2014/12/09 10:45:51 he Exp $
 
-Fix syntax errors flagged by newer perl.
+Fix syntax errors flagged by newer perl: qw() doesn't act as a pair
+of parentheses, so we need to add some of our own.
 Fix flag pointer, ref.
 https://lists.ubuntu.com/archives/ubuntu-motu/2010-January/006495.html
 
---- contrib/matrix.pl.orig     2013-07-05 19:12:49.000000000 +0200
-+++ contrib/matrix.pl  2014-10-06 11:46:41.000000000 +0200
-@@ -29,7 +29,7 @@
+--- contrib/matrix.pl.orig     2007-07-12 10:17:53.000000000 +0000
++++ contrib/matrix.pl
+@@ -29,7 +29,7 @@ our $history_enabled = 0;
  our $css_file;
  our $dump_update_delay = 5;   # time between each normal dumps
                                # (used to detect outdated dump files)
@@ -15,7 +16,7 @@
  our $default_ssm_group = 'ff3e::beac/10000';
  our $debug = 0;
  our $matrix_link_title = 0;
-@@ -423,7 +423,7 @@
+@@ -423,7 +423,7 @@ sub start_handler {
                        $adj{$current_beacon}[RX_LOCAL] = $atts{'rxlocal'} if defined $atts{'rxlocal'};
                }
        } elsif ($tag eq 'asm' or $tag eq 'ssm') {
@@ -24,7 +25,21 @@
                        if (defined $atts{$att}) {
                                my $index = $tag eq 'ssm' ? 2 : 1;
  
-@@ -884,7 +884,10 @@
+@@ -534,11 +534,11 @@ sub build_header {
+       my $whatatt = "what=$attwhat&amp;";
+       my $fullatt = "full=$full_matrix&amp;";
+ 
+-      my @view = qw(ttl loss delay jitter);
++      my @view = (qw(ttl loss delay jitter));
+       my @view_name = ('TTL', 'Loss', 'Delay', 'Jitter');
+       my @view_type = ('hop count', 'percentage', 'ms', 'ms');
+ 
+-      my @sources = qw(asm ssm both ssmorasm);
++      my @sources = (qw(asm ssm both ssmorasm));
+       my @sources_name = ('ASM', 'SSM', 'Both', 'SSM or ASM');
+ 
+       my $view_len = scalar(@view);
+@@ -884,7 +884,10 @@ sub render_matrix {
                                }
                        } elsif ($a eq $b) {
                                printx '<td ', $what_td, ' class="corner">&nbsp;</td>';
@@ -36,7 +51,7 @@
                                printx '<td ', $what_td, ' class="noreport">N/R</td>';
                        } else {
                                printx '<td ', $what_td, ' class="blackhole">XX</td>';
-@@ -1171,7 +1174,7 @@
+@@ -1171,7 +1174,7 @@ sub store_data_one {
        update_ttl_hist(build_history_file_path($dst_h, $src_h) . "/$tag-ttl-hist",
                $adj{$dst}[NEIGH]{$src}[$index]{'ttl'}) if defined $adj{$dst}[NEIGH]{$src}[$index]{'ttl'};
  
@@ -45,7 +60,7 @@
                $values{$type} = $adj{$dst}[NEIGH]{$src}[$index]{$type};
                $good++ if defined $values{$type};
        }
-@@ -1263,7 +1266,7 @@
+@@ -1263,7 +1266,7 @@ sub storedata {
        # Update rrd with new values
  
        my $updatestring = 'N';
@@ -54,7 +69,7 @@
                # Store it in s and not ms
                $values{$valuetype} = $values{$valuetype} / 1000. if $valuetype eq 'delay' or $valuetype eq 'jitter';
                $updatestring .= ':' . $values{$valuetype};
-@@ -1644,7 +1647,7 @@
+@@ -1644,7 +1647,7 @@ sub list_graph {
  
                my $count = 0;
  
diff -r d1957d042912 -r 870235813252 mbone/dbeacon/patches/patch-dbeacon.cpp
--- a/mbone/dbeacon/patches/patch-dbeacon.cpp   Tue Dec 09 10:11:27 2014 +0000
+++ b/mbone/dbeacon/patches/patch-dbeacon.cpp   Tue Dec 09 10:45:51 2014 +0000
@@ -1,6 +1,7 @@
-$NetBSD: patch-dbeacon.cpp,v 1.1 2014/10/06 10:04:17 he Exp $
+$NetBSD: patch-dbeacon.cpp,v 1.2 2014/12/09 10:45:51 he Exp $
 
 Fix pidfile option handling (in configuration file case).
+Also, export log() for use elsewhere.
 
 --- dbeacon.cpp.orig   2007-07-13 13:52:14.000000000 +0000
 +++ dbeacon.cpp
@@ -13,6 +14,15 @@
  
  static void next_event(timeval *);
  static void insert_event(uint32_t, uint32_t);
+@@ -270,7 +270,7 @@ static void logv(int level, const char *
+       }
+ }
+ 
+-static void log(int level, const char *format, ...)
++void log(int level, const char *format, ...)
+ {
+       va_list vl;
+       va_start(vl, format);
 @@ -464,8 +464,8 @@ int main(int argc, char **argv) {
                        perror("Failed to daemon()ize.");
                        return -1;
diff -r d1957d042912 -r 870235813252 mbone/dbeacon/patches/patch-dbeacon.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mbone/dbeacon/patches/patch-dbeacon.h     Tue Dec 09 10:45:51 2014 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-dbeacon.h,v 1.1 2014/12/09 10:45:51 he Exp $
+
+log() is also exported now.
+
+--- dbeacon.h.orig     2007-06-25 00:32:38.000000000 +0000
++++ dbeacon.h
+@@ -144,6 +144,7 @@ extern address beaconUnicastAddr;
+ 
+ extern int verbose;
+ 
++void log(int level, const char *format, ...);
+ void info(const char *format, ...);
+ void fatal(const char *format, ...);
+ 
diff -r d1957d042912 -r 870235813252 mbone/dbeacon/patches/patch-dbeacon__posix.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mbone/dbeacon/patches/patch-dbeacon__posix.cpp    Tue Dec 09 10:45:51 2014 +0000
@@ -0,0 +1,38 @@
+$NetBSD: patch-dbeacon__posix.cpp,v 1.1 2014/12/09 10:45:51 he Exp $
+
+Retry if times() returns with an error.
+It has been known to return ((uint32_t)-1).
+
+--- dbeacon_posix.cpp.orig     2007-06-09 11:35:57.000000000 +0000
++++ dbeacon_posix.cpp
+@@ -25,6 +25,7 @@
+ #include <sys/time.h>
+ #include <netdb.h>
+ #include <unistd.h>
++#include <syslog.h>
+ #include <sys/uio.h>
+ #include <sys/times.h>
+ 
+@@ -516,10 +517,19 @@ void address::set(const sockaddr *sa) {
+ 
+ uint64_t get_timestamp() {
+       struct tms tmp;
++      clock_t clk;
++      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 (++n < 5)
++                      goto retry;
++              else
++                      log(LOG_ERR, "times() failed after 5 retries: %m");
++      }
++      return (clk * 1000) / sysconf(_SC_CLK_TCK);
+ }
+ 
+ uint64_t get_time_of_day() {



Home | Main Index | Thread Index | Old Index