*: work around sysinfo.h versus linux/*.h problems

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-07-26 13:42:12 +02:00
parent 4abcb8b0d1
commit 67905e2d7c
5 changed files with 18 additions and 5 deletions

View File

@ -52,10 +52,12 @@
#ifdef HAVE_SYS_STATFS_H #ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h> # include <sys/statfs.h>
#endif #endif
/* struct sysinfo is linux-specific */ /* Don't do this here:
#ifdef __linux__ * #include <sys/sysinfo.h>
# include <sys/sysinfo.h> * Some linux/ includes pull in conflicting definition
#endif * of struct sysinfo (only in some toolchanins), which breaks build.
* Include sys/sysinfo.h only in those files which need it.
*/
#if ENABLE_SELINUX #if ENABLE_SELINUX
# include <selinux/selinux.h> # include <selinux/selinux.h>
# include <selinux/context.h> # include <selinux/context.h>

View File

@ -113,7 +113,8 @@
#include <paths.h> #include <paths.h>
#include <sys/resource.h> #include <sys/resource.h>
#ifdef __linux__ #ifdef __linux__
#include <linux/vt.h> # include <linux/vt.h>
# include <sys/sysinfo.h>
#endif #endif
#include "reboot.h" /* reboot() constants */ #include "reboot.h" /* reboot() constants */

View File

@ -22,6 +22,9 @@
//usage: "Total: 386144 257128 129016\n" //usage: "Total: 386144 257128 129016\n"
#include "libbb.h" #include "libbb.h"
#ifdef __linux__
# include <sys/sysinfo.h>
#endif
struct globals { struct globals {
unsigned mem_unit; unsigned mem_unit;

View File

@ -62,6 +62,9 @@ enum { MAX_WIDTH = 2*1024 };
#if ENABLE_DESKTOP #if ENABLE_DESKTOP
#ifdef __linux__
# include <sys/sysinfo.h>
#endif
#include <sys/times.h> /* for times() */ #include <sys/times.h> /* for times() */
#ifndef AT_CLKTCK #ifndef AT_CLKTCK
# define AT_CLKTCK 17 # define AT_CLKTCK 17

View File

@ -25,6 +25,10 @@
//usage: " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n" //usage: " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n"
#include "libbb.h" #include "libbb.h"
#ifdef __linux__
# include <sys/sysinfo.h>
#endif
#ifndef FSHIFT #ifndef FSHIFT
# define FSHIFT 16 /* nr of bits of precision */ # define FSHIFT 16 /* nr of bits of precision */