Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 1 | From 090a17ca338a9311d682ecc5933b32bff67cf07f Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 27 Jul 2019 14:20:14 -0700 |
| 4 | Subject: [PATCH] Remove including sys/sysctl.h on glibc based systems |
| 5 | |
| 6 | Glibc 2.30 has added deprecation notice and collectd detects it as warning [1] |
| 7 | |
| 8 | Fixes |
| 9 | sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings] |
| 10 | |
| 11 | [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=744e829637162bb7d5029632aacf341c64b86990 |
| 12 | |
| 13 | Upstream-Status: Submitted [https://github.com/collectd/collectd/pull/3234] |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | src/contextswitch.c | 2 +- |
| 17 | src/memory.c | 2 +- |
| 18 | src/swap.c | 2 +- |
| 19 | src/uuid.c | 2 +- |
| 20 | 4 files changed, 4 insertions(+), 4 deletions(-) |
| 21 | |
| 22 | --- a/src/contextswitch.c |
| 23 | +++ b/src/contextswitch.c |
| 24 | @@ -26,7 +26,7 @@ |
| 25 | #include "common.h" |
| 26 | #include "plugin.h" |
| 27 | |
| 28 | -#ifdef HAVE_SYS_SYSCTL_H |
| 29 | +#if defined(HAVE_SYS_SYSCTL_H) && !defined(__GLIBC__) |
| 30 | #include <sys/sysctl.h> |
| 31 | #endif |
| 32 | |
| 33 | --- a/src/memory.c |
| 34 | +++ b/src/memory.c |
| 35 | @@ -28,7 +28,7 @@ |
| 36 | #include "common.h" |
| 37 | #include "plugin.h" |
| 38 | |
| 39 | -#ifdef HAVE_SYS_SYSCTL_H |
| 40 | +#if defined(HAVE_SYS_SYSCTL_H) && !defined(__GLIBC__) |
| 41 | #include <sys/sysctl.h> |
| 42 | #endif |
| 43 | #ifdef HAVE_SYS_VMMETER_H |
| 44 | --- a/src/swap.c |
| 45 | +++ b/src/swap.c |
| 46 | @@ -49,7 +49,7 @@ |
| 47 | #if HAVE_SYS_PARAM_H |
| 48 | #include <sys/param.h> |
| 49 | #endif |
| 50 | -#if HAVE_SYS_SYSCTL_H |
| 51 | +#if defined(HAVE_SYS_SYSCTL_H) && !defined(__GLIBC__) |
| 52 | #include <sys/sysctl.h> |
| 53 | #endif |
| 54 | #if HAVE_SYS_DKSTAT_H |
| 55 | --- a/src/uuid.c |
| 56 | +++ b/src/uuid.c |
| 57 | @@ -29,7 +29,7 @@ |
| 58 | #include "common.h" |
| 59 | #include "plugin.h" |
| 60 | |
| 61 | -#if HAVE_SYS_SYSCTL_H |
| 62 | +#if defined(HAVE_SYS_SYSCTL_H) && !defined(__GLIBC__) |
| 63 | #include <sys/sysctl.h> |
| 64 | #endif |
| 65 | |
| 66 | --- a/src/cpu.c |
| 67 | +++ b/src/cpu.c |
| 68 | @@ -60,7 +60,7 @@ |
| 69 | |
| 70 | #if (defined(HAVE_SYSCTL) && HAVE_SYSCTL) || \ |
| 71 | (defined(HAVE_SYSCTLBYNAME) && HAVE_SYSCTLBYNAME) |
| 72 | -#ifdef HAVE_SYS_SYSCTL_H |
| 73 | +#if defined(HAVE_SYS_SYSCTL_H) && !defined(__GLIBC__) |
| 74 | #include <sys/sysctl.h> |
| 75 | #endif |
| 76 | |
| 77 | --- a/src/processes.c |
| 78 | +++ b/src/processes.c |
| 79 | @@ -82,7 +82,7 @@ |
| 80 | #if HAVE_MACH_VM_PROT_H |
| 81 | #include <mach/vm_prot.h> |
| 82 | #endif |
| 83 | -#if HAVE_SYS_SYSCTL_H |
| 84 | +#if defined(HAVE_SYS_SYSCTL_H) && !defined(__GLIBC__) |
| 85 | #include <sys/sysctl.h> |
| 86 | #endif |
| 87 | /* #endif HAVE_THREAD_INFO */ |
| 88 | --- a/src/uptime.c |
| 89 | +++ b/src/uptime.c |
| 90 | @@ -33,7 +33,7 @@ |
| 91 | */ |
| 92 | /* #endif HAVE_LIBKSTAT */ |
| 93 | |
| 94 | -#elif HAVE_SYS_SYSCTL_H |
| 95 | +#elif defined(HAVE_SYS_SYSCTL_H) && !defined(__GLIBC__) |
| 96 | #include <sys/sysctl.h> |
| 97 | /* Using sysctl interface to retrieve the boot time on *BSD / Darwin / OS X |
| 98 | * systems */ |