]> code.ossystems Code Review - meta-freescale.git/blob
4d4d175690cf75be2b36500c7fc3703ac3a33dfa
[meta-freescale.git] /
1 From f0256fb16d37061e04ca966da9d51d8eb205bc89 Mon Sep 17 00:00:00 2001
2 From: Denys Vlasenko <vda.linux@googlemail.com>
3 Date: Tue, 26 Jul 2011 11:42:12 +0000
4 Subject: *: work around sysinfo.h versus linux/*.h problems
5
6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 ---
8  include/libbb.h |   10 ++++++----
9  init/init.c     |    3 ++-
10  procps/free.c   |    3 +++
11  procps/ps.c     |    3 +++
12  procps/uptime.c |    4 ++++
13  5 files changed, 18 insertions(+), 5 deletions(-)
14
15 diff --git a/include/libbb.h b/include/libbb.h
16 index afe3b61..9fcd770 100644
17 --- a/include/libbb.h
18 +++ b/include/libbb.h
19 @@ -44,10 +44,12 @@
20  #ifdef HAVE_SYS_STATFS_H
21  # include <sys/statfs.h>
22  #endif
23 -/* struct sysinfo is linux-specific */
24 -#ifdef __linux__
25 -# include <sys/sysinfo.h>
26 -#endif
27 +/* Don't do this here:
28 + * #include <sys/sysinfo.h>
29 + * Some linux/ includes pull in conflicting definition
30 + * of struct sysinfo (only in some toolchanins), which breaks build.
31 + * Include sys/sysinfo.h only in those files which need it.
32 + */
33  #if ENABLE_SELINUX
34  # include <selinux/selinux.h>
35  # include <selinux/context.h>
36 diff --git a/init/init.c b/init/init.c
37 index 0a0d503..5121b94 100644
38 --- a/init/init.c
39 +++ b/init/init.c
40 @@ -113,7 +113,8 @@
41  #include <paths.h>
42  #include <sys/resource.h>
43  #ifdef __linux__
44 -#include <linux/vt.h>
45 +# include <linux/vt.h>
46 +# include <sys/sysinfo.h>
47  #endif
48  #if ENABLE_FEATURE_UTMP
49  # include <utmp.h> /* DEAD_PROCESS */
50 diff --git a/procps/free.c b/procps/free.c
51 index efbac5b..706be1b 100644
52 --- a/procps/free.c
53 +++ b/procps/free.c
54 @@ -10,6 +10,9 @@
55  /* getopt not needed */
56  
57  #include "libbb.h"
58 +#ifdef __linux__
59 +# include <sys/sysinfo.h>
60 +#endif
61  
62  struct globals {
63         unsigned mem_unit;
64 diff --git a/procps/ps.c b/procps/ps.c
65 index 48b55a7..e9e6ca9 100644
66 --- a/procps/ps.c
67 +++ b/procps/ps.c
68 @@ -16,6 +16,9 @@ enum { MAX_WIDTH = 2*1024 };
69  
70  #if ENABLE_DESKTOP
71  
72 +#ifdef __linux__
73 +# include <sys/sysinfo.h>
74 +#endif
75  #include <sys/times.h> /* for times() */
76  #ifndef AT_CLKTCK
77  #define AT_CLKTCK 17
78 diff --git a/procps/uptime.c b/procps/uptime.c
79 index 5c48795..eda782c 100644
80 --- a/procps/uptime.c
81 +++ b/procps/uptime.c
82 @@ -16,6 +16,10 @@
83  /* getopt not needed */
84  
85  #include "libbb.h"
86 +#ifdef __linux__
87 +# include <sys/sysinfo.h>
88 +#endif
89 +
90  
91  #ifndef FSHIFT
92  # define FSHIFT 16              /* nr of bits of precision */
93 -- 
94 1.7.5
95