Skip to content

Commit

Permalink
Merge pull request #2711 from dago/kstat
Browse files Browse the repository at this point in the history
Include kstat.h if available to provide kstat_ctl_t
  • Loading branch information
Pavel Rochnyak committed Mar 15, 2018
2 parents 279c8b3 + 7b0ce95 commit dda68af
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/cpu.c
Expand Up @@ -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 <kstat.h>
#endif
/* colleague tells me that Sun doesn't sell systems with more than 100 or so
* CPUs.. */
#define MAX_NUMCPU 256
Expand Down
5 changes: 5 additions & 0 deletions src/daemon/collectd.c
Expand Up @@ -43,6 +43,10 @@
#include <statgrab.h>
#endif

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#ifndef COLLECTD_LOCALE
#define COLLECTD_LOCALE "C"
#endif
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/daemon/common.c
Expand Up @@ -60,6 +60,10 @@
#include <sys/capability.h>
#endif

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#ifdef HAVE_LIBKSTAT
extern kstat_ctl_t *kc;
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/daemon/common_test.c
Expand Up @@ -27,6 +27,10 @@
#include "common.h"
#include "testing.h"

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#if HAVE_LIBKSTAT
kstat_ctl_t *kc;
#endif /* HAVE_LIBKSTAT */
Expand Down
4 changes: 4 additions & 0 deletions src/daemon/plugin_mock.c
Expand Up @@ -26,6 +26,10 @@

#include "plugin.h"

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#if HAVE_LIBKSTAT
kstat_ctl_t *kc = NULL;
#endif /* HAVE_LIBKSTAT */
Expand Down
6 changes: 5 additions & 1 deletion src/daemon/utils_subst_test.c
Expand Up @@ -24,12 +24,16 @@
* Florian octo Forster <octo at collectd.org>
*/

#include "common.h" /* for STATIC_ARRAY_SIZE */
#include "collectd.h"
#include "common.h" /* for STATIC_ARRAY_SIZE */

#include "testing.h"
#include "utils_subst.h"

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#if HAVE_LIBKSTAT
kstat_ctl_t *kc;
#endif /* HAVE_LIBKSTAT */
Expand Down
3 changes: 3 additions & 0 deletions src/disk.c
Expand Up @@ -120,6 +120,9 @@ static struct gmesh geom_tree;
/* #endif KERNEL_FREEBSD */

#elif HAVE_LIBKSTAT
#if HAVE_KSTAT_H
#include <kstat.h>
#endif
#define MAX_NUMDISK 1024
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMDISK];
Expand Down
3 changes: 3 additions & 0 deletions src/interface.c
Expand Up @@ -91,6 +91,9 @@ static ignorelist_t *ignorelist = NULL;
static _Bool report_inactive = 1;

#ifdef HAVE_LIBKSTAT
#if HAVE_KSTAT_H
#include <kstat.h>
#endif
#define MAX_NUMIF 256
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMIF];
Expand Down
4 changes: 4 additions & 0 deletions src/tape.c
Expand Up @@ -29,6 +29,10 @@
#error "No applicable input method."
#endif

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#define MAX_NUMTAPE 256
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMTAPE];
Expand Down
4 changes: 4 additions & 0 deletions src/uptime.c
Expand Up @@ -53,6 +53,10 @@
* Global variables
*/

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#if HAVE_LIBKSTAT
extern kstat_ctl_t *kc;
#endif /* #endif HAVE_LIBKSTAT */
Expand Down
4 changes: 4 additions & 0 deletions src/utils_mount_test.c
Expand Up @@ -30,6 +30,10 @@
#include "testing.h"
#include "utils_mount.h"

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#if HAVE_LIBKSTAT
kstat_ctl_t *kc;
#endif /* HAVE_LIBKSTAT */
Expand Down
4 changes: 4 additions & 0 deletions src/utils_vl_lookup.c
Expand Up @@ -33,6 +33,10 @@
#include "utils_avltree.h"
#include "utils_vl_lookup.h"

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

#if HAVE_LIBKSTAT
kstat_ctl_t *kc;
#endif /* HAVE_LIBKSTAT */
Expand Down
5 changes: 5 additions & 0 deletions src/zfs_arc.c
Expand Up @@ -99,6 +99,11 @@ static void free_zfs_values(kstat_t *ksp) {
}

#elif defined(KERNEL_SOLARIS)

#if HAVE_KSTAT_H
#include <kstat.h>
#endif

extern kstat_ctl_t *kc;

static long long get_zfs_value(kstat_t *ksp, char *name) {
Expand Down

0 comments on commit dda68af

Please sign in to comment.