Merge branch 'collectd-5.7'
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Wed, 12 Jul 2017 16:59:07 +0000 (18:59 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Wed, 12 Jul 2017 16:59:07 +0000 (18:59 +0200)
Conflicts:
contrib/systemd.collectd.service

1  2 
contrib/systemd.collectd.service
src/ipc.c

@@@ -18,7 -18,6 +18,7 @@@ ProtectHome=tru
  #   ceph            CAP_DAC_OVERRIDE
  #   dns             CAP_NET_RAW
  #   exec            CAP_SETUID CAP_SETGID
 +#   intel_rdt       CAP_SYS_RAWIO
  #   iptables        CAP_NET_ADMIN
  #   ping            CAP_NET_RAW
  #   smart           CAP_SYS_RAWIO
@@@ -30,9 -29,7 +30,7 @@@
  # By default, drop all capabilities:
  CapabilityBoundingSet=
  
- NoNewPrivileges=true
 -# Tell systemd it will receive a notification from collectd over it's control
 +# Tell systemd it will receive a notification from collectd over its control
  # socket once the daemon is ready. See systemd.service(5) for more details.
  Type=notify
  
diff --combined src/ipc.c
+++ b/src/ipc.c
@@@ -123,13 -123,13 +123,13 @@@ static int ipc_read_sem(void) /* {{{ *
      ERROR("ipc plugin: semctl(2) failed: %s. "
            "Maybe the kernel is not configured for semaphores?",
            sstrerror(errno, errbuf, sizeof(errbuf)));
 -    return (-1);
 +    return -1;
    }
  
    ipc_submit_g("sem", "count", "arrays", seminfo.semusz);
    ipc_submit_g("sem", "count", "total", seminfo.semaem);
  
 -  return (0);
 +  return 0;
  } /* }}} int ipc_read_sem */
  
  static int ipc_read_shm(void) /* {{{ */
      ERROR("ipc plugin: shmctl(2) failed: %s. "
            "Maybe the kernel is not configured for shared memory?",
            sstrerror(errno, errbuf, sizeof(errbuf)));
 -    return (-1);
 +    return -1;
    }
  
    ipc_submit_g("shm", "segments", NULL, shm_info.used_ids);
    ipc_submit_g("shm", "bytes", "total", shm_info.shm_tot * pagesize_g);
    ipc_submit_g("shm", "bytes", "rss", shm_info.shm_rss * pagesize_g);
    ipc_submit_g("shm", "bytes", "swapped", shm_info.shm_swp * pagesize_g);
 -  return (0);
 +  return 0;
  }
  /* }}} int ipc_read_shm */
  
@@@ -160,20 -160,20 +160,20 @@@ static int ipc_read_msg(void) /* {{{ *
  
    if (msgctl(0, MSG_INFO, (struct msqid_ds *)(void *)&msginfo) < 0) {
      ERROR("Kernel is not configured for message queues");
 -    return (-1);
 +    return -1;
    }
    ipc_submit_g("msg", "count", "queues", msginfo.msgmni);
    ipc_submit_g("msg", "count", "headers", msginfo.msgmap);
    ipc_submit_g("msg", "count", "space", msginfo.msgtql);
  
 -  return (0);
 +  return 0;
  }
  /* }}} int ipc_read_msg */
  
  static int ipc_init(void) /* {{{ */
  {
    pagesize_g = sysconf(_SC_PAGESIZE);
 -  return (0);
 +  return 0;
  }
  /* }}} */
  /* #endif KERNEL_LINUX */
@@@ -190,7 -190,7 +190,7 @@@ static caddr_t ipc_get_info(cid_t cid, 
        char errbuf[1024];
        WARNING("ipc plugin: get_ipc_info: %s",
                sstrerror(errno, errbuf, sizeof(errbuf)));
 -      return (NULL);
 +      return NULL;
      }
    }
  
  
    if (size % stsize) {
      ERROR("ipc plugin: ipc_get_info: missmatch struct size and buffer size");
 -    return (NULL);
 +    return NULL;
    }
  
    *nmemb = size / stsize;
    buff = malloc(size);
    if (buff == NULL) {
      ERROR("ipc plugin: ipc_get_info malloc failed.");
 -    return (NULL);
 +    return NULL;
    }
  
    if (get_ipc_info(cid, cmd, version, buff, &size) < 0) {
      WARNING("ipc plugin: get_ipc_info: %s",
              sstrerror(errno, errbuf, sizeof(errbuf)));
      free(buff);
 -    return (NULL);
 +    return NULL;
    }
  
    return buff;
@@@ -242,7 -242,7 +242,7 @@@ static int ipc_read_sem(void) /* {{{ *
    ipc_submit_g("sem", "count", "arrays", sem_nsems);
    ipc_submit_g("sem", "count", "total", sems);
  
 -  return (0);
 +  return 0;
  } /* }}} int ipc_read_sem */
  
  static int ipc_read_shm(void) /* {{{ */
    ipcinfo_shm_t *pshm;
    unsigned int shm_segments = 0;
    size64_t shm_bytes = 0;
-   int n;
+   int i, n;
  
    ipcinfo_shm = (ipcinfo_shm_t *)ipc_get_info(
        0, GET_IPCINFO_SHM_ALL, IPCINFO_SHM_VERSION, sizeof(ipcinfo_shm_t), &n);
    if (ipcinfo_shm == NULL)
      return -1;
  
-   for (int i = 0, pshm = ipcinfo_shm; i < n; i++, pshm++) {
+   for (i = 0, pshm = ipcinfo_shm; i < n; i++, pshm++) {
      shm_segments++;
      shm_bytes += pshm->shm_segsz;
    }
    ipc_submit_g("shm", "segments", NULL, shm_segments);
    ipc_submit_g("shm", "bytes", "total", shm_bytes);
  
 -  return (0);
 +  return 0;
  }
  /* }}} int ipc_read_shm */
  
@@@ -295,7 -295,7 +295,7 @@@ static int ipc_read_msg(void) /* {{{ *
    ipc_submit_g("msg", "count", "headers", msg_qnum);
    ipc_submit_g("msg", "count", "space", msg_used_space);
  
 -  return (0);
 +  return 0;
  }
  /* }}} */
  #endif /* KERNEL_AIX */
@@@ -307,7 -307,7 +307,7 @@@ static int ipc_read(void) /* {{{ *
    x |= ipc_read_sem();
    x |= ipc_read_msg();
  
 -  return (x);
 +  return x;
  }
  /* }}} */
  
@@@ -319,3 -319,5 +319,3 @@@ void module_register(void) /* {{{ *
    plugin_register_read("ipc", ipc_read);
  }
  /* }}} */
 -
 -/* vim: set sw=2 sts=2 et fdm=marker : */