Merge branch 'collectd-5.9' into collectd-5.10
authorFlorian Forster <octo@collectd.org>
Fri, 15 Nov 2019 09:47:11 +0000 (10:47 +0100)
committerFlorian Forster <octo@collectd.org>
Fri, 15 Nov 2019 09:47:11 +0000 (10:47 +0100)
.travis.yml
Makefile.am
configure.ac
src/turbostat.c

index 6cf60fa..f0e35a7 100644 (file)
@@ -20,11 +20,11 @@ matrix:
         - PATH="/usr/local/opt/mysql-client/bin:$PATH"
         - JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-13.jdk/Contents/Home"
     - os: linux
-      dist: xenial
+      dist: bionic
       compiler: clang
       jdk: openjdk10
     - os: linux
-      dist: xenial
+      dist: bionic
       compiler: gcc
       jdk: openjdk10
 
@@ -38,9 +38,9 @@ script:
   - if [[ "${TRAVIS_BRANCH}" == "coverity_scan" ]]; then exit 0; fi
   - type pkg-config
   - pkg-config --list-all | sort -u
-  - ./configure
+  - ./configure --disable-lvm
   - cat config.log
-  - make distcheck DISTCHECK_CONFIGURE_FLAGS="--disable-dependency-tracking --enable-debug"
+  - make distcheck DISTCHECK_CONFIGURE_FLAGS="--disable-dependency-tracking --enable-debug --disable-lvm"
 
 addons:
   apt:
index bdb95a1..9e6c8fa 100644 (file)
@@ -1032,8 +1032,8 @@ endif
 if BUILD_PLUGIN_GPU_NVIDIA
 pkglib_LTLIBRARIES += gpu_nvidia.la
 gpu_nvidia_la_SOURCES = src/gpu_nvidia.c
-gpu_nvidia_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) $(BUILD_WITH_GPU_CUDA_CPPFLAGS)
-gpu_nvidia_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_GPU_CUDA_LDFLAGS)
+gpu_nvidia_la_CPPFLAGS = $(AM_CPPFLAGS) $(PLUGIN_CPPFLAGS) $(BUILD_WITH_CUDA_CPPFLAGS)
+gpu_nvidia_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_CUDA_LDFLAGS)
 gpu_nvidia_la_LIBADD = $(BUILD_WITH_CUDA_LIBS)
 endif
 
index 4e585bd..e8eee8d 100644 (file)
@@ -2092,8 +2092,8 @@ if test "x$with_cuda" = "xyes"; then
 fi
 
 if test "x$with_cuda" = "xyes"; then
-  BUILD_WITH_CUDA_CPPFLAGS="$CUDA_CPPFLAGS"
-  BUILD_WITH_CUDA_LDFLAGS="$CUDA_LDFLAGS"
+  BUILD_WITH_CUDA_CPPFLAGS="$with_cuda_cppflags"
+  BUILD_WITH_CUDA_LDFLAGS="$with_cuda_ldflags"
   BUILD_WITH_CUDA_LIBS="-lnvidia-ml"
 fi
 
index 19a5111..8bbb92b 100644 (file)
@@ -1103,7 +1103,11 @@ static int __attribute__((format(printf, 1, 2)))
 parse_int_file(const char *fmt, ...) {
   va_list args;
   char path[PATH_MAX];
+  char buf[256];
   int len;
+  value_t v;
+  char *c;
+  FILE *fp;
 
   va_start(args, fmt);
   len = vsnprintf(path, sizeof(path), fmt, args);
@@ -1113,8 +1117,29 @@ parse_int_file(const char *fmt, ...) {
     return -1;
   }
 
-  value_t v;
-  if (parse_value_file(path, &v, DS_TYPE_DERIVE) != 0) {
+  fp = fopen(path, "r");
+  if (fp == NULL) {
+    ERROR("turbostat plugin: unable to open: '%s': %s", path, strerror(errno));
+    return -1;
+  }
+
+  if (fgets(buf, sizeof(buf), fp) == NULL) {
+    ERROR("turbostat plugin: unable to read: '%s': %s", path, strerror(errno));
+    fclose(fp);
+    return -1;
+  }
+  fclose(fp);
+
+  /* We only care about the first integer in the range */
+  c = strchr(buf, '-');
+  if (c != NULL)
+    *c = '\0';
+  c = strchr(buf, ',');
+  if (c != NULL)
+    *c = '\0';
+  strstripnewline(buf);
+
+  if (parse_value(buf, &v, DS_TYPE_DERIVE) != 0) {
     ERROR("turbostat plugin: Parsing \"%s\" failed.", path);
     return -1;
   }