X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Ftcpconns.c;h=9fdd16e9c1b30b7d336c18e0b3620c8a587340e4;hp=f12ce5c6969583f8b6aa93eb9f3770c0f8b951c6;hb=da11ce02eb202b3e01d3e2d1b40f248a84430973;hpb=267bbc64779f9c7b32e063aac0df22be61bda6ae diff --git a/src/tcpconns.c b/src/tcpconns.c index f12ce5c6..9fdd16e9 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]; @@ -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;