X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fipc.c;h=70c55dc1c7a42a8764761e1afa21581dcfcb61c4;hb=1bdfcf9791729310f75857d0e002c40ef659a89b;hp=3763f24837addb2a9b2f523093a49b745119cb78;hpb=711a4a302936537f6487a99d0ed8f292a8135817;p=collectd.git diff --git a/src/ipc.c b/src/ipc.c index 3763f248..70c55dc1 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -27,11 +27,15 @@ */ #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 */ +# define _GNU_SOURCE + /* X/OPEN tells us to use for semctl() */ /* X/OPEN tells us to use for msgctl() */ /* X/OPEN tells us to use for shmctl() */ @@ -210,7 +214,7 @@ static caddr_t ipc_get_info (cid_t cid, int cmd, int version, int stsize, int *n *nmemb = size / stsize; - buff = (caddr_t)malloc (size); + buff = malloc (size); if (buff == NULL) { ERROR ("ipc plugin: ipc_get_info malloc failed."); return (NULL); @@ -233,14 +237,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; } @@ -284,18 +288,18 @@ 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