diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-08-22 02:42:47 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-08-22 02:42:47 +0000 |
commit | a6624c7cb7f47281f01834c00d31322dfe9b16f2 (patch) | |
tree | 8f9619816ca742397dc8ef00048607184c980a96 /libc | |
parent | 7eac2221e41a367288359189d4bc557ae367c01a (diff) | |
download | uClibc-alpine-a6624c7cb7f47281f01834c00d31322dfe9b16f2.tar.bz2 uClibc-alpine-a6624c7cb7f47281f01834c00d31322dfe9b16f2.tar.xz |
Merge from trunk.
Diffstat (limited to 'libc')
-rw-r--r-- | libc/stdlib/Makefile.in | 3 | ||||
-rw-r--r-- | libc/stdlib/_atexit.c | 2 | ||||
-rw-r--r-- | libc/stdlib/_strtod.c | 5 | ||||
-rw-r--r-- | libc/stdlib/div.c | 24 | ||||
-rw-r--r-- | libc/stdlib/getenv.c | 1 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/Makefile.in | 3 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/mallinfo.c | 1 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/malloc.c | 1 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/malloc.h | 1 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/realloc.c | 2 | ||||
-rw-r--r-- | libc/stdlib/malloc/heap.h | 2 | ||||
-rw-r--r-- | libc/stdlib/malloc/malloc.h | 3 | ||||
-rw-r--r-- | libc/stdlib/mkdtemp.c | 2 | ||||
-rw-r--r-- | libc/stdlib/ptsname.c | 1 | ||||
-rw-r--r-- | libc/stdlib/rand.c | 28 | ||||
-rw-r--r-- | libc/stdlib/setenv.c | 1 | ||||
-rw-r--r-- | libc/stdlib/stdlib.c | 7 | ||||
-rw-r--r-- | libc/stdlib/system.c | 14 |
18 files changed, 31 insertions, 70 deletions
diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in index 202e25df2..e6948849b 100644 --- a/libc/stdlib/Makefile.in +++ b/libc/stdlib/Makefile.in @@ -1,6 +1,5 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. @@ -78,6 +77,8 @@ STDLIB_SRC := $(patsubst %.c,$(STDLIB_DIR)/%.c,$(CSRC)) STDLIB_OBJ := $(patsubst %.c,$(STDLIB_OUT)/%.o,$(CSRC)) libc-y += $(STDLIB_OBJ) +libc-a-y += $(STDLIB_OBJ) +libc-so-y += $(STDLIB_OBJ:.o=.os) libc-static-y += $(STDLIB_OUT)/atexit.o # this should always be the PIC version, because it could be used in shared libs libc-nonshared-y += $(STDLIB_OUT)/atexit.os diff --git a/libc/stdlib/_atexit.c b/libc/stdlib/_atexit.c index bf35ab2d6..236156001 100644 --- a/libc/stdlib/_atexit.c +++ b/libc/stdlib/_atexit.c @@ -49,7 +49,6 @@ libc_hidden_proto(_exit) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> extern pthread_mutex_t mylock; -libc_hidden_proto(mylock) #endif #define LOCK __pthread_mutex_lock(&mylock) #define UNLOCK __pthread_mutex_unlock(&mylock) @@ -315,7 +314,6 @@ extern void weak_function _stdio_term(void) attribute_hidden; attribute_hidden void (*__exit_cleanup) (int) = 0; #ifdef __UCLIBC_HAS_THREADS__ pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -libc_hidden_data_def(mylock) #endif extern void __uClibc_fini(void); diff --git a/libc/stdlib/_strtod.c b/libc/stdlib/_strtod.c index c4447d9ea..219d0d051 100644 --- a/libc/stdlib/_strtod.c +++ b/libc/stdlib/_strtod.c @@ -177,10 +177,7 @@ extern void __fp_range_check(__fpmax_t y, __fpmax_t x) attribute_hidden; #ifdef __UCLIBC_HAS_XLOCALE__ libc_hidden_proto(__ctype_b_loc) -#else -#ifdef __UCLIBC_HAS_LOCALE__ -libc_hidden_proto(__global_locale) -#endif +#elif __UCLIBC_HAS_CTYPE_TABLES__ libc_hidden_proto(__ctype_b) libc_hidden_proto(__ctype_tolower) #endif diff --git a/libc/stdlib/div.c b/libc/stdlib/div.c index 7ca9a2244..6c595959e 100644 --- a/libc/stdlib/div.c +++ b/libc/stdlib/div.c @@ -1,24 +1,8 @@ /* vi: set sw=4 ts=4: */ -/* div for uClibc - * - * Copyright (C) 2000 by Lineo, inc. and Erik Andersen - * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org> - * Written by Erik Andersen <andersen@uclibc.org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * +/* + * div for uClibc + * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org> + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include <stdlib.h> diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c index 4f4c4f1f8..c7940f398 100644 --- a/libc/stdlib/getenv.c +++ b/libc/stdlib/getenv.c @@ -11,7 +11,6 @@ libc_hidden_proto(getenv) libc_hidden_proto(memcmp) libc_hidden_proto(strlen) -libc_hidden_proto(__environ) /* IEEE Std 1003.1-2001 says getenv need not be thread safe, so * don't bother locking access to __environ */ diff --git a/libc/stdlib/malloc-standard/Makefile.in b/libc/stdlib/malloc-standard/Makefile.in index 1d29703c4..12445bbf1 100644 --- a/libc/stdlib/malloc-standard/Makefile.in +++ b/libc/stdlib/malloc-standard/Makefile.in @@ -1,6 +1,5 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. @@ -22,6 +21,8 @@ STDLIB_MALLOC_STANDARD_SRC := $(patsubst %.c,$(STDLIB_MALLOC_STANDARD_DIR)/%.c,$ STDLIB_MALLOC_STANDARD_OBJ := $(patsubst %.c,$(STDLIB_MALLOC_STANDARD_OUT)/%.o,$(CSRC)) libc-$(MALLOC_STANDARD) += $(STDLIB_MALLOC_STANDARD_OBJ) +libc-a-$(MALLOC_STANDARD) += $(STDLIB_MALLOC_STANDARD_OBJ) +libc-so-$(MALLOC_STANDARD) += $(STDLIB_MALLOC_STANDARD_OBJ:.o=.os) objclean-y += stdlib_malloc_standard_objclean diff --git a/libc/stdlib/malloc-standard/mallinfo.c b/libc/stdlib/malloc-standard/mallinfo.c index 89c9a6e7e..4f274ed32 100644 --- a/libc/stdlib/malloc-standard/mallinfo.c +++ b/libc/stdlib/malloc-standard/mallinfo.c @@ -17,7 +17,6 @@ #include "malloc.h" libc_hidden_proto(fprintf) -libc_hidden_proto(stderr) /* ------------------------------ mallinfo ------------------------------ */ libc_hidden_proto(mallinfo) diff --git a/libc/stdlib/malloc-standard/malloc.c b/libc/stdlib/malloc-standard/malloc.c index 10d421330..b4b1216ed 100644 --- a/libc/stdlib/malloc-standard/malloc.c +++ b/libc/stdlib/malloc-standard/malloc.c @@ -19,7 +19,6 @@ #ifdef __UCLIBC_HAS_THREADS__ pthread_mutex_t __malloc_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -libc_hidden_data_def(__malloc_lock) #endif /* diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h index a3fabb0c4..453d69736 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -31,7 +31,6 @@ libc_hidden_proto(abort) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> extern pthread_mutex_t __malloc_lock; -libc_hidden_proto(__malloc_lock) #endif #define LOCK __pthread_mutex_lock(&__malloc_lock) #define UNLOCK __pthread_mutex_unlock(&__malloc_lock) diff --git a/libc/stdlib/malloc-standard/realloc.c b/libc/stdlib/malloc-standard/realloc.c index ae2d33bee..f25d6d989 100644 --- a/libc/stdlib/malloc-standard/realloc.c +++ b/libc/stdlib/malloc-standard/realloc.c @@ -52,7 +52,7 @@ void* realloc(void* oldmem, size_t bytes) return malloc(bytes); if (! bytes) { free (oldmem); - return malloc(bytes); + return NULL; } LOCK; diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h index ab1a73896..b66b5ecef 100644 --- a/libc/stdlib/malloc/heap.h +++ b/libc/stdlib/malloc/heap.h @@ -25,7 +25,7 @@ HEAP_GRANULARITY must be a power of 2. Malloc depends on this being the same as MALLOC_ALIGNMENT. */ #define HEAP_GRANULARITY_TYPE double -#define HEAP_GRANULARITY (sizeof (HEAP_GRANULARITY_TYPE)) +#define HEAP_GRANULARITY (__alignof__ (HEAP_GRANULARITY_TYPE)) /* A heap is a collection of memory blocks, from which smaller blocks diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 753205443..b41c4b08e 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -12,11 +12,10 @@ */ /* The alignment we guarantee for malloc return values. */ -#define MALLOC_ALIGNMENT (sizeof (double)) +#define MALLOC_ALIGNMENT (__alignof__ (double)) /* The system pagesize... */ extern size_t __pagesize; -libc_hidden_proto(__pagesize) #define MALLOC_PAGE_SIZE __pagesize /* The minimum size of block we request from the the system to extend the diff --git a/libc/stdlib/mkdtemp.c b/libc/stdlib/mkdtemp.c index e1ece812f..20a2e16bc 100644 --- a/libc/stdlib/mkdtemp.c +++ b/libc/stdlib/mkdtemp.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include "../misc/internals/tempname.h" +#ifdef __USE_BSD /* Generate a unique temporary directory name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the filename unique. @@ -34,3 +35,4 @@ char * mkdtemp (char *template) return template; } +#endif diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index b41f6a118..dfb0d19db 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -17,7 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define _ISOC99_SOURCE #include <stdio.h> #include <errno.h> #include <paths.h> diff --git a/libc/stdlib/rand.c b/libc/stdlib/rand.c index cdf58ecc7..03323f501 100644 --- a/libc/stdlib/rand.c +++ b/libc/stdlib/rand.c @@ -1,28 +1,16 @@ -/* rand.c - * - * Written by Erik Andersen <andersee@debian.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 675 Mass Ave, - * Cambridge, MA 02139, USA. */ +/* vi: set sw=4 ts=4: */ +/* + * rand for uClibc + * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org> + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <stdlib.h> libc_hidden_proto(random) -int rand (void) +int rand (void) { - return((int)random()); + return((int)random()); } diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index e7dc26053..fa61675fb 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -31,7 +31,6 @@ libc_hidden_proto(strlen) libc_hidden_proto(strncmp) libc_hidden_proto(strndup) libc_hidden_proto(unsetenv) -libc_hidden_proto(__environ) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index f9ec75555..ccd3c015d 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -102,9 +102,6 @@ #ifdef __UCLIBC_HAS_XLOCALE__ #include <xlocale.h> #endif /* __UCLIBC_HAS_XLOCALE__ */ -#ifdef __UCLIBC_HAS_LOCALE__ -libc_hidden_proto(__global_locale) -#endif /* TODO: clean up the following... */ @@ -505,7 +502,7 @@ unsigned long attribute_hidden _stdlib_strto_l(register const Wchar * __restrict #ifdef __UCLIBC_HAS_XLOCALE__ libc_hidden_proto(__ctype_b_loc) -#else +#elif __UCLIBC_HAS_CTYPE_TABLES__ libc_hidden_proto(__ctype_b) #endif @@ -655,7 +652,7 @@ unsigned long long attribute_hidden _stdlib_strto_ll(register const Wchar * __re #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -#ifndef __UCLIBC_HAS_XLOCALE__ +#if !defined __UCLIBC_HAS_XLOCALE__ && defined __UCLIBC_HAS_CTYPE_TABLES__ libc_hidden_proto(__ctype_b) #endif /* This is the main work fuction which handles both strtoll (sflag = 1) and diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index 5c16dbee2..147ff5242 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -15,8 +15,8 @@ #ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include <sched.h> #include <errno.h> -#include <bits/libc-lock.h> #include <sysdep-cancel.h> +#include <bits/libc-lock.h> #endif libc_hidden_proto(_exit) @@ -134,12 +134,12 @@ do_system (const char *line) DO_LOCK (); if (ADD_REF () == 0) { - if (__sigaction (SIGINT, &sa, &intr) < 0) + if (sigaction (SIGINT, &sa, &intr) < 0) { SUB_REF (); goto out; } - if (__sigaction (SIGQUIT, &sa, &quit) < 0) + if (sigaction (SIGQUIT, &sa, &quit) < 0) { save = errno; SUB_REF (); @@ -158,9 +158,9 @@ do_system (const char *line) if (SUB_REF () == 0) { save = errno; - (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); + (void) sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); out_restore_sigint: - (void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL); + (void) sigaction (SIGINT, &intr, (struct sigaction *) NULL); __set_errno (save); } out: @@ -200,7 +200,7 @@ do_system (const char *line) /* Note the system() is a cancellation point. But since we call waitpid() which itself is a cancellation point we do not have to do anything here. */ - if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, 0)) != pid) + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) status = -1; } @@ -251,7 +251,7 @@ cancel_handler (void *arg) INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL (kill, err, 2, child, SIGKILL); - TEMP_FAILURE_RETRY (__waitpid (child, NULL, 0)); + TEMP_FAILURE_RETRY (waitpid (child, NULL, 0)); DO_LOCK (); |