diff options
Diffstat (limited to 'libc/stdlib')
-rw-r--r-- | libc/stdlib/abort.c | 14 | ||||
-rw-r--r-- | libc/stdlib/atexit.c | 11 | ||||
-rw-r--r-- | libc/stdlib/ldiv.c | 3 | ||||
-rw-r--r-- | libc/stdlib/lldiv.c | 3 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/free.c | 2 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/mallinfo.c | 2 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/malloc.h | 3 | ||||
-rw-r--r-- | libc/stdlib/malloc/Makefile.in | 2 | ||||
-rw-r--r-- | libc/stdlib/malloc/free.c | 1 | ||||
-rw-r--r-- | libc/stdlib/malloc/heap_debug.c | 4 | ||||
-rw-r--r-- | libc/stdlib/malloc/malloc.c | 1 | ||||
-rw-r--r-- | libc/stdlib/malloc/malloc.h | 2 | ||||
-rw-r--r-- | libc/stdlib/malloc/malloc_debug.c | 4 | ||||
-rw-r--r-- | libc/stdlib/ptsname.c | 4 | ||||
-rw-r--r-- | libc/stdlib/setenv.c | 3 | ||||
-rw-r--r-- | libc/stdlib/stdlib.c | 5 | ||||
-rw-r--r-- | libc/stdlib/system.c | 4 | ||||
-rw-r--r-- | libc/stdlib/unix_grantpt.c | 11 |
18 files changed, 47 insertions, 32 deletions
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index d24d1a94c..47252d1f7 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -64,13 +64,12 @@ Cambridge, MA 02139, USA. */ #define ABORT_INSTRUCTION asm ("hlt") #else #define ABORT_INSTRUCTION -#warning no abort instruction define for your arch +#warning no abort instruction defined for your arch #endif #ifdef __UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT__ -extern void weak_function _stdio_term(void); +extern void weak_function _stdio_term(void) attribute_hidden; #endif -extern void _exit __P((int __status)) __attribute__ ((__noreturn__)); static int been_there_done_that = 0; /* Be prepared in case multiple threads try to abort() */ @@ -81,10 +80,12 @@ static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; #define LOCK __pthread_mutex_lock(&mylock) #define UNLOCK __pthread_mutex_unlock(&mylock) - extern int __raise (int __sig) __THROW attribute_hidden; + /* Cause an abnormal program termination with core-dump */ -void abort(void) +#undef __abort +#undef abort +void attribute_hidden __abort(void) { sigset_t sigset; @@ -140,7 +141,7 @@ abort_it: /* Still here? Try to at least exit */ if (been_there_done_that == 3) { been_there_done_that++; - _exit(127); + _exit_internal(127); } /* Still here? We're screwed. Sleepy time. Good night. */ @@ -149,3 +150,4 @@ abort_it: ABORT_INSTRUCTION; } } +strong_alias(__abort,abort) diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index fcf85391a..f6944edc5 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -121,7 +121,7 @@ int old_atexit(aefuncp func) &__dso_handle == NULL ? NULL : __dso_handle); } #ifndef L_atexit -weak_alias(old_atexit,atexit); +weak_alias(old_atexit,atexit) #endif #endif @@ -305,7 +305,7 @@ void __exit_handler(int status) #endif #ifdef L_exit -extern void weak_function _stdio_term(void); +extern void weak_function _stdio_term(void) attribute_hidden; void (*__exit_cleanup) (int) = 0; #ifdef __UCLIBC_HAS_THREADS__ pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; @@ -320,7 +320,9 @@ extern void (*__rtld_fini)(void); /* * Normal program termination */ -void exit(int rv) +#undef exit +#undef __exit +void attribute_hidden __exit(int rv) { /* Perform exit-specific cleanup (atexit and on_exit) */ LOCK; @@ -343,6 +345,7 @@ void exit(int rv) if (_stdio_term) _stdio_term(); - _exit(rv); + _exit_internal(rv); } +strong_alias(__exit,exit) #endif diff --git a/libc/stdlib/ldiv.c b/libc/stdlib/ldiv.c index c66470fb2..f8e789a92 100644 --- a/libc/stdlib/ldiv.c +++ b/libc/stdlib/ldiv.c @@ -57,6 +57,5 @@ ldiv (long int numer, long int denom) #if __WORDSIZE == 64 #undef imaxdiv -weak_alias (ldiv, imaxdiv); +weak_alias (ldiv, imaxdiv) #endif - diff --git a/libc/stdlib/lldiv.c b/libc/stdlib/lldiv.c index 2b382db6c..56ccb2612 100644 --- a/libc/stdlib/lldiv.c +++ b/libc/stdlib/lldiv.c @@ -58,6 +58,5 @@ lldiv (long long int numer, long long int denom) #if __WORDSIZE != 64 #undef imaxdiv -weak_alias (lldiv, imaxdiv); +weak_alias (lldiv, imaxdiv) #endif - diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c index aa8edec97..1b294d706 100644 --- a/libc/stdlib/malloc-standard/free.c +++ b/libc/stdlib/malloc-standard/free.c @@ -169,7 +169,7 @@ static void malloc_init_state(mstate av) malloc anyway, it turns out to be the perfect place to trigger initialization code. */ -void __malloc_consolidate(mstate av) +void attribute_hidden __malloc_consolidate(mstate av) { mfastbinptr* fb; /* current fastbin being consolidated */ mfastbinptr* maxfb; /* last fastbin (for loop control) */ diff --git a/libc/stdlib/malloc-standard/mallinfo.c b/libc/stdlib/malloc-standard/mallinfo.c index f6c2a9104..029ceda1f 100644 --- a/libc/stdlib/malloc-standard/mallinfo.c +++ b/libc/stdlib/malloc-standard/mallinfo.c @@ -22,7 +22,7 @@ struct mallinfo attribute_hidden __mallinfo(void) { mstate av; struct mallinfo mi; - int i; + unsigned int i; mbinptr b; mchunkptr p; size_t avail; diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h index 338edeabf..68d38cb3d 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -16,6 +16,7 @@ #define mmap __mmap #define sysconf __sysconf +#define sbrk __sbrk #include <features.h> #include <stddef.h> @@ -929,7 +930,7 @@ extern struct malloc_state __malloc_state; /* never directly referenced */ #define get_malloc_state() (&(__malloc_state)) /* External internal utilities operating on mstates */ -void __malloc_consolidate(mstate); +void __malloc_consolidate(mstate) attribute_hidden; /* Debugging support */ diff --git a/libc/stdlib/malloc/Makefile.in b/libc/stdlib/malloc/Makefile.in index cf61011a4..55831c379 100644 --- a/libc/stdlib/malloc/Makefile.in +++ b/libc/stdlib/malloc/Makefile.in @@ -37,4 +37,4 @@ stdlib_malloc_objclean: malloc.o free.o realloc.o memalign.o: malloc.h # Depend on uClinux_config.h to cache changes in __UCLIBC_MALLOC_DEBUGGING__ -$(STDLIB_MALLOC_OBJ): heap.h $(top_builddir)include/bits/uClibc_config.h +$(STDLIB_MALLOC_OBJ): $(STDLIB_MALLOC_DIR)/heap.h $(top_builddir)include/bits/uClibc_config.h diff --git a/libc/stdlib/malloc/free.c b/libc/stdlib/malloc/free.c index eb35e78ee..81ec38cd9 100644 --- a/libc/stdlib/malloc/free.c +++ b/libc/stdlib/malloc/free.c @@ -12,6 +12,7 @@ */ #define munmap __munmap +#define sbrk __sbrk #include <stdlib.h> #include <unistd.h> diff --git a/libc/stdlib/malloc/heap_debug.c b/libc/stdlib/malloc/heap_debug.c index 4804ba9ee..7dab95627 100644 --- a/libc/stdlib/malloc/heap_debug.c +++ b/libc/stdlib/malloc/heap_debug.c @@ -80,13 +80,13 @@ __heap_check_failure (struct heap *heap, struct heap_free_area *fa, vfprintf (stderr, fmt, val); va_end (val); - putc ('\n', stderr); + __putc ('\n', stderr); __malloc_debug_set_indent (0); __malloc_debug_printf (1, "heap dump:"); __heap_dump_freelist (heap); - exit (22); + __exit (22); } /* Do some consistency checks on HEAP. If they fail, output an error diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c index 44eb2c66f..6bc8d8773 100644 --- a/libc/stdlib/malloc/malloc.c +++ b/libc/stdlib/malloc/malloc.c @@ -12,6 +12,7 @@ */ #define mmap __mmap +#define sbrk __sbrk #include <stdlib.h> #include <unistd.h> diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 08ebfdf5b..707cad13d 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -79,6 +79,8 @@ extern struct heap __malloc_mmb_heap; to stderr, when the variable __malloc_mmb_debug is set to true. */ #ifdef MALLOC_MMB_DEBUGGING # include <stdio.h> +extern int __putc(int c, FILE *stream) attribute_hidden; + extern int __malloc_mmb_debug; # define MALLOC_MMB_DEBUG(indent, fmt, args...) \ (__malloc_mmb_debug ? __malloc_debug_printf (indent, fmt , ##args) : 0) diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c index e8711ff77..abe5546ca 100644 --- a/libc/stdlib/malloc/malloc_debug.c +++ b/libc/stdlib/malloc/malloc_debug.c @@ -42,7 +42,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...) while (spaces > 0) { - putc (' ', stderr); + __putc (' ', stderr); spaces--; } @@ -50,7 +50,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...) vfprintf (stderr, fmt, val); va_end (val); - putc ('\n', stderr); + __putc ('\n', stderr); __malloc_debug_indent (indent); } diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index c56f18a91..8e18e3989 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -136,7 +136,7 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) return ERANGE; } - if (fstat (fd, &st) < 0) + if (__fstat (fd, &st) < 0) return errno; /* Check if FD really is a master pseudo terminal. */ @@ -165,7 +165,7 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) p[2] = '\0'; } - if (stat(buf, &st) < 0) + if (__stat(buf, &st) < 0) return errno; /* Check if the name we're about to return really corresponds to a diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index 07af88465..413ebed9e 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -132,10 +132,11 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, return 0; } -int setenv (const char *name, const char *value, int replace) +int attribute_hidden __setenv (const char *name, const char *value, int replace) { return __add_to_environ (name, value, NULL, replace); } +strong_alias(__setenv,setenv) int attribute_hidden __unsetenv (const char *name) { diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 3b7d37ccb..8203881a4 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -724,7 +724,7 @@ unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wc /* void _Exit(int status) */ /* { */ -/* _exit(status); */ +/* _exit_internal(status); */ /* } */ /* #endif */ @@ -868,7 +868,7 @@ void ssort (void *base, /**********************************************************************/ #ifdef L__stdlib_mb_cur_max -size_t _stdlib_mb_cur_max(void) +size_t attribute_hidden _stdlib_mb_cur_max_internal(void) { #ifdef __CTYPE_HAS_UTF_8_LOCALES return __UCLIBC_CURLOCALE_DATA.mb_cur_max; @@ -881,6 +881,7 @@ size_t _stdlib_mb_cur_max(void) return 1; #endif } +strong_alias(_stdlib_mb_cur_max_internal,_stdlib_mb_cur_max) #endif /**********************************************************************/ diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index 616d2dda6..a537156fd 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -1,6 +1,8 @@ #define wait4 __wait4 #define execl __execl #define signal __signal +#define vfork __vfork +#define fork __fork #include <stdio.h> #include <stddef.h> @@ -38,7 +40,7 @@ int __libc_system(char *command) signal(SIGCHLD, SIG_DFL); execl("/bin/sh", "sh", "-c", command, (char *) 0); - _exit(127); + _exit_internal(127); } /* Signals are not absolutly guarenteed with vfork */ signal(SIGQUIT, SIG_IGN); diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index e087d18c8..0e7d50a99 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -23,6 +23,9 @@ #define setrlimit __setrlimit #define waitpid __waitpid #define dup2 __dup2 +#define chmod __chmod +#define vfork __vfork +#define fork __fork #include <assert.h> #include <errno.h> @@ -41,7 +44,7 @@ /* uClinux-2.0 has vfork, but Linux 2.0 doesn't */ #include <sys/syscall.h> #if ! defined __NR_vfork -#define vfork fork +#define vfork fork #endif extern int __ptsname_r (int fd, char *buf, size_t buflen) attribute_hidden; @@ -119,7 +122,7 @@ grantpt (int fd) if (pts_name (fd, &buf, sizeof (_buf))) return -1; - if (stat(buf, &st) < 0) + if (__stat(buf, &st) < 0) goto cleanup; /* Make sure that we own the device. */ @@ -165,10 +168,10 @@ grantpt (int fd) /* We pase the master pseudo terminal as file descriptor PTY_FILENO. */ if (fd != PTY_FILENO) if (dup2 (fd, PTY_FILENO) < 0) - _exit (FAIL_EBADF); + _exit_internal (FAIL_EBADF); execle (_PATH_PT_CHOWN, _PATH_PT_CHOWN, NULL, NULL); - _exit (FAIL_EXEC); + _exit_internal (FAIL_EXEC); } else { |