[uClibc-cvs] uClibc/libc/stdlib/malloc-930716 malloc.c, 1.13, 1.14 memalign.c, 1.3, 1.4 realloc.c, 1.4, 1.5

Manuel Novoa III mjn3 at uclibc.org
Sat Dec 27 23:30:50 UTC 2003


Update of /var/cvs/uClibc/libc/stdlib/malloc-930716
In directory nail:/tmp/cvs-serv11655/libc/stdlib/malloc-930716

Modified Files:
	malloc.c memalign.c realloc.c 
Log Message:
Fix a long-standing bug with pthreads.  A couple of linuxthreads files
were including libc-lock.h which had a bunch of weak pragmas.  Also,
uClibc supplied a number of no-op weak thread functions even though
many weren't needed.  This combined result was that sometimes the
functional versions of thread functions in pthread would not override
the weaks in libc.

While fixing this, I also prepended double-underscore to all necessary
weak thread funcs in uClibc, and removed all unused weaks.

I did a test build, but haven't tested this since these changes are
a backport from my working tree.  I did test the changes there and
no longer need to explicitly add -lpthread in the perl build for
perl to pass its thread self tests.



Index: memalign.c
===================================================================
RCS file: /var/cvs/uClibc/libc/stdlib/malloc-930716/memalign.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- memalign.c	5 Sep 2002 05:54:26 -0000	1.3
+++ memalign.c	27 Dec 2003 23:30:47 -0000	1.4
@@ -20,8 +20,8 @@
 #ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
 extern pthread_mutex_t __malloclock;
-# define LOCK	pthread_mutex_lock(&__malloclock)
-# define UNLOCK	pthread_mutex_unlock(&__malloclock);
+# define LOCK	__pthread_mutex_lock(&__malloclock)
+# define UNLOCK	__pthread_mutex_unlock(&__malloclock);
 #else
 # define LOCK
 # define UNLOCK

Index: realloc.c
===================================================================
RCS file: /var/cvs/uClibc/libc/stdlib/malloc-930716/realloc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- realloc.c	6 Sep 2003 11:49:28 -0000	1.4
+++ realloc.c	27 Dec 2003 23:30:47 -0000	1.5
@@ -21,8 +21,8 @@
 #ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
 extern pthread_mutex_t __malloclock;
-# define LOCK	pthread_mutex_lock(&__malloclock)
-# define UNLOCK	pthread_mutex_unlock(&__malloclock);
+# define LOCK	__pthread_mutex_lock(&__malloclock)
+# define UNLOCK	__pthread_mutex_unlock(&__malloclock);
 #else
 # define LOCK
 # define UNLOCK

Index: malloc.c
===================================================================
RCS file: /var/cvs/uClibc/libc/stdlib/malloc-930716/malloc.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- malloc.c	17 Oct 2003 09:05:20 -0000	1.13
+++ malloc.c	27 Dec 2003 23:30:47 -0000	1.14
@@ -21,8 +21,8 @@
 #ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
 pthread_mutex_t __malloclock = PTHREAD_MUTEX_INITIALIZER;
-# define LOCK	pthread_mutex_lock(&__malloclock)
-# define UNLOCK	pthread_mutex_unlock(&__malloclock);
+# define LOCK	__pthread_mutex_lock(&__malloclock)
+# define UNLOCK	__pthread_mutex_unlock(&__malloclock);
 #else
 # define LOCK
 # define UNLOCK




More information about the uClibc-cvs mailing list