Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

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

    r3232 r3621  
    7676# define UNUSED_PARAM_RESULT
    7777#endif
     78
     79/* used by unit test machinery to run registration functions before calling main() */
     80#define INIT_FUNC __attribute__ ((constructor))
    7881
    7982/* -fwhole-program makes all symbols local. The attribute externally_visible
     
    209212typedef uint16_t bb__aliased_uint16_t FIX_ALIASING;
    210213typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
     214typedef uint64_t bb__aliased_uint64_t FIX_ALIASING;
    211215
    212216/* NB: unaligned parameter should be a pointer, aligned one -
     
    214218 */
    215219#if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
     220# define BB_UNALIGNED_MEMACCESS_OK 1
    216221# define move_from_unaligned_int(v, intp)  ((v) = *(bb__aliased_int*)(intp))
    217222# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))
     
    222227/* #elif ... - add your favorite arch today! */
    223228#else
     229# define BB_UNALIGNED_MEMACCESS_OK 0
    224230/* performs reasonably well (gcc usually inlines memcpy here) */
    225231# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
     
    264270#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
    265271
     272#ifdef __UCLIBC__
     273# define UCLIBC_VERSION KERNEL_VERSION(__UCLIBC_MAJOR__, __UCLIBC_MINOR__, __UCLIBC_SUBLEVEL__)
     274#else
     275# define UCLIBC_VERSION 0
     276#endif
     277
    266278
    267279/* ---- Miscellaneous --------------------------------------- */
     
    306318 */
    307319#if ENABLE_NOMMU || \
    308     (defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \
    309     __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__)
     320    (defined __UCLIBC__ && \
     321     UCLIBC_VERSION > KERNEL_VERSION(0, 9, 28) && \
     322     !defined __ARCH_USE_MMU__)
    310323# define BB_MMU 0
    311324# define USE_FOR_NOMMU(...) __VA_ARGS__
     
    356369#define HAVE_MEMRCHR 1
    357370#define HAVE_MKDTEMP 1
     371#define HAVE_TTYNAME_R 1
    358372#define HAVE_PTSNAME_R 1
    359373#define HAVE_SETBIT 1
    360374#define HAVE_SIGHANDLER_T 1
    361375#define HAVE_STPCPY 1
     376#define HAVE_MEMPCPY 1
    362377#define HAVE_STRCASESTR 1
    363378#define HAVE_STRCHRNUL 1
     
    366381#define HAVE_STRVERSCMP 1
    367382#define HAVE_VASPRINTF 1
     383#define HAVE_USLEEP 1
    368384#define HAVE_UNLOCKED_STDIO 1
    369385#define HAVE_UNLOCKED_LINE_OPS 1
     
    374390#define HAVE_SYS_STATFS_H 1
    375391
    376 #if defined(__UCLIBC_MAJOR__)
    377 # if __UCLIBC_MAJOR__ == 0 \
    378   && (   __UCLIBC_MINOR__ < 9 \
    379      || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 32) \
    380      )
     392#if defined(__UCLIBC__)
     393# if UCLIBC_VERSION < KERNEL_VERSION(0, 9, 32)
    381394#  undef HAVE_STRVERSCMP
    382395# endif
    383 #endif
    384 
    385 #if defined(__dietlibc__)
    386 # undef HAVE_STRCHRNUL
     396# if UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30)
     397#  ifndef __UCLIBC_SUSV3_LEGACY__
     398#   undef HAVE_USLEEP
     399#  endif
     400# endif
    387401#endif
    388402
     
    417431#if (defined __digital__ && defined __unix__) \
    418432 || defined __APPLE__ \
    419  || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
     433 || defined __OpenBSD__ || defined __NetBSD__
    420434# undef HAVE_CLEARENV
    421435# undef HAVE_FDATASYNC
     
    432446#endif
    433447
     448#if defined(__dietlibc__)
     449# undef HAVE_STRCHRNUL
     450#endif
     451
     452#if defined(__APPLE__)
     453# undef HAVE_STRCHRNUL
     454#endif
     455
    434456#if defined(__FreeBSD__)
    435 # undef HAVE_STRCHRNUL
     457/* users say mempcpy is not present in FreeBSD 9.x */
     458# undef HAVE_MEMPCPY
     459# undef HAVE_CLEARENV
     460# undef HAVE_FDATASYNC
     461# undef HAVE_MNTENT_H
     462# undef HAVE_PTSNAME_R
     463# undef HAVE_SYS_STATFS_H
     464# undef HAVE_SIGHANDLER_T
     465# undef HAVE_STRVERSCMP
     466# undef HAVE_XTABS
     467# undef HAVE_UNLOCKED_LINE_OPS
     468# include <osreldate.h>
     469# if __FreeBSD_version < 1000029
     470#  undef HAVE_STRCHRNUL /* FreeBSD added strchrnul() between 1000028 and 1000029 */
     471# endif
    436472#endif
    437473
     
    445481
    446482#if defined(ANDROID) || defined(__ANDROID__)
    447 # undef HAVE_DPRINTF
    448 # undef HAVE_GETLINE
    449 # undef HAVE_STPCPY
     483# if __ANDROID_API__ < 8
     484   /* ANDROID < 8 has no [f]dprintf at all */
     485#  undef HAVE_DPRINTF
     486# elif __ANDROID_API__ < 21
     487   /* ANDROID < 21 has fdprintf */
     488#  define dprintf fdprintf
     489# else
     490   /* ANDROID >= 21 has standard dprintf */
     491# endif
     492# if __ANDROID_API__ < 21
     493#  undef HAVE_TTYNAME_R
     494#  undef HAVE_GETLINE
     495#  undef HAVE_STPCPY
     496# endif
     497# undef HAVE_MEMPCPY
    450498# undef HAVE_STRCHRNUL
    451499# undef HAVE_STRVERSCMP
     
    471519#endif
    472520
     521#ifndef HAVE_TTYNAME_R
     522#define ttyname_r bb_ttyname_r
     523extern int ttyname_r(int fd, char *buf, size_t buflen);
     524#endif
     525
    473526#ifndef HAVE_SETBIT
    474527# define setbit(a, b)  ((a)[(b) >> 3] |= 1 << ((b) & 7))
     
    484537#endif
    485538
     539#ifndef HAVE_MEMPCPY
     540#include <string.h>
     541/* In case we are wrong about !HAVE_MEMPCPY, and toolchain _does_ have
     542 * mempcpy(), avoid colliding with it:
     543 */
     544#define mempcpy bb__mempcpy
     545static ALWAYS_INLINE void *mempcpy(void *dest, const void *src, size_t len)
     546{
     547    return memcpy(dest, src, len) + len;
     548}
     549#endif
     550
    486551#ifndef HAVE_STRCASESTR
    487552extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC;
     
    499564/* Not exactly the same: instead of "Stopped" it shows "STOP" etc */
    500565# define strsignal(sig) get_signame(sig)
     566#endif
     567
     568#ifndef HAVE_USLEEP
     569extern int usleep(unsigned) FAST_FUNC;
    501570#endif
    502571
Note: See TracChangeset for help on using the changeset viewer.