Browse Source

Add ./tarball_archive/symon-2.88.tar.gz

Wictor Lund 3 years ago
parent
commit
8ed044c386
4 changed files with 12 additions and 5 deletions
  1. 4 0
      symon/CHANGELOG
  2. 1 1
      symon/Makefile.inc
  3. 1 0
      symon/platform/Linux/platform.h
  4. 6 4
      symon/platform/Linux/sm_if.c

+ 4 - 0
symon/CHANGELOG

@@ -1,3 +1,7 @@
+21/07/2016 - 2.88
+
+   - platform/Linux/sm_if.c more robust interface finding (Niels Koster)
+
 24/10/2014 - 2.87
 
    - platform/FreeBSD/sm_cpu.c updated to support smp

+ 1 - 1
symon/Makefile.inc

@@ -1,4 +1,4 @@
-V=2.87
+V=2.88
 
 AR?=	ar
 CC?=	cc

+ 1 - 0
symon/platform/Linux/platform.h

@@ -74,6 +74,7 @@ union stream_parg {
         char path[MAX_PATH_LEN];
     } sn;
     int smart;
+    char ifname[MAX_PATH_LEN];
     char flukso[MAX_PATH_LEN];
     char io[MAX_PATH_LEN];
 };

+ 6 - 4
symon/platform/Linux/sm_if.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001-2010 Willem Dijkstra
+ * Copyright (c) 2001-2016 Willem Dijkstra
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -85,6 +85,8 @@ init_if(struct stream *st)
         if_buf = xmalloc(if_maxsize);
     }
 
+    snprintf(st->parg.ifname, sizeof(st->parg.ifname), "%s:", st->arg);
+
     info("started module if(%.200s)", st->arg);
 }
 
@@ -129,18 +131,18 @@ get_if(char *symon_buf, int maxlen, struct stream *st)
         return 0;
     }
 
-    if ((line = strstr(if_buf, st->arg)) == NULL) {
+    if ((line = strstr(if_buf, st->parg.ifname)) == NULL) {
         warning("could not find interface %s", st->arg);
         return 0;
     }
 
-    line += strlen(st->arg);
+    line += strlen(st->parg.ifname);
     bzero(&stats, sizeof(struct if_device_stats));
 
     /* Inter-|   Receive                                                |  Transmit
      *  face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
      */
-    if (16 > sscanf(line, ":%" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %"
+    if (16 > sscanf(line, "%" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %"
                                SCNu64 " %" SCNu64 " %" SCNu64 " %"
                                SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %"
                                SCNu64 " %" SCNu64 " %" SCNu64 "\n",