Hi, sys/sysctl.h is obsolete/deprecated, so there's no need to include it at all. Also, right now if it's not available, it will fail to build because it also won't include err.h and errno.h.
It fails to build on architectures like x32 or arm64, for example
Andre Miranda referenced this bugreport in commit 7eb89d5577544d6f7bb839420008092ac8108f45 Remove unnecessary header includes (Bug #15039) https://git.xfce.org/panel-plugins/xfce4-battery-plugin/commit?id=7eb89d5577544d6f7bb839420008092ac8108f45
Fixed, thanks!
Breaks freebsd as found out by skunnyk with https://buildbot.xfce.alteroot.org/job/xfce4-battery-plugin/nodes=FreeBSD/13/console
Created attachment 8261 headers.diff And that kids, that's why we have a CI.... but I didn't remember to check it, shame on me! @Landry, what do you think of the attached patch? Does it fix the problem on OpenBSD?
Comment on attachment 8261 headers.diff Much better with the patch as master now builds fine on OpenBSd with it, but i dont really like #include scattered around .c files - wouldnt it be better to add a #ifdef block with them at the top ?
I don't mind about where the headers are included, would you prefer another #ifndef __linux__ before line 57 or move those 3 imports to #ifdef __FreeBSD__ and duplicate it at #if defined(__NetBSD__) || defined (__OpenBSD__) ?
adding #ifndef __linux__ #if HAVE_SYSCTL around where they were before is fine :) thanks !
Andre Miranda referenced this bugreport in commit 968b75c514faedb18181f8c628a334af8229b02e Restore headers for *BSD (Bug #15039) https://git.xfce.org/panel-plugins/xfce4-battery-plugin/commit?id=968b75c514faedb18181f8c628a334af8229b02e