libc-internal.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _LIBC_INTERNAL_H
  16. #define _LIBC_INTERNAL_H 1
  17. #include <features.h>
  18. #ifdef __UCLIBC_BUILD_RELRO__
  19. # define attribute_relro __attribute__ ((section (".data.rel.ro")))
  20. #else
  21. # define attribute_relro
  22. #endif
  23. #ifdef __UCLIBC_HAS_TLS__
  24. # define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
  25. #endif
  26. /* Pull in things like __attribute_used__ */
  27. #include <sys/cdefs.h>
  28. /* --- this is added to integrate linuxthreads */
  29. /*#define __USE_UNIX98 1*/
  30. #ifndef __ASSEMBLER__
  31. # ifdef IS_IN_libc
  32. # define __need_size_t
  33. # include <stddef.h>
  34. /* sources are built w/ _GNU_SOURCE, this gets undefined */
  35. #ifdef __USE_GNU
  36. extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
  37. libc_hidden_proto(__xpg_strerror_r)
  38. #else
  39. extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
  40. libc_hidden_proto(__glibc_strerror_r)
  41. #endif
  42. /* #include <pthread.h> */
  43. # ifndef __UCLIBC_HAS_THREADS__
  44. # define __pthread_mutex_init(mutex, mutexattr) ((void)0)
  45. # define __pthread_mutex_lock(mutex) ((void)0)
  46. # define __pthread_mutex_trylock(mutex) ((void)0)
  47. # define __pthread_mutex_unlock(mutex) ((void)0)
  48. # define _pthread_cleanup_push_defer(mutex) ((void)0)
  49. # define _pthread_cleanup_pop_restore(mutex) ((void)0)
  50. # endif
  51. /* internal access to program name */
  52. extern const char *__uclibc_progname attribute_hidden;
  53. # ifdef __UCLIBC_HAS_FORTIFY__
  54. extern void __chk_fail(void) attribute_noreturn;
  55. libc_hidden_proto(__chk_fail)
  56. # endif
  57. # endif /* IS_IN_libc */
  58. #endif /* __ASSEMBLER__ */
  59. #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
  60. /* Some people like to build up uClibc with *-elf toolchains, so
  61. * a little grease here until we drop '#ifdef __linux__' checks
  62. * from our source code.
  63. */
  64. #ifndef __linux__
  65. # define __linux__ 1
  66. #endif
  67. #endif /* _LIBC_INTERNAL_H */