| 1 |
2 |
drasko |
/* 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 |
|
|
|
| 4 |
|
|
The GNU C Library is free software; you can redistribute it and/or
|
| 5 |
|
|
modify it under the terms of the GNU Lesser General Public
|
| 6 |
|
|
License as published by the Free Software Foundation; either
|
| 7 |
|
|
version 2.1 of the License, or (at your option) any later version.
|
| 8 |
|
|
|
| 9 |
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
| 10 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 12 |
|
|
Lesser General Public License for more details.
|
| 13 |
|
|
|
| 14 |
|
|
You should have received a copy of the GNU Lesser General Public
|
| 15 |
|
|
License along with the GNU C Library; if not, write to the Free
|
| 16 |
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
| 17 |
|
|
02111-1307 USA. */
|
| 18 |
|
|
|
| 19 |
|
|
#ifndef _LIBC_INTERNAL_H
|
| 20 |
|
|
#define _LIBC_INTERNAL_H 1
|
| 21 |
|
|
|
| 22 |
|
|
#include <features.h>
|
| 23 |
|
|
|
| 24 |
|
|
#ifdef __UCLIBC_BUILD_RELRO__
|
| 25 |
|
|
# define attribute_relro __attribute__ ((section (".data.rel.ro")))
|
| 26 |
|
|
#else
|
| 27 |
|
|
# define attribute_relro
|
| 28 |
|
|
#endif
|
| 29 |
|
|
|
| 30 |
|
|
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
|
| 31 |
|
|
# define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
|
| 32 |
|
|
#endif
|
| 33 |
|
|
|
| 34 |
|
|
/* Pull in things like __attribute_used__ */
|
| 35 |
|
|
#include <sys/cdefs.h>
|
| 36 |
|
|
|
| 37 |
|
|
/* --- this is added to integrate linuxthreads */
|
| 38 |
|
|
/*#define __USE_UNIX98 1*/
|
| 39 |
|
|
|
| 40 |
|
|
#ifndef __ASSEMBLER__
|
| 41 |
|
|
# ifdef IS_IN_libc
|
| 42 |
|
|
|
| 43 |
|
|
# define __need_size_t
|
| 44 |
|
|
# include <stddef.h>
|
| 45 |
|
|
|
| 46 |
|
|
/* sources are built w/ _GNU_SOURCE, this gets undefined */
|
| 47 |
|
|
#ifdef __USE_GNU
|
| 48 |
|
|
extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
|
| 49 |
|
|
#else
|
| 50 |
|
|
extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
|
| 51 |
|
|
#endif
|
| 52 |
|
|
|
| 53 |
|
|
/* #include <pthread.h> */
|
| 54 |
|
|
# ifndef __UCLIBC_HAS_THREADS__
|
| 55 |
|
|
# define __pthread_mutex_init(mutex, mutexattr) ((void)0)
|
| 56 |
|
|
# define __pthread_mutex_lock(mutex) ((void)0)
|
| 57 |
|
|
# define __pthread_mutex_trylock(mutex) ((void)0)
|
| 58 |
|
|
# define __pthread_mutex_unlock(mutex) ((void)0)
|
| 59 |
|
|
# define _pthread_cleanup_push_defer(mutex) ((void)0)
|
| 60 |
|
|
# define _pthread_cleanup_pop_restore(mutex) ((void)0)
|
| 61 |
|
|
# endif
|
| 62 |
|
|
|
| 63 |
|
|
/* internal access to program name */
|
| 64 |
|
|
extern const char *__uclibc_progname attribute_hidden;
|
| 65 |
|
|
|
| 66 |
|
|
# endif /* IS_IN_libc */
|
| 67 |
|
|
|
| 68 |
|
|
/* #include <alloca.h> */
|
| 69 |
|
|
#include <bits/stackinfo.h>
|
| 70 |
|
|
#if defined(_STACK_GROWS_DOWN)
|
| 71 |
|
|
# define extend_alloca(buf, len, newlen) \
|
| 72 |
|
|
(__typeof (buf)) ({ size_t __newlen = (newlen); \
|
| 73 |
|
|
char *__newbuf = alloca (__newlen); \
|
| 74 |
|
|
if (__newbuf + __newlen == (char *) buf) \
|
| 75 |
|
|
len += __newlen; \
|
| 76 |
|
|
else \
|
| 77 |
|
|
len = __newlen; \
|
| 78 |
|
|
__newbuf; })
|
| 79 |
|
|
#elif defined(_STACK_GROWS_UP)
|
| 80 |
|
|
# define extend_alloca(buf, len, newlen) \
|
| 81 |
|
|
(__typeof (buf)) ({ size_t __newlen = (newlen); \
|
| 82 |
|
|
char *__newbuf = alloca (__newlen); \
|
| 83 |
|
|
char *__buf = (buf); \
|
| 84 |
|
|
if (__buf + __newlen == __newbuf) \
|
| 85 |
|
|
{ \
|
| 86 |
|
|
len += __newlen; \
|
| 87 |
|
|
__newbuf = __buf; \
|
| 88 |
|
|
} \
|
| 89 |
|
|
else \
|
| 90 |
|
|
len = __newlen; \
|
| 91 |
|
|
__newbuf; })
|
| 92 |
|
|
#else
|
| 93 |
|
|
# warning unknown stack
|
| 94 |
|
|
# define extend_alloca(buf, len, newlen) \
|
| 95 |
|
|
alloca (((len) = (newlen)))
|
| 96 |
|
|
#endif
|
| 97 |
|
|
|
| 98 |
|
|
#endif /* __ASSEMBLER__ */
|
| 99 |
|
|
|
| 100 |
|
|
#endif /* _LIBC_INTERNAL_H */
|