X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Ftcpconns.c;h=3889d0ff2ca728e4127cab894806d37641a0b855;hp=f12ce5c6969583f8b6aa93eb9f3770c0f8b951c6;hb=a9e50e9e30ecde17e167e271060c8183bfcbf407;hpb=867ad628dc6fcd05bd584b605d7093cfc00c3d07 diff --git a/src/tcpconns.c b/src/tcpconns.c index f12ce5c6..3889d0ff 100644 --- a/src/tcpconns.c +++ b/src/tcpconns.c @@ -70,7 +70,8 @@ #undef HAVE_SYSCTLBYNAME /* force HAVE_LIBKVM_NLIST path */ #endif -#if !KERNEL_LINUX && !HAVE_SYSCTLBYNAME && !HAVE_KVM_GETFILES && !HAVE_LIBKVM_NLIST && !KERNEL_AIX +#if !KERNEL_LINUX && !HAVE_SYSCTLBYNAME && !HAVE_KVM_GETFILES && \ + !HAVE_LIBKVM_NLIST && !KERNEL_AIX #error "No applicable input method." #endif @@ -110,8 +111,8 @@ /* #endif HAVE_SYSCTLBYNAME */ #elif HAVE_KVM_GETFILES -#include #include +#include #define _KERNEL /* for DTYPE_SOCKET */ #include #undef _KERNEL @@ -127,9 +128,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -292,8 +293,8 @@ static void conn_submit_port_entry(port_entry_t *pe) { if (((port_collect_listening != 0) && (pe->flags & PORT_IS_LISTENING)) || (pe->flags & PORT_COLLECT_LOCAL)) { - ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), - "%" PRIu16 "-local", pe->port); + snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), + "%" PRIu16 "-local", pe->port); for (int i = 1; i <= TCP_STATE_MAX; i++) { vl.values[0].gauge = pe->count_local[i]; @@ -305,8 +306,8 @@ static void conn_submit_port_entry(port_entry_t *pe) { } if (pe->flags & PORT_COLLECT_REMOTE) { - ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), - "%" PRIu16 "-remote", pe->port); + snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), + "%" PRIu16 "-remote", pe->port); for (int i = 1; i <= TCP_STATE_MAX; i++) { vl.values[0].gauge = pe->count_remote[i]; @@ -458,7 +459,7 @@ static int conn_read_netlink(void) { if (fd < 0) { ERROR("tcpconns plugin: conn_read_netlink: socket(AF_NETLINK, SOCK_RAW, " "NETLINK_INET_DIAG) failed: %s", - sstrerror(errno, buf, sizeof(buf))); + STRERRNO); return -1; } @@ -489,7 +490,7 @@ static int conn_read_netlink(void) { if (sendmsg(fd, &msg, 0) < 0) { ERROR("tcpconns plugin: conn_read_netlink: sendmsg(2) failed: %s", - sstrerror(errno, buf, sizeof(buf))); + STRERRNO); close(fd); return -1; } @@ -513,7 +514,7 @@ static int conn_read_netlink(void) { continue; ERROR("tcpconns plugin: conn_read_netlink: recvmsg(2) failed: %s", - sstrerror(errno, buf, sizeof(buf))); + STRERRNO); close(fd); return -1; } else if (status == 0) { @@ -830,8 +831,7 @@ static int conn_read(void) { conn_reset_port_entry(); - kf = kvm_getfiles(kvmd, KERN_FILE_BYFILE, DTYPE_SOCKET, - sizeof(*kf), &fcnt); + kf = kvm_getfiles(kvmd, KERN_FILE_BYFILE, DTYPE_SOCKET, sizeof(*kf), &fcnt); if (kf == NULL) { ERROR("tcpconns plugin: kvm_getfiles failed."); return -1;