Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/include/platform.h
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/include/platform.h
r902 r1770 12 12 #if defined __GNUC__ && defined __GNUC_MINOR__ 13 13 # define __GNUC_PREREQ(maj, min) \ 14 14 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) 15 15 #else 16 16 # define __GNUC_PREREQ(maj, min) 0 … … 35 35 36 36 #undef inline 37 #if __STDC_VERSION__ > 199901L37 #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L 38 38 /* it's a keyword */ 39 39 #else … … 54 54 # define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m))) 55 55 # if __GNUC_PREREQ (3,0) 56 # define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) inline 56 # define ALWAYS_INLINE __attribute__ ((always_inline)) inline 57 # if !ENABLE_WERROR 58 # define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) 59 # define ATTRIBUTE_UNUSED_RESULT __attribute__ ((warn_unused_result)) 60 # else 61 # define ATTRIBUTE_DEPRECATED /* n/a */ 62 # define ATTRIBUTE_UNUSED_RESULT /* n/a */ 63 # endif 57 64 # else 58 # define ATTRIBUTE_ALWAYS_INLINE inline 65 # define ALWAYS_INLINE inline 66 # define ATTRIBUTE_DEPRECATED /* n/a */ 67 # define ATTRIBUTE_UNUSED_RESULT /* n/a */ 59 68 # endif 60 69 … … 134 143 135 144 /* ---- Compiler dependent settings ------------------------- */ 145 #if (defined __digital__ && defined __unix__) 146 # undef HAVE_MNTENT_H 147 #else 148 # define HAVE_MNTENT_H 1 149 #endif /* ___digital__ && __unix__ */ 150 151 /* linux/loop.h relies on __u64. Make sure we have that as a proper type 152 * until userspace is widely fixed. */ 136 153 #ifndef __GNUC__ 137 154 #if defined __INTEL_COMPILER … … 141 158 #endif /* ifndef __GNUC__ */ 142 159 143 #if (defined __digital__ && defined __unix__)144 # undef HAVE_MNTENT_H145 #else146 # define HAVE_MNTENT_H 1147 #endif /* ___digital__ && __unix__ */148 149 160 /*----- Kernel versioning ------------------------------------*/ 150 161 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) … … 159 170 #endif 160 171 161 / / Don't perpetuate e2fsck crap into the headers. Clean up e2fsck instead.172 /* Don't perpetuate e2fsck crap into the headers. Clean up e2fsck instead. */ 162 173 163 174 #if defined __GLIBC__ || defined __UCLIBC__ \ … … 170 181 /* Largest integral types. */ 171 182 #if __BIG_ENDIAN__ 172 typedef long intintmax_t;173 typedef unsigned long intuintmax_t;183 typedef long intmax_t; 184 typedef unsigned long uintmax_t; 174 185 #else 175 186 __extension__ 176 typedef long long intintmax_t;187 typedef long long intmax_t; 177 188 __extension__ 178 typedef unsigned long long int uintmax_t; 179 #endif 180 #endif 181 182 /* uclibc does not implement daemon for no-mmu systems. 189 typedef unsigned long long uintmax_t; 190 #endif 191 #endif 192 193 /* Size-saving "small" ints (arch-dependent) */ 194 #if defined(i386) || defined(__x86_64__) || defined(__mips__) || defined(__cris__) 195 /* add other arches which benefit from this... */ 196 typedef signed char smallint; 197 typedef unsigned char smalluint; 198 #else 199 /* for arches where byte accesses generate larger code: */ 200 typedef int smallint; 201 typedef unsigned smalluint; 202 #endif 203 204 /* ISO C Standard: 7.16 Boolean type and values <stdbool.h> */ 205 #if (defined __digital__ && defined __unix__) 206 /* old system without (proper) C99 support */ 207 #define bool smalluint 208 #else 209 /* modern system, so use it */ 210 #include <stdbool.h> 211 #endif 212 213 /* Try to defeat gcc's alignment of "char message[]"-like data */ 214 #if 1 /* if needed: !defined(arch1) && !defined(arch2) */ 215 #define ALIGN1 __attribute__((aligned(1))) 216 #define ALIGN2 __attribute__((aligned(2))) 217 #else 218 /* Arches which MUST have 2 or 4 byte alignment for everything are here */ 219 #define ALIGN1 220 #define ALIGN2 221 #endif 222 223 224 /* uclibc does not implement daemon() for no-mmu systems. 183 225 * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably. 184 226 * For earlier versions there is no reliable way to check if we are building … … 188 230 #if defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \ 189 231 __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__ 190 #define BB_NOMMU 232 #define BB_MMU 0 233 #define BB_NOMMU 1 234 #define USE_FOR_NOMMU(...) __VA_ARGS__ 235 #define USE_FOR_MMU(...) 236 #else 237 #define BB_MMU 1 238 /* BB_NOMMU is not defined in this case! */ 239 #define USE_FOR_NOMMU(...) 240 #define USE_FOR_MMU(...) __VA_ARGS__ 191 241 #endif 192 242 … … 194 244 * libbb. This would require a platform.c. It's not going to be cleaned 195 245 * out of the tree, so stop saying it should be. */ 246 #if !defined(__dietlibc__) 247 /* Needed for: glibc */ 248 /* Not needed for: dietlibc */ 249 /* Others: ?? (add as needed) */ 196 250 #define fdprintf dprintf 251 #endif 252 253 #if defined(__dietlibc__) 254 static ALWAYS_INLINE char* strchrnul(const char *s, char c) 255 { 256 while (*s && *s != c) ++s; 257 return (char*)s; 258 } 259 #endif 260 261 /* Don't use lchown with glibc older than 2.1.x ... uClibc lacks it */ 262 #if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \ 263 defined __UC_LIBC__ 264 # define lchown chown 265 #endif 197 266 198 267 /* THIS SHOULD BE CLEANED OUT OF THE TREE ENTIRELY */ … … 209 278 #define PRIu32 "u" 210 279 211 /* use legacy setpgrp(pid t_,pid_t) for now. move to platform.c */212 #define bb_setpgrp do{pid_t __me = getpid();setpgrp(__me,__me);}while(0)280 /* use legacy setpgrp(pid_t,pid_t) for now. move to platform.c */ 281 #define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0) 213 282 214 283 #if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET … … 226 295 227 296 #else 228 #define bb_setpgrp setpgrp()297 #define bb_setpgrp() setpgrp() 229 298 #endif 230 299 231 300 #if defined(__linux__) 232 301 #include <sys/mount.h> 302 /* Make sure we have all the new mount flags we actually try to use. */ 303 #ifndef MS_BIND 304 #define MS_BIND (1<<12) 305 #endif 306 #ifndef MS_MOVE 307 #define MS_MOVE (1<<13) 308 #endif 309 #ifndef MS_RECURSIVE 310 #define MS_RECURSIVE (1<<14) 311 #endif 312 #ifndef MS_SILENT 313 #define MS_SILENT (1<<15) 314 #endif 315 316 /* The shared subtree stuff, which went in around 2.6.15. */ 317 #ifndef MS_UNBINDABLE 318 #define MS_UNBINDABLE (1<<17) 319 #endif 320 #ifndef MS_PRIVATE 321 #define MS_PRIVATE (1<<18) 322 #endif 323 #ifndef MS_SLAVE 324 #define MS_SLAVE (1<<19) 325 #endif 326 #ifndef MS_SHARED 327 #define MS_SHARED (1<<20) 328 #endif 329 330 233 331 #if !defined(BLKSSZGET) 234 332 #define BLKSSZGET _IO(0x12, 104)
Note:
See TracChangeset
for help on using the changeset viewer.