X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fipc.c;h=7f909e26dabad189fc383ab2ff7603ffdcb8bc88;hb=c76419c0cf983f1ecd3d36aa236cc4e3f9cff733;hp=00b3a5f8657a0e8d32ab76a41acbd43502368eb0;hpb=3dc0454f7bee3e852171d1f6944891693364ee01;p=collectd.git diff --git a/src/ipc.c b/src/ipc.c index 00b3a5f8..7f909e26 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -27,9 +27,9 @@ */ #include "collectd.h" + #include "common.h" #include "plugin.h" -#include "configfile.h" #if KERNEL_LINUX /* _GNU_SOURCE is needed for struct shm_info.used_ids on musl libc */ @@ -97,14 +97,10 @@ static void ipc_submit_g (const char *plugin_instance, const char *type_instance, gauge_t value) /* {{{ */ { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].gauge = value; - - vl.values = values; + vl.values = &(value_t) { .gauge = value }; vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "ipc", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); sstrncpy (vl.type, type, sizeof (vl.type)); @@ -236,14 +232,14 @@ static int ipc_read_sem (void) /* {{{ */ ipcinfo_sem_t *ipcinfo_sem; unsigned short sem_nsems=0; unsigned short sems=0; - int i,n; + int n; ipcinfo_sem = (ipcinfo_sem_t *)ipc_get_info(0, GET_IPCINFO_SEM_ALL, IPCINFO_SEM_VERSION, sizeof(ipcinfo_sem_t), &n); if (ipcinfo_sem == NULL) return -1; - for (i=0; ishm_segsz; } @@ -287,14 +283,14 @@ static int ipc_read_msg (void) /* {{{ */ uint32_t msg_used_space=0; uint32_t msg_alloc_queues=0; msgqnum32_t msg_qnum=0; - int i,n; + int n; ipcinfo_msg = (ipcinfo_msg_t *)ipc_get_info(0, GET_IPCINFO_MSG_ALL, IPCINFO_MSG_VERSION, sizeof(ipcinfo_msg_t), &n); if (ipcinfo_msg == NULL) return -1; - for (i=0; i