diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-05-12 23:03:18 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-05-12 23:03:18 +0200 |
commit | 89f5bfd6c38cf76823b49628b09b4cd7b1ecb301 (patch) | |
tree | 17397d9091ed043c6841f80ce9d0cb87e1422145 /include/platform.h | |
parent | 279a7ac04ee3e1e1597f46e144fa6da2dac90541 (diff) | |
download | busybox-w32-89f5bfd6c38cf76823b49628b09b4cd7b1ecb301.tar.gz busybox-w32-89f5bfd6c38cf76823b49628b09b4cd7b1ecb301.tar.bz2 busybox-w32-89f5bfd6c38cf76823b49628b09b4cd7b1ecb301.zip |
libbb.h: use inlined sigfillset, sigemptyset, sigisemptyset on uclibc
text data bss dec hex filename
875879 493 7584 883956 d7cf4 busybox_old
875879 493 7584 883956 d7cf4 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include/platform.h')
-rw-r--r-- | include/platform.h | 157 |
1 files changed, 82 insertions, 75 deletions
diff --git a/include/platform.h b/include/platform.h index 2b57cd5a2..2b84447bc 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -7,23 +7,6 @@ | |||
7 | #ifndef BB_PLATFORM_H | 7 | #ifndef BB_PLATFORM_H |
8 | #define BB_PLATFORM_H 1 | 8 | #define BB_PLATFORM_H 1 |
9 | 9 | ||
10 | /* Assume all these functions exist by default. Platforms where it is not | ||
11 | * true will #undef them below. | ||
12 | */ | ||
13 | #define HAVE_CLEARENV 1 | ||
14 | #define HAVE_FDATASYNC 1 | ||
15 | #define HAVE_DPRINTF 1 | ||
16 | #define HAVE_MEMRCHR 1 | ||
17 | #define HAVE_MKDTEMP 1 | ||
18 | #define HAVE_PTSNAME_R 1 | ||
19 | #define HAVE_SETBIT 1 | ||
20 | #define HAVE_SIGHANDLER_T 1 | ||
21 | #define HAVE_STPCPY 1 | ||
22 | #define HAVE_STRCASESTR 1 | ||
23 | #define HAVE_STRCHRNUL 1 | ||
24 | #define HAVE_STRSEP 1 | ||
25 | #define HAVE_STRSIGNAL 1 | ||
26 | #define HAVE_VASPRINTF 1 | ||
27 | 10 | ||
28 | /* Convenience macros to test the version of gcc. */ | 11 | /* Convenience macros to test the version of gcc. */ |
29 | #undef __GNUC_PREREQ | 12 | #undef __GNUC_PREREQ |
@@ -41,10 +24,6 @@ | |||
41 | # endif | 24 | # endif |
42 | #endif | 25 | #endif |
43 | 26 | ||
44 | /* Define macros for some gcc attributes. This permits us to use the | ||
45 | macros freely, and know that they will come into play for the | ||
46 | version of gcc in which they are supported. */ | ||
47 | |||
48 | #if !__GNUC_PREREQ(2,7) | 27 | #if !__GNUC_PREREQ(2,7) |
49 | # ifndef __attribute__ | 28 | # ifndef __attribute__ |
50 | # define __attribute__(x) | 29 | # define __attribute__(x) |
@@ -98,7 +77,7 @@ | |||
98 | #endif | 77 | #endif |
99 | 78 | ||
100 | /* -fwhole-program makes all symbols local. The attribute externally_visible | 79 | /* -fwhole-program makes all symbols local. The attribute externally_visible |
101 | forces a symbol global. */ | 80 | * forces a symbol global. */ |
102 | #if __GNUC_PREREQ(4,1) | 81 | #if __GNUC_PREREQ(4,1) |
103 | # define EXTERNALLY_VISIBLE __attribute__(( visibility("default") )) | 82 | # define EXTERNALLY_VISIBLE __attribute__(( visibility("default") )) |
104 | //__attribute__ ((__externally_visible__)) | 83 | //__attribute__ ((__externally_visible__)) |
@@ -114,22 +93,14 @@ | |||
114 | #endif | 93 | #endif |
115 | 94 | ||
116 | /* We use __extension__ in some places to suppress -pedantic warnings | 95 | /* We use __extension__ in some places to suppress -pedantic warnings |
117 | about GCC extensions. This feature didn't work properly before | 96 | * about GCC extensions. This feature didn't work properly before |
118 | gcc 2.8. */ | 97 | * gcc 2.8. */ |
119 | #if !__GNUC_PREREQ(2,8) | 98 | #if !__GNUC_PREREQ(2,8) |
120 | # ifndef __extension__ | 99 | # ifndef __extension__ |
121 | # define __extension__ | 100 | # define __extension__ |
122 | # endif | 101 | # endif |
123 | #endif | 102 | #endif |
124 | 103 | ||
125 | /* gcc-2.95 had no va_copy but only __va_copy. */ | ||
126 | #if !__GNUC_PREREQ(3,0) | ||
127 | # include <stdarg.h> | ||
128 | # if !defined va_copy && defined __va_copy | ||
129 | # define va_copy(d,s) __va_copy((d),(s)) | ||
130 | # endif | ||
131 | #endif | ||
132 | |||
133 | /* FAST_FUNC is a qualifier which (possibly) makes function call faster | 104 | /* FAST_FUNC is a qualifier which (possibly) makes function call faster |
134 | * and/or smaller by using modified ABI. It is usually only needed | 105 | * and/or smaller by using modified ABI. It is usually only needed |
135 | * on non-static, busybox internal functions. Recent versions of gcc | 106 | * on non-static, busybox internal functions. Recent versions of gcc |
@@ -153,6 +124,15 @@ | |||
153 | # define POP_SAVED_FUNCTION_VISIBILITY | 124 | # define POP_SAVED_FUNCTION_VISIBILITY |
154 | #endif | 125 | #endif |
155 | 126 | ||
127 | /* gcc-2.95 had no va_copy but only __va_copy. */ | ||
128 | #if !__GNUC_PREREQ(3,0) | ||
129 | # include <stdarg.h> | ||
130 | # if !defined va_copy && defined __va_copy | ||
131 | # define va_copy(d,s) __va_copy((d),(s)) | ||
132 | # endif | ||
133 | #endif | ||
134 | |||
135 | |||
156 | /* ---- Endian Detection ------------------------------------ */ | 136 | /* ---- Endian Detection ------------------------------------ */ |
157 | 137 | ||
158 | #include <limits.h> | 138 | #include <limits.h> |
@@ -220,6 +200,7 @@ | |||
220 | # define IF_LITTLE_ENDIAN(...) __VA_ARGS__ | 200 | # define IF_LITTLE_ENDIAN(...) __VA_ARGS__ |
221 | #endif | 201 | #endif |
222 | 202 | ||
203 | |||
223 | /* ---- Unaligned access ------------------------------------ */ | 204 | /* ---- Unaligned access ------------------------------------ */ |
224 | 205 | ||
225 | #include <stdint.h> | 206 | #include <stdint.h> |
@@ -252,37 +233,9 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; | |||
252 | } while (0) | 233 | } while (0) |
253 | #endif | 234 | #endif |
254 | 235 | ||
255 | /* ---- Compiler dependent settings ------------------------- */ | ||
256 | 236 | ||
257 | #if (defined __digital__ && defined __unix__) \ | 237 | /* ---- Size-saving "small" ints (arch-dependent) ----------- */ |
258 | || defined __APPLE__ \ | ||
259 | || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ | ||
260 | # undef HAVE_CLEARENV | ||
261 | # undef HAVE_FDATASYNC | ||
262 | # undef HAVE_MNTENT_H | ||
263 | # undef HAVE_PTSNAME_R | ||
264 | # undef HAVE_SYS_STATFS_H | ||
265 | # undef HAVE_SIGHANDLER_T | ||
266 | # undef HAVE_XTABS | ||
267 | # undef HAVE_DPRINTF | ||
268 | #else | ||
269 | # define HAVE_MNTENT_H 1 | ||
270 | # define HAVE_SYS_STATFS_H 1 | ||
271 | # define HAVE_XTABS 1 | ||
272 | #endif | ||
273 | |||
274 | /*----- Kernel versioning ------------------------------------*/ | ||
275 | |||
276 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||
277 | |||
278 | /* ---- Miscellaneous --------------------------------------- */ | ||
279 | 238 | ||
280 | #if defined __GLIBC__ || defined __UCLIBC__ \ | ||
281 | || defined __dietlibc__ || defined _NEWLIB_VERSION | ||
282 | # include <features.h> | ||
283 | #endif | ||
284 | |||
285 | /* Size-saving "small" ints (arch-dependent) */ | ||
286 | #if defined(i386) || defined(__x86_64__) || defined(__mips__) || defined(__cris__) | 239 | #if defined(i386) || defined(__x86_64__) || defined(__mips__) || defined(__cris__) |
287 | /* add other arches which benefit from this... */ | 240 | /* add other arches which benefit from this... */ |
288 | typedef signed char smallint; | 241 | typedef signed char smallint; |
@@ -302,7 +255,34 @@ typedef unsigned smalluint; | |||
302 | # include <stdbool.h> | 255 | # include <stdbool.h> |
303 | #endif | 256 | #endif |
304 | 257 | ||
305 | /* Try to defeat gcc's alignment of "char message[]"-like data */ | 258 | |
259 | /*----- Kernel versioning ------------------------------------*/ | ||
260 | |||
261 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||
262 | |||
263 | |||
264 | /* ---- Miscellaneous --------------------------------------- */ | ||
265 | |||
266 | #if defined __GLIBC__ \ | ||
267 | || defined __UCLIBC__ \ | ||
268 | || defined __dietlibc__ \ | ||
269 | || defined _NEWLIB_VERSION | ||
270 | # include <features.h> | ||
271 | #endif | ||
272 | |||
273 | /* Define bb_setpgrp */ | ||
274 | #if defined(__digital__) && defined(__unix__) | ||
275 | /* use legacy setpgrp(pid_t, pid_t) for now. move to platform.c */ | ||
276 | # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0) | ||
277 | #else | ||
278 | # define bb_setpgrp() setpgrp() | ||
279 | #endif | ||
280 | |||
281 | /* fdprintf is more readable, we used it before dprintf was standardized */ | ||
282 | #include <unistd.h> | ||
283 | #define fdprintf dprintf | ||
284 | |||
285 | /* Useful for defeating gcc's alignment of "char message[]"-like data */ | ||
306 | #if 1 /* if needed: !defined(arch1) && !defined(arch2) */ | 286 | #if 1 /* if needed: !defined(arch1) && !defined(arch2) */ |
307 | # define ALIGN1 __attribute__((aligned(1))) | 287 | # define ALIGN1 __attribute__((aligned(1))) |
308 | # define ALIGN2 __attribute__((aligned(2))) | 288 | # define ALIGN2 __attribute__((aligned(2))) |
@@ -314,8 +294,7 @@ typedef unsigned smalluint; | |||
314 | # define ALIGN4 | 294 | # define ALIGN4 |
315 | #endif | 295 | #endif |
316 | 296 | ||
317 | 297 | /* | |
318 | /* uclibc does not implement daemon() for no-mmu systems. | ||
319 | * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably. | 298 | * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably. |
320 | * For earlier versions there is no reliable way to check if we are building | 299 | * For earlier versions there is no reliable way to check if we are building |
321 | * for a mmu-less system. | 300 | * for a mmu-less system. |
@@ -333,12 +312,9 @@ typedef unsigned smalluint; | |||
333 | #endif | 312 | #endif |
334 | 313 | ||
335 | #if defined(__digital__) && defined(__unix__) | 314 | #if defined(__digital__) && defined(__unix__) |
336 | |||
337 | # include <standards.h> | 315 | # include <standards.h> |
338 | # include <inttypes.h> | 316 | # include <inttypes.h> |
339 | # define PRIu32 "u" | 317 | # define PRIu32 "u" |
340 | /* use legacy setpgrp(pid_t,pid_t) for now. move to platform.c */ | ||
341 | # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0) | ||
342 | # if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET | 318 | # if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET |
343 | # define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET) | 319 | # define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET) |
344 | # endif | 320 | # endif |
@@ -351,17 +327,31 @@ typedef unsigned smalluint; | |||
351 | # if !defined ADJ_TICK && defined MOD_CLKB | 327 | # if !defined ADJ_TICK && defined MOD_CLKB |
352 | # define ADJ_TICK MOD_CLKB | 328 | # define ADJ_TICK MOD_CLKB |
353 | # endif | 329 | # endif |
330 | #endif | ||
354 | 331 | ||
355 | # undef HAVE_STPCPY | ||
356 | |||
357 | #else | ||
358 | 332 | ||
359 | # define bb_setpgrp() setpgrp() | 333 | /* ---- Who misses what? ------------------------------------ */ |
360 | 334 | ||
361 | #endif | 335 | /* Assume all these functions exist by default. Platforms where it is not |
362 | 336 | * true will #undef them below. | |
363 | #include <unistd.h> | 337 | */ |
364 | #define fdprintf dprintf | 338 | #define HAVE_CLEARENV 1 |
339 | #define HAVE_FDATASYNC 1 | ||
340 | #define HAVE_DPRINTF 1 | ||
341 | #define HAVE_MEMRCHR 1 | ||
342 | #define HAVE_MKDTEMP 1 | ||
343 | #define HAVE_PTSNAME_R 1 | ||
344 | #define HAVE_SETBIT 1 | ||
345 | #define HAVE_SIGHANDLER_T 1 | ||
346 | #define HAVE_STPCPY 1 | ||
347 | #define HAVE_STRCASESTR 1 | ||
348 | #define HAVE_STRCHRNUL 1 | ||
349 | #define HAVE_STRSEP 1 | ||
350 | #define HAVE_STRSIGNAL 1 | ||
351 | #define HAVE_VASPRINTF 1 | ||
352 | #define HAVE_MNTENT_H 1 | ||
353 | #define HAVE_SYS_STATFS_H 1 | ||
354 | #define HAVE_XTABS 1 | ||
365 | 355 | ||
366 | #if defined(__dietlibc__) | 356 | #if defined(__dietlibc__) |
367 | # undef HAVE_STRCHRNUL | 357 | # undef HAVE_STRCHRNUL |
@@ -384,6 +374,23 @@ typedef unsigned smalluint; | |||
384 | # undef HAVE_STRCHRNUL | 374 | # undef HAVE_STRCHRNUL |
385 | #endif | 375 | #endif |
386 | 376 | ||
377 | #if (defined __digital__ && defined __unix__) \ | ||
378 | || defined __APPLE__ \ | ||
379 | || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ | ||
380 | # undef HAVE_CLEARENV | ||
381 | # undef HAVE_FDATASYNC | ||
382 | # undef HAVE_MNTENT_H | ||
383 | # undef HAVE_PTSNAME_R | ||
384 | # undef HAVE_SYS_STATFS_H | ||
385 | # undef HAVE_SIGHANDLER_T | ||
386 | # undef HAVE_XTABS | ||
387 | # undef HAVE_DPRINTF | ||
388 | #endif | ||
389 | |||
390 | #if defined(__digital__) && defined(__unix__) | ||
391 | # undef HAVE_STPCPY | ||
392 | #endif | ||
393 | |||
387 | /* | 394 | /* |
388 | * Now, define prototypes for all the functions defined in platform.c | 395 | * Now, define prototypes for all the functions defined in platform.c |
389 | * These must come after all the HAVE_* macros are defined (or not) | 396 | * These must come after all the HAVE_* macros are defined (or not) |