From b2ce05053cc602f0b8599e8a6c0de80063647ba4 Mon Sep 17 00:00:00 2001 From: Dagobert Michelsen Date: Sat, 10 Mar 2018 18:34:33 +0100 Subject: [PATCH] Include kstat.h if available to provide kstat_ctl_t --- src/cpu.c | 3 +++ src/daemon/collectd.c | 5 +++++ src/daemon/common.c | 4 ++++ src/daemon/common_test.c | 4 ++++ src/daemon/plugin_mock.c | 4 ++++ src/daemon/utils_subst_test.c | 4 ++++ src/disk.c | 3 +++ src/interface.c | 3 +++ src/tape.c | 4 ++++ src/uptime.c | 4 ++++ src/utils_mount_test.c | 4 ++++ src/utils_vl_lookup.c | 4 ++++ src/zfs_arc.c | 5 +++++ 13 files changed, 51 insertions(+) diff --git a/src/cpu.c b/src/cpu.c index 0bf38e7f..8480f11a 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -134,6 +134,9 @@ static mach_msg_type_number_t cpu_list_len; /* #endif KERNEL_LINUX */ #elif defined(HAVE_LIBKSTAT) +#if HAVE_KSTAT_H +#include +#endif /* colleague tells me that Sun doesn't sell systems with more than 100 or so * CPUs.. */ #define MAX_NUMCPU 256 diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index d6060a1a..727876bc 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -43,6 +43,10 @@ #include #endif +#if HAVE_KSTAT_H +#include +#endif + #ifndef COLLECTD_LOCALE #define COLLECTD_LOCALE "C" #endif @@ -201,6 +205,7 @@ static int change_basedir(const char *orig_dir, _Bool create) { } /* static int change_basedir (char *dir) */ #if HAVE_LIBKSTAT +extern kstat_ctl_t *kc; static void update_kstat(void) { if (kc == NULL) { if ((kc = kstat_open()) == NULL) diff --git a/src/daemon/common.c b/src/daemon/common.c index bf833ee8..fbbb6085 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -60,6 +60,10 @@ #include #endif +#if HAVE_KSTAT_H +#include +#endif + #ifdef HAVE_LIBKSTAT extern kstat_ctl_t *kc; #endif diff --git a/src/daemon/common_test.c b/src/daemon/common_test.c index 4d2ccaa3..af2840e5 100644 --- a/src/daemon/common_test.c +++ b/src/daemon/common_test.c @@ -27,6 +27,10 @@ #include "common.h" #include "testing.h" +#if HAVE_KSTAT_H +#include +#endif + #if HAVE_LIBKSTAT kstat_ctl_t *kc; #endif /* HAVE_LIBKSTAT */ diff --git a/src/daemon/plugin_mock.c b/src/daemon/plugin_mock.c index 6df4c15d..96bf3826 100644 --- a/src/daemon/plugin_mock.c +++ b/src/daemon/plugin_mock.c @@ -26,6 +26,10 @@ #include "plugin.h" +#if HAVE_KSTAT_H +#include +#endif + #if HAVE_LIBKSTAT kstat_ctl_t *kc = NULL; #endif /* HAVE_LIBKSTAT */ diff --git a/src/daemon/utils_subst_test.c b/src/daemon/utils_subst_test.c index 00ea0eae..53792191 100644 --- a/src/daemon/utils_subst_test.c +++ b/src/daemon/utils_subst_test.c @@ -30,6 +30,10 @@ #include "testing.h" #include "utils_subst.h" +#if HAVE_KSTAT_H +#include +#endif + #if HAVE_LIBKSTAT kstat_ctl_t *kc; #endif /* HAVE_LIBKSTAT */ diff --git a/src/disk.c b/src/disk.c index 004ce9e2..45706bc2 100644 --- a/src/disk.c +++ b/src/disk.c @@ -120,6 +120,9 @@ static struct gmesh geom_tree; /* #endif KERNEL_FREEBSD */ #elif HAVE_LIBKSTAT +#if HAVE_KSTAT_H +#include +#endif #define MAX_NUMDISK 1024 extern kstat_ctl_t *kc; static kstat_t *ksp[MAX_NUMDISK]; diff --git a/src/interface.c b/src/interface.c index 6c80334e..c45ef660 100644 --- a/src/interface.c +++ b/src/interface.c @@ -91,6 +91,9 @@ static ignorelist_t *ignorelist = NULL; static _Bool report_inactive = 1; #ifdef HAVE_LIBKSTAT +#if HAVE_KSTAT_H +#include +#endif #define MAX_NUMIF 256 extern kstat_ctl_t *kc; static kstat_t *ksp[MAX_NUMIF]; diff --git a/src/tape.c b/src/tape.c index debb1d28..f59b7ea6 100644 --- a/src/tape.c +++ b/src/tape.c @@ -29,6 +29,10 @@ #error "No applicable input method." #endif +#if HAVE_KSTAT_H +#include +#endif + #define MAX_NUMTAPE 256 extern kstat_ctl_t *kc; static kstat_t *ksp[MAX_NUMTAPE]; diff --git a/src/uptime.c b/src/uptime.c index 31a2c1e2..43d72e53 100644 --- a/src/uptime.c +++ b/src/uptime.c @@ -53,6 +53,10 @@ * Global variables */ +#if HAVE_KSTAT_H +#include +#endif + #if HAVE_LIBKSTAT extern kstat_ctl_t *kc; #endif /* #endif HAVE_LIBKSTAT */ diff --git a/src/utils_mount_test.c b/src/utils_mount_test.c index ca65950e..e8f30094 100644 --- a/src/utils_mount_test.c +++ b/src/utils_mount_test.c @@ -30,6 +30,10 @@ #include "testing.h" #include "utils_mount.h" +#if HAVE_KSTAT_H +#include +#endif + #if HAVE_LIBKSTAT kstat_ctl_t *kc; #endif /* HAVE_LIBKSTAT */ diff --git a/src/utils_vl_lookup.c b/src/utils_vl_lookup.c index 76c0674b..052c4c0f 100644 --- a/src/utils_vl_lookup.c +++ b/src/utils_vl_lookup.c @@ -33,6 +33,10 @@ #include "utils_avltree.h" #include "utils_vl_lookup.h" +#if HAVE_KSTAT_H +#include +#endif + #if HAVE_LIBKSTAT kstat_ctl_t *kc; #endif /* HAVE_LIBKSTAT */ diff --git a/src/zfs_arc.c b/src/zfs_arc.c index af4bfccb..c9abdd5f 100644 --- a/src/zfs_arc.c +++ b/src/zfs_arc.c @@ -99,6 +99,11 @@ static void free_zfs_values(kstat_t *ksp) { } #elif defined(KERNEL_SOLARIS) + +#if HAVE_KSTAT_H +#include +#endif + extern kstat_ctl_t *kc; static long long get_zfs_value(kstat_t *ksp, char *name) { -- 2.11.0