Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/include/platform.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1122 by niro, Sun May 30 11:41:13 2010 UTC revision 1123 by niro, Wed Aug 18 21:56:57 2010 UTC
# Line 16  Line 16 
16  #define HAVE_SETBIT 1  #define HAVE_SETBIT 1
17  #define HAVE_STRCASESTR 1  #define HAVE_STRCASESTR 1
18  #define HAVE_STRCHRNUL 1  #define HAVE_STRCHRNUL 1
19    #define HAVE_STRSEP 1
20  #define HAVE_STRSIGNAL 1  #define HAVE_STRSIGNAL 1
21  #define HAVE_VASPRINTF 1  #define HAVE_VASPRINTF 1
22    
# Line 100  Line 101 
101  # define EXTERNALLY_VISIBLE  # define EXTERNALLY_VISIBLE
102  #endif  #endif
103    
104    /* At 4.4 gcc become much more anal about this, need to use "aliased" types */
105    #if __GNUC_PREREQ(4,4)
106    # define FIX_ALIASING __attribute__((__may_alias__))
107    #else
108    # define FIX_ALIASING
109    #endif
110    
111  /* We use __extension__ in some places to suppress -pedantic warnings  /* We use __extension__ in some places to suppress -pedantic warnings
112     about GCC extensions.  This feature didn't work properly before     about GCC extensions.  This feature didn't work properly before
113     gcc 2.8.  */     gcc 2.8.  */
# Line 161  Line 169 
169  #if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__  #if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__
170  # define BB_BIG_ENDIAN 1  # define BB_BIG_ENDIAN 1
171  # define BB_LITTLE_ENDIAN 0  # define BB_LITTLE_ENDIAN 0
172  #elif __BYTE_ORDER == __BIG_ENDIAN  #elif defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
173  # define BB_BIG_ENDIAN 1  # define BB_BIG_ENDIAN 1
174  # define BB_LITTLE_ENDIAN 0  # define BB_LITTLE_ENDIAN 0
175  #elif __BYTE_ORDER == __LITTLE_ENDIAN  #elif (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__386__)
176  # define BB_BIG_ENDIAN 0  # define BB_BIG_ENDIAN 0
177  # define BB_LITTLE_ENDIAN 1  # define BB_LITTLE_ENDIAN 1
178  #else  #else
# Line 193  Line 201 
201  /* NB: unaligned parameter should be a pointer, aligned one -  /* NB: unaligned parameter should be a pointer, aligned one -
202   * a lvalue. This makes it more likely to not swap them by mistake   * a lvalue. This makes it more likely to not swap them by mistake
203   */   */
204  #if defined(i386) || defined(__x86_64__)  #if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
205  # define move_from_unaligned_int(v, intp) ((v) = *(int*)(intp))  # include <stdint.h>
206  # define move_from_unaligned16(v, u16p) ((v) = *(uint16_t*)(u16p))  typedef int      bb__aliased_int      FIX_ALIASING;
207  # define move_from_unaligned32(v, u32p) ((v) = *(uint32_t*)(u32p))  typedef uint16_t bb__aliased_uint16_t FIX_ALIASING;
208  # define move_to_unaligned32(u32p, v)   (*(uint32_t*)(u32p) = (v))  typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
209    # define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
210    # define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p))
211    # define move_from_unaligned32(v, u32p) ((v) = *(bb__aliased_uint32_t*)(u32p))
212    # define move_to_unaligned16(u16p, v)   (*(bb__aliased_uint16_t*)(u16p) = (v))
213    # define move_to_unaligned32(u32p, v)   (*(bb__aliased_uint32_t*)(u32p) = (v))
214  /* #elif ... - add your favorite arch today! */  /* #elif ... - add your favorite arch today! */
215  #else  #else
216  /* performs reasonably well (gcc usually inlines memcpy here) */  /* performs reasonably well (gcc usually inlines memcpy here) */
217  # define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))  # define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
218  # define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))  # define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
219  # define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))  # define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
220    # define move_to_unaligned16(u16p, v) do { \
221     uint16_t __t = (v); \
222     memcpy((u16p), &__t, 4); \
223    } while (0)
224  # define move_to_unaligned32(u32p, v) do { \  # define move_to_unaligned32(u32p, v) do { \
225   uint32_t __t = (v); \   uint32_t __t = (v); \
226   memcpy((u32p), &__t, 4); \   memcpy((u32p), &__t, 4); \
227  } while (0)  } while (0)
228  #endif  #endif
229    
 /* ---- Networking ------------------------------------------ */  
   
 #ifndef __APPLE__  
 # include <arpa/inet.h>  
 # if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED)  
 typedef int socklen_t;  
 # endif  
 #else  
 # include <netinet/in.h>  
 #endif  
   
230  /* ---- Compiler dependent settings ------------------------- */  /* ---- Compiler dependent settings ------------------------- */
231    
232  #if (defined __digital__ && defined __unix__) \  #if (defined __digital__ && defined __unix__) \
# Line 250  typedef int socklen_t; Line 256  typedef int socklen_t;
256  #if defined __GLIBC__ || defined __UCLIBC__ \  #if defined __GLIBC__ || defined __UCLIBC__ \
257   || defined __dietlibc__ || defined _NEWLIB_VERSION   || defined __dietlibc__ || defined _NEWLIB_VERSION
258  # include <features.h>  # include <features.h>
 # define HAVE_FEATURES_H  
 # include <stdint.h>  
 # define HAVE_STDINT_H  
 #elif !defined __APPLE__  
 /* Largest integral types. */  
 # if BB_BIG_ENDIAN  
 /* Looks BROKEN! */  
 typedef long                intmax_t;  
 typedef unsigned long       uintmax_t;  
 # else  
 __extension__  
 typedef long long           intmax_t;  
 __extension__  
 typedef unsigned long long  uintmax_t;  
 # endif  
259  #endif  #endif
260    
261  /* Size-saving "small" ints (arch-dependent) */  /* Size-saving "small" ints (arch-dependent) */
# Line 363  typedef unsigned smalluint; Line 354  typedef unsigned smalluint;
354  # undef HAVE_SETBIT  # undef HAVE_SETBIT
355  # undef HAVE_STRCASESTR  # undef HAVE_STRCASESTR
356  # undef HAVE_STRCHRNUL  # undef HAVE_STRCHRNUL
357    # undef HAVE_STRSEP
358  # undef HAVE_STRSIGNAL  # undef HAVE_STRSIGNAL
359  # undef HAVE_VASPRINTF  # undef HAVE_VASPRINTF
360  #endif  #endif
# Line 401  extern char *strcasestr(const char *s, c Line 393  extern char *strcasestr(const char *s, c
393  extern char *strchrnul(const char *s, int c) FAST_FUNC;  extern char *strchrnul(const char *s, int c) FAST_FUNC;
394  #endif  #endif
395    
396    #ifndef HAVE_STRSEP
397    extern char *strsep(char **stringp, const char *delim) FAST_FUNC;
398    #endif
399    
400  #ifndef HAVE_STRSIGNAL  #ifndef HAVE_STRSIGNAL
401  /* Not exactly the same: instead of "Stopped" it shows "STOP" etc */  /* Not exactly the same: instead of "Stopped" it shows "STOP" etc */
402  # define strsignal(sig) get_signame(sig)  # define strsignal(sig) get_signame(sig)

Legend:
Removed from v.1122  
changed lines
  Added in v.1123