Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/include/platform.h

    r3085 r3232  
    88#define BB_PLATFORM_H 1
    99
    10 /* Assume all these functions exist by default.  Platforms where it is not
    11  * true will #undef them below.
    12  */
    13 #define HAVE_FDPRINTF 1
    14 #define HAVE_MEMRCHR 1
    15 #define HAVE_MKDTEMP 1
    16 #define HAVE_SETBIT 1
    17 #define HAVE_STRCASESTR 1
    18 #define HAVE_STRCHRNUL 1
    19 #define HAVE_STRSEP 1
    20 #define HAVE_STRSIGNAL 1
    21 #define HAVE_VASPRINTF 1
    2210
    2311/* Convenience macros to test the version of gcc. */
     
    3624# endif
    3725#endif
    38 
    39 /* Define macros for some gcc attributes.  This permits us to use the
    40    macros freely, and know that they will come into play for the
    41    version of gcc in which they are supported.  */
    4226
    4327#if !__GNUC_PREREQ(2,7)
     
    9478
    9579/* -fwhole-program makes all symbols local. The attribute externally_visible
    96    forces a symbol global.  */
     80 * forces a symbol global.  */
    9781#if __GNUC_PREREQ(4,1)
    9882# define EXTERNALLY_VISIBLE __attribute__(( visibility("default") ))
     
    11094
    11195/* We use __extension__ in some places to suppress -pedantic warnings
    112    about GCC extensions.  This feature didn't work properly before
    113    gcc 2.8.  */
     96 * about GCC extensions.  This feature didn't work properly before
     97 * gcc 2.8.  */
    11498#if !__GNUC_PREREQ(2,8)
    11599# ifndef __extension__
    116100#  define __extension__
    117 # endif
    118 #endif
    119 
    120 /* gcc-2.95 had no va_copy but only __va_copy. */
    121 #if !__GNUC_PREREQ(3,0)
    122 # include <stdarg.h>
    123 # if !defined va_copy && defined __va_copy
    124 #  define va_copy(d,s) __va_copy((d),(s))
    125101# endif
    126102#endif
     
    141117/* Make all declarations hidden (-fvisibility flag only affects definitions) */
    142118/* (don't include system headers after this until corresponding pop!) */
    143 #if __GNUC_PREREQ(4,1)
     119#if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__)
    144120# define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)")
    145121# define POP_SAVED_FUNCTION_VISIBILITY              _Pragma("GCC visibility pop")
     
    148124# define POP_SAVED_FUNCTION_VISIBILITY
    149125#endif
     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
    150135
    151136/* ---- Endian Detection ------------------------------------ */
     
    216201#endif
    217202
     203
    218204/* ---- Unaligned access ------------------------------------ */
     205
     206#include <stdint.h>
     207typedef int      bb__aliased_int      FIX_ALIASING;
     208typedef long     bb__aliased_long     FIX_ALIASING;
     209typedef uint16_t bb__aliased_uint16_t FIX_ALIASING;
     210typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
    219211
    220212/* NB: unaligned parameter should be a pointer, aligned one -
     
    222214 */
    223215#if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
    224 # include <stdint.h>
    225 typedef int      bb__aliased_int      FIX_ALIASING;
    226 typedef uint16_t bb__aliased_uint16_t FIX_ALIASING;
    227 typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
    228 # define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
     216# define move_from_unaligned_int(v, intp)  ((v) = *(bb__aliased_int*)(intp))
     217# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))
    229218# define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p))
    230219# define move_from_unaligned32(v, u32p) ((v) = *(bb__aliased_uint32_t*)(u32p))
     
    235224/* performs reasonably well (gcc usually inlines memcpy here) */
    236225# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
     226# define move_from_unaligned_long(v, longp) (memcpy(&(v), (longp), sizeof(long)))
    237227# define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
    238228# define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
    239229# define move_to_unaligned16(u16p, v) do { \
    240230    uint16_t __t = (v); \
    241     memcpy((u16p), &__t, 4); \
     231    memcpy((u16p), &__t, 2); \
    242232} while (0)
    243233# define move_to_unaligned32(u32p, v) do { \
     
    247237#endif
    248238
    249 /* ---- Compiler dependent settings ------------------------- */
    250 
    251 #if (defined __digital__ && defined __unix__) \
    252  || defined __APPLE__ \
    253  || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
    254 # undef HAVE_MNTENT_H
    255 # undef HAVE_SYS_STATFS_H
    256 #else
    257 # define HAVE_MNTENT_H 1
    258 /*  Patch bco to compile this busybox on rhel3  */
    259 #include <linux/version.h>
    260 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    261 # define HAVE_SYS_STATFS_H 1
    262 #endif
    263 #endif
    264 
    265 /*----- Kernel versioning ------------------------------------*/
    266 
    267 #ifndef KERNEL_VERSION
    268 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
    269 #endif
    270 
    271 /* ---- Miscellaneous --------------------------------------- */
    272 
    273 #if defined __GLIBC__ || defined __UCLIBC__ \
    274  || defined __dietlibc__ || defined _NEWLIB_VERSION
    275 # include <features.h>
    276 #endif
    277 
    278 /* Size-saving "small" ints (arch-dependent) */
     239
     240/* ---- Size-saving "small" ints (arch-dependent) ----------- */
     241
    279242#if defined(i386) || defined(__x86_64__) || defined(__mips__) || defined(__cris__)
    280243/* add other arches which benefit from this... */
     
    296259#endif
    297260
    298 /* Try to defeat gcc's alignment of "char message[]"-like data */
    299 #if 1 /* if needed: !defined(arch1) && !defined(arch2) */
     261
     262/*----- Kernel versioning ------------------------------------*/
     263
     264#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
     265
     266
     267/* ---- Miscellaneous --------------------------------------- */
     268
     269#if defined __GLIBC__ \
     270 || defined __UCLIBC__ \
     271 || defined __dietlibc__ \
     272 || defined __BIONIC__ \
     273 || defined _NEWLIB_VERSION
     274# include <features.h>
     275#endif
     276
     277/* Define bb_setpgrp */
     278#if defined(__digital__) && defined(__unix__)
     279/* use legacy setpgrp(pid_t, pid_t) for now.  move to platform.c */
     280# define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0)
     281#else
     282# define bb_setpgrp() setpgrp()
     283#endif
     284
     285/* fdprintf is more readable, we used it before dprintf was standardized */
     286#include <unistd.h>
     287#define fdprintf dprintf
     288
     289/* Useful for defeating gcc's alignment of "char message[]"-like data */
     290#if !defined(__s390__)
     291    /* on s390[x], non-word-aligned data accesses require larger code */
    300292# define ALIGN1 __attribute__((aligned(1)))
    301293# define ALIGN2 __attribute__((aligned(2)))
     
    308300#endif
    309301
    310 
    311 /* uclibc does not implement daemon() for no-mmu systems.
     302/*
    312303 * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably.
    313304 * For earlier versions there is no reliable way to check if we are building
     
    326317#endif
    327318
    328 /* Don't use lchown with glibc older than 2.1.x */
    329 #if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1
    330 # define lchown chown
    331 #endif
    332 
    333319#if defined(__digital__) && defined(__unix__)
    334 
    335320# include <standards.h>
    336321# include <inttypes.h>
    337322# define PRIu32 "u"
    338 /* use legacy setpgrp(pid_t,pid_t) for now.  move to platform.c */
    339 # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0)
    340323# if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
    341324#  define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
     
    350333#  define ADJ_TICK MOD_CLKB
    351334# endif
    352 
    353 #else
    354 
    355 # define bb_setpgrp() setpgrp()
    356 
    357 #endif
    358 
    359 #if defined(__GLIBC__)
    360 # define fdprintf dprintf
     335#endif
     336
     337#if defined(__CYGWIN__)
     338# define MAXSYMLINKS SYMLOOP_MAX
     339#endif
     340
     341#if defined(ANDROID) || defined(__ANDROID__)
     342# define BB_ADDITIONAL_PATH ":/system/sbin:/system/bin:/system/xbin"
     343# define SYS_ioprio_set __NR_ioprio_set
     344# define SYS_ioprio_get __NR_ioprio_get
     345#endif
     346
     347
     348/* ---- Who misses what? ------------------------------------ */
     349
     350/* Assume all these functions and header files exist by default.
     351 * Platforms where it is not true will #undef them below.
     352 */
     353#define HAVE_CLEARENV 1
     354#define HAVE_FDATASYNC 1
     355#define HAVE_DPRINTF 1
     356#define HAVE_MEMRCHR 1
     357#define HAVE_MKDTEMP 1
     358#define HAVE_PTSNAME_R 1
     359#define HAVE_SETBIT 1
     360#define HAVE_SIGHANDLER_T 1
     361#define HAVE_STPCPY 1
     362#define HAVE_STRCASESTR 1
     363#define HAVE_STRCHRNUL 1
     364#define HAVE_STRSEP 1
     365#define HAVE_STRSIGNAL 1
     366#define HAVE_STRVERSCMP 1
     367#define HAVE_VASPRINTF 1
     368#define HAVE_UNLOCKED_STDIO 1
     369#define HAVE_UNLOCKED_LINE_OPS 1
     370#define HAVE_GETLINE 1
     371#define HAVE_XTABS 1
     372#define HAVE_MNTENT_H 1
     373#define HAVE_NET_ETHERNET_H 1
     374#define HAVE_SYS_STATFS_H 1
     375
     376#if defined(__UCLIBC_MAJOR__)
     377# if __UCLIBC_MAJOR__ == 0 \
     378  && (   __UCLIBC_MINOR__ < 9 \
     379     || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 32) \
     380     )
     381#  undef HAVE_STRVERSCMP
     382# endif
    361383#endif
    362384
     
    366388
    367389#if defined(__WATCOMC__)
    368 # undef HAVE_FDPRINTF
     390# undef HAVE_DPRINTF
     391# undef HAVE_GETLINE
    369392# undef HAVE_MEMRCHR
    370393# undef HAVE_MKDTEMP
    371394# undef HAVE_SETBIT
     395# undef HAVE_STPCPY
    372396# undef HAVE_STRCASESTR
    373397# undef HAVE_STRCHRNUL
    374398# undef HAVE_STRSEP
    375399# undef HAVE_STRSIGNAL
     400# undef HAVE_STRVERSCMP
    376401# undef HAVE_VASPRINTF
     402# undef HAVE_UNLOCKED_STDIO
     403# undef HAVE_UNLOCKED_LINE_OPS
     404# undef HAVE_NET_ETHERNET_H
     405#endif
     406
     407#if defined(__CYGWIN__)
     408# undef HAVE_CLEARENV
     409# undef HAVE_FDPRINTF
     410# undef HAVE_MEMRCHR
     411# undef HAVE_PTSNAME_R
     412# undef HAVE_STRVERSCMP
     413# undef HAVE_UNLOCKED_LINE_OPS
     414#endif
     415
     416/* These BSD-derived OSes share many similarities */
     417#if (defined __digital__ && defined __unix__) \
     418 || defined __APPLE__ \
     419 || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
     420# undef HAVE_CLEARENV
     421# undef HAVE_FDATASYNC
     422# undef HAVE_GETLINE
     423# undef HAVE_MNTENT_H
     424# undef HAVE_PTSNAME_R
     425# undef HAVE_SYS_STATFS_H
     426# undef HAVE_SIGHANDLER_T
     427# undef HAVE_STRVERSCMP
     428# undef HAVE_XTABS
     429# undef HAVE_DPRINTF
     430# undef HAVE_UNLOCKED_STDIO
     431# undef HAVE_UNLOCKED_LINE_OPS
    377432#endif
    378433
    379434#if defined(__FreeBSD__)
    380435# undef HAVE_STRCHRNUL
     436#endif
     437
     438#if defined(__NetBSD__)
     439# define HAVE_GETLINE 1  /* Recent NetBSD versions have getline() */
     440#endif
     441
     442#if defined(__digital__) && defined(__unix__)
     443# undef HAVE_STPCPY
     444#endif
     445
     446#if defined(ANDROID) || defined(__ANDROID__)
     447# undef HAVE_DPRINTF
     448# undef HAVE_GETLINE
     449# undef HAVE_STPCPY
     450# undef HAVE_STRCHRNUL
     451# undef HAVE_STRVERSCMP
     452# undef HAVE_UNLOCKED_LINE_OPS
     453# undef HAVE_NET_ETHERNET_H
    381454#endif
    382455
     
    386459 */
    387460
    388 #ifndef HAVE_FDPRINTF
    389 extern int fdprintf(int fd, const char *format, ...);
     461#ifndef HAVE_DPRINTF
     462extern int dprintf(int fd, const char *format, ...);
    390463#endif
    391464
     
    403476#endif
    404477
     478#ifndef HAVE_SIGHANDLER_T
     479typedef void (*sighandler_t)(int);
     480#endif
     481
     482#ifndef HAVE_STPCPY
     483extern char *stpcpy(char *p, const char *to_add) FAST_FUNC;
     484#endif
     485
    405486#ifndef HAVE_STRCASESTR
    406487extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC;
     
    424505#endif
    425506
    426 #endif
     507#ifndef HAVE_GETLINE
     508# include <stdio.h> /* for FILE */
     509# include <sys/types.h> /* size_t */
     510extern ssize_t getline(char **lineptr, size_t *n, FILE *stream) FAST_FUNC;
     511#endif
     512
     513#endif
Note: See TracChangeset for help on using the changeset viewer.