Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/include/platform.h
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/include/platform.h
r3232 r3621 76 76 # define UNUSED_PARAM_RESULT 77 77 #endif 78 79 /* used by unit test machinery to run registration functions before calling main() */ 80 #define INIT_FUNC __attribute__ ((constructor)) 78 81 79 82 /* -fwhole-program makes all symbols local. The attribute externally_visible … … 209 212 typedef uint16_t bb__aliased_uint16_t FIX_ALIASING; 210 213 typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; 214 typedef uint64_t bb__aliased_uint64_t FIX_ALIASING; 211 215 212 216 /* NB: unaligned parameter should be a pointer, aligned one - … … 214 218 */ 215 219 #if defined(i386) || defined(__x86_64__) || defined(__powerpc__) 220 # define BB_UNALIGNED_MEMACCESS_OK 1 216 221 # define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp)) 217 222 # define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp)) … … 222 227 /* #elif ... - add your favorite arch today! */ 223 228 #else 229 # define BB_UNALIGNED_MEMACCESS_OK 0 224 230 /* performs reasonably well (gcc usually inlines memcpy here) */ 225 231 # define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int))) … … 264 270 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 265 271 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 266 278 267 279 /* ---- Miscellaneous --------------------------------------- */ … … 306 318 */ 307 319 #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__) 310 323 # define BB_MMU 0 311 324 # define USE_FOR_NOMMU(...) __VA_ARGS__ … … 356 369 #define HAVE_MEMRCHR 1 357 370 #define HAVE_MKDTEMP 1 371 #define HAVE_TTYNAME_R 1 358 372 #define HAVE_PTSNAME_R 1 359 373 #define HAVE_SETBIT 1 360 374 #define HAVE_SIGHANDLER_T 1 361 375 #define HAVE_STPCPY 1 376 #define HAVE_MEMPCPY 1 362 377 #define HAVE_STRCASESTR 1 363 378 #define HAVE_STRCHRNUL 1 … … 366 381 #define HAVE_STRVERSCMP 1 367 382 #define HAVE_VASPRINTF 1 383 #define HAVE_USLEEP 1 368 384 #define HAVE_UNLOCKED_STDIO 1 369 385 #define HAVE_UNLOCKED_LINE_OPS 1 … … 374 390 #define HAVE_SYS_STATFS_H 1 375 391 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) 381 394 # undef HAVE_STRVERSCMP 382 395 # 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 387 401 #endif 388 402 … … 417 431 #if (defined __digital__ && defined __unix__) \ 418 432 || defined __APPLE__ \ 419 || defined __ FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__433 || defined __OpenBSD__ || defined __NetBSD__ 420 434 # undef HAVE_CLEARENV 421 435 # undef HAVE_FDATASYNC … … 432 446 #endif 433 447 448 #if defined(__dietlibc__) 449 # undef HAVE_STRCHRNUL 450 #endif 451 452 #if defined(__APPLE__) 453 # undef HAVE_STRCHRNUL 454 #endif 455 434 456 #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 436 472 #endif 437 473 … … 445 481 446 482 #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 450 498 # undef HAVE_STRCHRNUL 451 499 # undef HAVE_STRVERSCMP … … 471 519 #endif 472 520 521 #ifndef HAVE_TTYNAME_R 522 #define ttyname_r bb_ttyname_r 523 extern int ttyname_r(int fd, char *buf, size_t buflen); 524 #endif 525 473 526 #ifndef HAVE_SETBIT 474 527 # define setbit(a, b) ((a)[(b) >> 3] |= 1 << ((b) & 7)) … … 484 537 #endif 485 538 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 545 static ALWAYS_INLINE void *mempcpy(void *dest, const void *src, size_t len) 546 { 547 return memcpy(dest, src, len) + len; 548 } 549 #endif 550 486 551 #ifndef HAVE_STRCASESTR 487 552 extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC; … … 499 564 /* Not exactly the same: instead of "Stopped" it shows "STOP" etc */ 500 565 # define strsignal(sig) get_signame(sig) 566 #endif 567 568 #ifndef HAVE_USLEEP 569 extern int usleep(unsigned) FAST_FUNC; 501 570 #endif 502 571
Note:
See TracChangeset
for help on using the changeset viewer.