libc-internal.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_THREADS_NATIVE__
  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. extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
  36. //extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
  37. /* #include <pthread.h> */
  38. # ifndef __UCLIBC_HAS_THREADS__
  39. # define __pthread_mutex_init(mutex, mutexattr) ((void)0)
  40. # define __pthread_mutex_lock(mutex) ((void)0)
  41. # define __pthread_mutex_trylock(mutex) ((void)0)
  42. # define __pthread_mutex_unlock(mutex) ((void)0)
  43. # endif
  44. /* internal access to program name */
  45. extern const char *__uclibc_progname attribute_hidden;
  46. # endif /* IS_IN_libc */
  47. /* #include <alloca.h> */
  48. #include <bits/stackinfo.h>
  49. #if _STACK_GROWS_DOWN
  50. # define extend_alloca(buf, len, newlen) \
  51. (__typeof (buf)) ({ size_t __newlen = (newlen); \
  52. char *__newbuf = alloca (__newlen); \
  53. if (__newbuf + __newlen == (char *) buf) \
  54. len += __newlen; \
  55. else \
  56. len = __newlen; \
  57. __newbuf; })
  58. #elif _STACK_GROWS_UP
  59. # define extend_alloca(buf, len, newlen) \
  60. (__typeof (buf)) ({ size_t __newlen = (newlen); \
  61. char *__newbuf = alloca (__newlen); \
  62. char *__buf = (buf); \
  63. if (__buf + __newlen == __newbuf) \
  64. { \
  65. len += __newlen; \
  66. __newbuf = __buf; \
  67. } \
  68. else \
  69. len = __newlen; \
  70. __newbuf; })
  71. #else
  72. # warning unknown stack
  73. # define extend_alloca(buf, len, newlen) \
  74. alloca (((len) = (newlen)))
  75. #endif
  76. #endif /* __ASSEMBLER__ */
  77. #endif /* _LIBC_INTERNAL_H */