svn commit: branches/uClibc-nptl/libc/stdlib: malloc malloc-standard

sjhill at uclibc.org sjhill at uclibc.org
Tue Aug 22 02:42:48 UTC 2006


Author: sjhill
Date: 2006-08-21 19:42:47 -0700 (Mon, 21 Aug 2006)
New Revision: 15903

Log:
Merge from trunk.


Modified:
   branches/uClibc-nptl/libc/stdlib/Makefile.in
   branches/uClibc-nptl/libc/stdlib/_atexit.c
   branches/uClibc-nptl/libc/stdlib/_strtod.c
   branches/uClibc-nptl/libc/stdlib/div.c
   branches/uClibc-nptl/libc/stdlib/getenv.c
   branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile.in
   branches/uClibc-nptl/libc/stdlib/malloc-standard/mallinfo.c
   branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.c
   branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.h
   branches/uClibc-nptl/libc/stdlib/malloc-standard/realloc.c
   branches/uClibc-nptl/libc/stdlib/malloc/heap.h
   branches/uClibc-nptl/libc/stdlib/malloc/malloc.h
   branches/uClibc-nptl/libc/stdlib/mkdtemp.c
   branches/uClibc-nptl/libc/stdlib/ptsname.c
   branches/uClibc-nptl/libc/stdlib/rand.c
   branches/uClibc-nptl/libc/stdlib/setenv.c
   branches/uClibc-nptl/libc/stdlib/stdlib.c
   branches/uClibc-nptl/libc/stdlib/system.c


Changeset:
Modified: branches/uClibc-nptl/libc/stdlib/Makefile.in
===================================================================
--- branches/uClibc-nptl/libc/stdlib/Makefile.in	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/Makefile.in	2006-08-22 02:42:47 UTC (rev 15903)
@@ -1,6 +1,5 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
 # Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
@@ -78,6 +77,8 @@
 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

Modified: branches/uClibc-nptl/libc/stdlib/_atexit.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/_atexit.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/_atexit.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -49,7 +49,6 @@
 #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 @@
 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);

Modified: branches/uClibc-nptl/libc/stdlib/_strtod.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/_strtod.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/_strtod.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -177,10 +177,7 @@
 
 #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

Modified: branches/uClibc-nptl/libc/stdlib/div.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/div.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/div.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -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 at uclibc.org>
- * Written by Erik Andersen <andersen at 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 at uclibc.org>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  */
 
 #include <stdlib.h>

Modified: branches/uClibc-nptl/libc/stdlib/getenv.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/getenv.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/getenv.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -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 */

Modified: branches/uClibc-nptl/libc/stdlib/malloc/heap.h
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc/heap.h	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/malloc/heap.h	2006-08-22 02:42:47 UTC (rev 15903)
@@ -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

Modified: branches/uClibc-nptl/libc/stdlib/malloc/malloc.h
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc/malloc.h	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/malloc/malloc.h	2006-08-22 02:42:47 UTC (rev 15903)
@@ -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

Modified: branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile.in
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile.in	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile.in	2006-08-22 02:42:47 UTC (rev 15903)
@@ -1,6 +1,5 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
 # Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
@@ -22,6 +21,8 @@
 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
 

Modified: branches/uClibc-nptl/libc/stdlib/malloc-standard/mallinfo.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc-standard/mallinfo.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/malloc-standard/mallinfo.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -17,7 +17,6 @@
 #include "malloc.h"
 
 libc_hidden_proto(fprintf)
-libc_hidden_proto(stderr)
 
 /* ------------------------------ mallinfo ------------------------------ */
 libc_hidden_proto(mallinfo)

Modified: branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -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
 
 /*

Modified: branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.h
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.h	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.h	2006-08-22 02:42:47 UTC (rev 15903)
@@ -31,7 +31,6 @@
 #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)

Modified: branches/uClibc-nptl/libc/stdlib/malloc-standard/realloc.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc-standard/realloc.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/malloc-standard/realloc.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -52,7 +52,7 @@
 	return malloc(bytes);
     if (! bytes) {
 	free (oldmem);
-	return malloc(bytes);
+	return NULL;
     }
 
     LOCK;

Modified: branches/uClibc-nptl/libc/stdlib/mkdtemp.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/mkdtemp.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/mkdtemp.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -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 @@
 
     return template;
 }
+#endif

Modified: branches/uClibc-nptl/libc/stdlib/ptsname.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/ptsname.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/ptsname.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -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>

Modified: branches/uClibc-nptl/libc/stdlib/rand.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/rand.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/rand.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -1,28 +1,16 @@
-/* rand.c
- *
- * Written by Erik Andersen <andersee at 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 at 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());
 }
 

Modified: branches/uClibc-nptl/libc/stdlib/setenv.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/setenv.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/setenv.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -31,7 +31,6 @@
 libc_hidden_proto(strncmp)
 libc_hidden_proto(strndup)
 libc_hidden_proto(unsetenv)
-libc_hidden_proto(__environ)
 
 #ifdef __UCLIBC_HAS_THREADS__
 # include <pthread.h>

Modified: branches/uClibc-nptl/libc/stdlib/stdlib.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/stdlib.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/stdlib.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -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 @@
 
 #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 @@
 
 #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

Modified: branches/uClibc-nptl/libc/stdlib/system.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/system.c	2006-08-22 02:26:17 UTC (rev 15902)
+++ branches/uClibc-nptl/libc/stdlib/system.c	2006-08-22 02:42:47 UTC (rev 15903)
@@ -15,8 +15,8 @@
 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
 #include <sched.h>
 #include <errno.h>
+#include <sysdep-cancel.h>
 #include <bits/libc-lock.h>
-#include <sysdep-cancel.h>
 #endif
 
 libc_hidden_proto(_exit)
@@ -134,12 +134,12 @@
   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 @@
 	  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 @@
       /* 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 @@
   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 ();
 




More information about the uClibc-cvs mailing list