libc-internal.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _LIBC_INTERNAL_H
  15. #define _LIBC_INTERNAL_H 1
  16. #include <features.h>
  17. #ifdef __UCLIBC_BUILD_RELRO__
  18. # define attribute_relro __attribute__ ((section (".data.rel.ro")))
  19. #else
  20. # define attribute_relro
  21. #endif
  22. #ifdef __UCLIBC_HAS_TLS__
  23. # define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
  24. #else
  25. # define attribute_tls_model_ie
  26. # define __thread
  27. #endif
  28. /* Pull in things like __attribute_used__ */
  29. #include <sys/cdefs.h>
  30. /* --- this is added to integrate linuxthreads */
  31. /*#define __USE_UNIX98 1*/
  32. #ifndef __ASSEMBLER__
  33. # ifdef IS_IN_libc
  34. # define __need_size_t
  35. # include <stddef.h>
  36. /* sources are built w/ _GNU_SOURCE, this gets undefined */
  37. #if defined __USE_XOPEN2K && !defined __USE_GNU
  38. extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
  39. libc_hidden_proto(__glibc_strerror_r)
  40. #else
  41. extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
  42. libc_hidden_proto(__xpg_strerror_r)
  43. #endif
  44. /* #include <pthread.h> */
  45. # ifndef __UCLIBC_HAS_THREADS__
  46. # define __pthread_mutex_init(mutex, mutexattr) ((void)0)
  47. # define __pthread_mutex_lock(mutex) ((void)0)
  48. # define __pthread_mutex_trylock(mutex) ((void)0)
  49. # define __pthread_mutex_unlock(mutex) ((void)0)
  50. # define _pthread_cleanup_push_defer(mutex) ((void)0)
  51. # define _pthread_cleanup_pop_restore(mutex) ((void)0)
  52. # endif
  53. /* internal access to program name */
  54. extern const char *__uclibc_progname attribute_hidden;
  55. # ifdef __UCLIBC_HAS_SSP__
  56. extern void __stack_chk_fail(void) attribute_noreturn __cold;
  57. # endif
  58. # endif /* IS_IN_libc */
  59. #endif /* __ASSEMBLER__ */
  60. #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
  61. /* Some people like to build up uClibc with *-elf toolchains, so
  62. * a little grease here until we drop '#ifdef __linux__' checks
  63. * from our source code.
  64. */
  65. #ifndef __linux__
  66. # define __linux__ 1
  67. #endif
  68. #endif /* _LIBC_INTERNAL_H */