summaryrefslogtreecommitdiffstats
path: root/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/abort.c9
-rw-r--r--libc/stdlib/atexit.c9
-rw-r--r--libc/stdlib/drand48.c2
-rw-r--r--libc/stdlib/drand48_r.c2
-rw-r--r--libc/stdlib/erand48.c1
-rw-r--r--libc/stdlib/erand48_r.c7
-rw-r--r--libc/stdlib/getenv.c3
-rw-r--r--libc/stdlib/jrand48.c2
-rw-r--r--libc/stdlib/jrand48_r.c6
-rw-r--r--libc/stdlib/lrand48.c2
-rw-r--r--libc/stdlib/lrand48_r.c5
-rw-r--r--libc/stdlib/malloc-simple/alloc.c11
-rw-r--r--libc/stdlib/malloc-standard/free.c2
-rw-r--r--libc/stdlib/malloc-standard/malloc.h9
-rw-r--r--libc/stdlib/malloc/free.c2
-rw-r--r--libc/stdlib/malloc/heap.h10
-rw-r--r--libc/stdlib/malloc/malloc_debug.c2
-rw-r--r--libc/stdlib/mrand48.c2
-rw-r--r--libc/stdlib/mrand48_r.c2
-rw-r--r--libc/stdlib/nrand48.c2
-rw-r--r--libc/stdlib/nrand48_r.c6
-rw-r--r--libc/stdlib/ptsname.c2
-rw-r--r--libc/stdlib/random.c7
-rw-r--r--libc/stdlib/random_r.c3
-rw-r--r--libc/stdlib/setenv.c9
-rw-r--r--libc/stdlib/srand48.c2
-rw-r--r--libc/stdlib/srand48_r.c5
-rw-r--r--libc/stdlib/stdlib.c3
-rw-r--r--libc/stdlib/system.c3
-rw-r--r--libc/stdlib/unix_grantpt.c2
-rw-r--r--libc/stdlib/valloc.c2
31 files changed, 69 insertions, 65 deletions
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c
index 07e4a208c..83a052abe 100644
--- a/libc/stdlib/abort.c
+++ b/libc/stdlib/abort.c
@@ -18,6 +18,8 @@ Cambridge, MA 02139, USA. */
/* Hacked up for uClibc by Erik Andersen */
+#define sigaction __sigaction_internal
+
#define _GNU_SOURCE
#include <features.h>
#include <signal.h>
@@ -73,12 +75,9 @@ static int been_there_done_that = 0;
#ifdef __UCLIBC_HAS_THREADS__
# include <pthread.h>
static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-# define LOCK __pthread_mutex_lock(&mylock)
-# define UNLOCK __pthread_mutex_unlock(&mylock)
-#else
-# define LOCK
-# define UNLOCK
#endif
+#define LOCK __pthread_mutex_lock(&mylock)
+#define UNLOCK __pthread_mutex_unlock(&mylock)
extern int __raise (int __sig) __THROW attribute_hidden;
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index a01fb29e2..fcf85391a 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -45,14 +45,11 @@
#include <atomic.h>
#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
+# include <pthread.h>
extern pthread_mutex_t mylock;
-# define LOCK __pthread_mutex_lock(&mylock)
-# define UNLOCK __pthread_mutex_unlock(&mylock);
-#else
-# define LOCK
-# define UNLOCK
#endif
+#define LOCK __pthread_mutex_lock(&mylock)
+#define UNLOCK __pthread_mutex_unlock(&mylock)
typedef void (*aefuncp) (void); /* atexit function pointer */
diff --git a/libc/stdlib/drand48.c b/libc/stdlib/drand48.c
index d18ff3f08..fc66816c1 100644
--- a/libc/stdlib/drand48.c
+++ b/libc/stdlib/drand48.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define erand48_r __erand48_r
+
#include <stdlib.h>
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
diff --git a/libc/stdlib/drand48_r.c b/libc/stdlib/drand48_r.c
index b6c055c1f..14235e6e0 100644
--- a/libc/stdlib/drand48_r.c
+++ b/libc/stdlib/drand48_r.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define erand48_r __erand48_r
+
#include <errno.h>
#include <math.h>
#include <stdlib.h>
diff --git a/libc/stdlib/erand48.c b/libc/stdlib/erand48.c
index 6d4c72683..96a8ad115 100644
--- a/libc/stdlib/erand48.c
+++ b/libc/stdlib/erand48.c
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define erand48_r __erand48_r
#include <stdlib.h>
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
diff --git a/libc/stdlib/erand48_r.c b/libc/stdlib/erand48_r.c
index 159eb83a6..0a69266a7 100644
--- a/libc/stdlib/erand48_r.c
+++ b/libc/stdlib/erand48_r.c
@@ -24,11 +24,7 @@
extern int __drand48_iterate(unsigned short xsubi[3],
struct drand48_data *buffer) attribute_hidden;
-
-int erand48_r (xsubi, buffer, result)
- unsigned short int xsubi[3];
- struct drand48_data *buffer;
- double *result;
+int attribute_hidden __erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result)
{
union ieee754_double temp;
@@ -49,3 +45,4 @@ int erand48_r (xsubi, buffer, result)
return 0;
}
+strong_alias(__erand48_r,erand48_r)
diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c
index 9dfc0d132..6cbdc3e65 100644
--- a/libc/stdlib/getenv.c
+++ b/libc/stdlib/getenv.c
@@ -22,7 +22,7 @@
/* IEEE Std 1003.1-2001 says getenv need not be thread safe, so
* don't bother locking access to __environ */
-char *getenv(const char *var)
+char attribute_hidden *__getenv(const char *var)
{
int len;
char **ep;
@@ -39,3 +39,4 @@ char *getenv(const char *var)
return NULL;
}
+strong_alias(__getenv,getenv)
diff --git a/libc/stdlib/jrand48.c b/libc/stdlib/jrand48.c
index 1106f1f9f..44b32487f 100644
--- a/libc/stdlib/jrand48.c
+++ b/libc/stdlib/jrand48.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define jrand48_r __jrand48_r
+
#include <stdlib.h>
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
diff --git a/libc/stdlib/jrand48_r.c b/libc/stdlib/jrand48_r.c
index d8c37cdbc..a21bda080 100644
--- a/libc/stdlib/jrand48_r.c
+++ b/libc/stdlib/jrand48_r.c
@@ -22,10 +22,7 @@
extern int __drand48_iterate(unsigned short xsubi[3],
struct drand48_data *buffer) attribute_hidden;
-int jrand48_r (xsubi, buffer, result)
- unsigned short int xsubi[3];
- struct drand48_data *buffer;
- long int *result;
+int attribute_hidden __jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result)
{
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
@@ -36,3 +33,4 @@ int jrand48_r (xsubi, buffer, result)
return 0;
}
+strong_alias(__jrand48_r,jrand48_r)
diff --git a/libc/stdlib/lrand48.c b/libc/stdlib/lrand48.c
index c6396c047..88301d70f 100644
--- a/libc/stdlib/lrand48.c
+++ b/libc/stdlib/lrand48.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define nrand48_r __nrand48_r
+
#include <stdlib.h>
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
diff --git a/libc/stdlib/lrand48_r.c b/libc/stdlib/lrand48_r.c
index c2851efd7..0ff1ef25e 100644
--- a/libc/stdlib/lrand48_r.c
+++ b/libc/stdlib/lrand48_r.c
@@ -17,9 +17,11 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define nrand48_r __nrand48_r
+
#include <stdlib.h>
-int lrand48_r (struct drand48_data *buffer, long int *result)
+int attribute_hidden __lrand48_r (struct drand48_data *buffer, long int *result)
{
/* Be generous for the arguments, detect some errors. */
if (buffer == NULL)
@@ -27,3 +29,4 @@ int lrand48_r (struct drand48_data *buffer, long int *result)
return nrand48_r (buffer->__x, buffer, result);
}
+strong_alias(__lrand48_r,lrand48_r)
diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c
index 7f0a91f0b..d20768738 100644
--- a/libc/stdlib/malloc-simple/alloc.c
+++ b/libc/stdlib/malloc-simple/alloc.c
@@ -6,6 +6,8 @@
* Parts of the memalign code were stolen from malloc-930716.
*/
+#define munmap __munmap
+
#define _GNU_SOURCE
#include <features.h>
#include <unistd.h>
@@ -109,14 +111,11 @@ void free(void *ptr)
#ifdef L_memalign
#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
+# include <pthread.h>
pthread_mutex_t __malloc_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-# define LOCK __pthread_mutex_lock(&__malloc_lock)
-# define UNLOCK __pthread_mutex_unlock(&__malloc_lock);
-#else
-# define LOCK
-# define UNLOCK
#endif
+#define LOCK __pthread_mutex_lock(&__malloc_lock)
+#define UNLOCK __pthread_mutex_unlock(&__malloc_lock)
/* List of blocks allocated with memalign or valloc */
struct alignlist
diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c
index 94e1d65b1..aa8edec97 100644
--- a/libc/stdlib/malloc-standard/free.c
+++ b/libc/stdlib/malloc-standard/free.c
@@ -14,6 +14,8 @@
Hacked up for uClibc by Erik Andersen <andersen@codepoet.org>
*/
+#define munmap __munmap
+
#include "malloc.h"
diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h
index dbac0c9d2..0e8aed363 100644
--- a/libc/stdlib/malloc-standard/malloc.h
+++ b/libc/stdlib/malloc-standard/malloc.h
@@ -26,14 +26,11 @@
#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
+# include <pthread.h>
extern pthread_mutex_t __malloc_lock;
-# define LOCK __pthread_mutex_lock(&__malloc_lock)
-# define UNLOCK __pthread_mutex_unlock(&__malloc_lock);
-#else
-# define LOCK
-# define UNLOCK
#endif
+#define LOCK __pthread_mutex_lock(&__malloc_lock)
+#define UNLOCK __pthread_mutex_unlock(&__malloc_lock)
diff --git a/libc/stdlib/malloc/free.c b/libc/stdlib/malloc/free.c
index 88684e6df..eb35e78ee 100644
--- a/libc/stdlib/malloc/free.c
+++ b/libc/stdlib/malloc/free.c
@@ -11,6 +11,8 @@
* Written by Miles Bader <miles@gnu.org>
*/
+#define munmap __munmap
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h
index 0210d9098..ab1a73896 100644
--- a/libc/stdlib/malloc/heap.h
+++ b/libc/stdlib/malloc/heap.h
@@ -135,14 +135,8 @@ extern void __heap_dump (struct heap *heap, const char *str);
extern void __heap_check (struct heap *heap, const char *str);
-#ifdef HEAP_USE_LOCKING
-# define __heap_lock(heap) __pthread_mutex_lock (&(heap)->lock)
-# define __heap_unlock(heap) __pthread_mutex_unlock (&(heap)->lock)
-#else /* !__UCLIBC_HAS_THREADS__ */
-/* Without threads, mutex operations are a nop. */
-# define __heap_lock(heap) (void)0
-# define __heap_unlock(heap) (void)0
-#endif /* HEAP_USE_LOCKING */
+#define __heap_lock(heap) __pthread_mutex_lock (&(heap)->lock)
+#define __heap_unlock(heap) __pthread_mutex_unlock (&(heap)->lock)
/* Delete the free-area FA from HEAP. */
diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c
index d231fa7b6..b93b1eac6 100644
--- a/libc/stdlib/malloc/malloc_debug.c
+++ b/libc/stdlib/malloc/malloc_debug.c
@@ -55,7 +55,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...)
void
__malloc_debug_init (void)
{
- char *ev = getenv ("MALLOC_DEBUG");
+ char *ev = __getenv ("MALLOC_DEBUG");
if (ev)
{
int val = atoi (ev);
diff --git a/libc/stdlib/mrand48.c b/libc/stdlib/mrand48.c
index a732603e5..e9d5353ad 100644
--- a/libc/stdlib/mrand48.c
+++ b/libc/stdlib/mrand48.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define jrand48_r __jrand48_r
+
#include <stdlib.h>
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
diff --git a/libc/stdlib/mrand48_r.c b/libc/stdlib/mrand48_r.c
index 74351a059..f79e5f887 100644
--- a/libc/stdlib/mrand48_r.c
+++ b/libc/stdlib/mrand48_r.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define jrand48_r __jrand48_r
+
#include <stdlib.h>
int mrand48_r (struct drand48_data *buffer, long int *result)
diff --git a/libc/stdlib/nrand48.c b/libc/stdlib/nrand48.c
index 585bfe7fd..6cdf4ebad 100644
--- a/libc/stdlib/nrand48.c
+++ b/libc/stdlib/nrand48.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define nrand48_r __nrand48_r
+
#include <stdlib.h>
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
diff --git a/libc/stdlib/nrand48_r.c b/libc/stdlib/nrand48_r.c
index 89f098e75..f72c07030 100644
--- a/libc/stdlib/nrand48_r.c
+++ b/libc/stdlib/nrand48_r.c
@@ -22,10 +22,7 @@
extern int __drand48_iterate(unsigned short xsubi[3],
struct drand48_data *buffer) attribute_hidden;
-int nrand48_r (xsubi, buffer, result)
- unsigned short int xsubi[3];
- struct drand48_data *buffer;
- long int *result;
+int attribute_hidden __nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result)
{
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
@@ -39,3 +36,4 @@ int nrand48_r (xsubi, buffer, result)
return 0;
}
+strong_alias(__nrand48_r,nrand48_r)
diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c
index 539cbcae2..d4e99a035 100644
--- a/libc/stdlib/ptsname.c
+++ b/libc/stdlib/ptsname.c
@@ -17,8 +17,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define _uintmaxtostr __libc__uintmaxtostr
-
#define _ISOC99_SOURCE
#include <stdio.h>
#include <errno.h>
diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c
index 3ffa50690..d40420740 100644
--- a/libc/stdlib/random.c
+++ b/libc/stdlib/random.c
@@ -24,21 +24,20 @@
#define random_r __random_r
#define srandom_r __srandom_r
+#define setstate_r __setstate_r
#define _GNU_SOURCE
#include <features.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
+
#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
+# include <pthread.h>
/* POSIX.1c requires that there is mutual exclusion for the `rand' and
`srand' functions to prevent concurrent calls from modifying common
data. */
static pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-#else
-#define __pthread_mutex_lock(x)
-#define __pthread_mutex_unlock(x)
#endif
/* An improved random number generation package. In addition to the standard
diff --git a/libc/stdlib/random_r.c b/libc/stdlib/random_r.c
index 9e203f0d5..0733bf900 100644
--- a/libc/stdlib/random_r.c
+++ b/libc/stdlib/random_r.c
@@ -319,7 +319,7 @@ fail:
to the order in which things are done, it is OK to call setstate with the
same state as the current state
Returns a pointer to the old state information. */
-int setstate_r (char *arg_state, struct random_data *buf)
+int attribute_hidden __setstate_r (char *arg_state, struct random_data *buf)
{
int32_t *new_state = 1 + (int32_t *) arg_state;
int type;
@@ -362,3 +362,4 @@ fail:
__set_errno (EINVAL);
return -1;
}
+strong_alias(__setstate_r,setstate_r)
diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c
index 8704717a7..07af88465 100644
--- a/libc/stdlib/setenv.c
+++ b/libc/stdlib/setenv.c
@@ -29,14 +29,11 @@
#include <unistd.h>
#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
+# include <pthread.h>
static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
-# define LOCK __pthread_mutex_lock(&mylock)
-# define UNLOCK __pthread_mutex_unlock(&mylock);
-#else
-# define LOCK
-# define UNLOCK
#endif
+#define LOCK __pthread_mutex_lock(&mylock)
+#define UNLOCK __pthread_mutex_unlock(&mylock)
extern int __unsetenv (__const char *__name) attribute_hidden;
diff --git a/libc/stdlib/srand48.c b/libc/stdlib/srand48.c
index a172d07a1..1dcdc14a7 100644
--- a/libc/stdlib/srand48.c
+++ b/libc/stdlib/srand48.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define srand48_r __srand48_r
+
#include <stdlib.h>
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
diff --git a/libc/stdlib/srand48_r.c b/libc/stdlib/srand48_r.c
index c0fa38e90..d2f959c79 100644
--- a/libc/stdlib/srand48_r.c
+++ b/libc/stdlib/srand48_r.c
@@ -20,9 +20,7 @@
#include <stdlib.h>
#include <limits.h>
-int srand48_r (seedval, buffer)
- long int seedval;
- struct drand48_data *buffer;
+int attribute_hidden __srand48_r (long int seedval, struct drand48_data *buffer)
{
/* The standards say we only have 32 bits. */
if (sizeof (long int) > 4)
@@ -38,3 +36,4 @@ int srand48_r (seedval, buffer)
return 0;
}
+strong_alias(__srand48_r,srand48_r)
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index fb8ce186b..04c85d32f 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -750,7 +750,7 @@ void *bsearch(const void *key, const void *base, size_t /* nmemb */ high,
* calculation, as well as to reduce the generated code size with
* bcc and gcc. */
-void qsort (void *base,
+void attribute_hidden __qsort (void *base,
size_t nel,
size_t width,
int (*comp)(const void *, const void *))
@@ -795,6 +795,7 @@ void qsort (void *base,
} while (wgap);
}
}
+strong_alias(__qsort,qsort)
/* ---------- original snippets version below ---------- */
diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c
index b365ef82e..e268bf5ef 100644
--- a/libc/stdlib/system.c
+++ b/libc/stdlib/system.c
@@ -1,3 +1,6 @@
+#define wait4 __wait4
+#define execl __execl
+
#include <stdio.h>
#include <stddef.h>
#include <signal.h>
diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c
index 5d21ec9f8..1f1c4df5c 100644
--- a/libc/stdlib/unix_grantpt.c
+++ b/libc/stdlib/unix_grantpt.c
@@ -19,7 +19,9 @@
#define memchr __memchr
#define getgid __getgid
+#define getuid __getuid
#define setrlimit __setrlimit
+#define waitpid __waitpid
#include <assert.h>
#include <errno.h>
diff --git a/libc/stdlib/valloc.c b/libc/stdlib/valloc.c
index c1d6d29a5..d4f21d121 100644
--- a/libc/stdlib/valloc.c
+++ b/libc/stdlib/valloc.c
@@ -20,7 +20,7 @@ Cambridge, MA 02139, USA.
The author may be reached (Email) at the address mike@@ai.mit.edu,
or (US mail) as Mike Haertel c/o Free Software Foundation. */
-#define getpagesize __libc_getpagesize
+#define getpagesize __getpagesize_internal
#include <stdlib.h>
#include <unistd.h>