Ver Fonte

- revert 24148:24151

Bernhard Reutner-Fischer há 15 anos atrás
pai
commit
20cff29565

+ 2 - 1
include/time.h

@@ -288,7 +288,8 @@ extern char *ctime_r (__const time_t *__restrict __timer,
 
 
 
 
 /* Defined in localtime.c.  */
 /* Defined in localtime.c.  */
-#if 0
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning "mjn3 FIXME: __tzname, __daylight, and __timezone have a prototype but are not defined."
 extern char *__tzname[2];	/* Current timezone names.  */
 extern char *__tzname[2];	/* Current timezone names.  */
 extern int __daylight;		/* If daylight-saving time is ever in use.  */
 extern int __daylight;		/* If daylight-saving time is ever in use.  */
 extern long int __timezone;	/* Seconds west of UTC.  */
 extern long int __timezone;	/* Seconds west of UTC.  */

+ 7 - 10
libc/misc/time/time.c

@@ -1747,12 +1747,9 @@ static const char vals[] = {
 #define DEFAULT_2007_RULES (vals + 38)
 #define DEFAULT_2007_RULES (vals + 38)
 
 
 /* Initialize to UTC. */
 /* Initialize to UTC. */
-int __daylight attribute_hidden = 0;
-weak_alias(__daylight, daylight)
-long __timezone attribute_hidden =  0;
-weak_alias(__timezone, timezone)
-char *__tzname[2] attribute_hidden = { (char *) UTC, (char *) (UTC-1) };
-weak_alias(__tzname, tzname)
+int daylight = 0;
+long timezone = 0;
+char *tzname[2] = { (char *) UTC, (char *) (UTC-1) };
 
 
 __UCLIBC_MUTEX_INIT(_time_tzlock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP);
 __UCLIBC_MUTEX_INIT(_time_tzlock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP);
 
 
@@ -2062,10 +2059,10 @@ SKIP_OFFSET:
 
 
 	memcpy(_time_tzinfo, new_rules, sizeof(new_rules));
 	memcpy(_time_tzinfo, new_rules, sizeof(new_rules));
 DONE:
 DONE:
-	__tzname[0] = _time_tzinfo[0].tzname;
-	__tzname[1] = _time_tzinfo[1].tzname;
-	__daylight = !!_time_tzinfo[1].tzname[0];
-	__timezone = _time_tzinfo[0].gmt_offset;
+	tzname[0] = _time_tzinfo[0].tzname;
+	tzname[1] = _time_tzinfo[1].tzname;
+	daylight = !!_time_tzinfo[1].tzname[0];
+	timezone = _time_tzinfo[0].gmt_offset;
 
 
 #if defined(__UCLIBC_HAS_TZ_FILE__) || defined(__UCLIBC_HAS_TZ_CACHING__)
 #if defined(__UCLIBC_HAS_TZ_FILE__) || defined(__UCLIBC_HAS_TZ_CACHING__)
 FAST_DONE:
 FAST_DONE:

+ 1 - 1
libc/stdlib/malloc/free.c

@@ -30,7 +30,7 @@
 static void
 static void
 __free_to_heap (void *mem, struct heap_free_area **heap
 __free_to_heap (void *mem, struct heap_free_area **heap
 #ifdef HEAP_USE_LOCKING
 #ifdef HEAP_USE_LOCKING
-		, pthread_mutex_t *heap_lock
+		, malloc_mutex_t *heap_lock
 #endif
 #endif
 	       )
 	       )
 {
 {

+ 4 - 4
libc/stdlib/malloc/malloc.c

@@ -28,12 +28,12 @@
 HEAP_DECLARE_STATIC_FREE_AREA (initial_fa, 256);
 HEAP_DECLARE_STATIC_FREE_AREA (initial_fa, 256);
 struct heap_free_area *__malloc_heap = HEAP_INIT_WITH_FA (initial_fa);
 struct heap_free_area *__malloc_heap = HEAP_INIT_WITH_FA (initial_fa);
 #ifdef HEAP_USE_LOCKING
 #ifdef HEAP_USE_LOCKING
-pthread_mutex_t __malloc_heap_lock = PTHREAD_MUTEX_INITIALIZER;
+malloc_mutex_t __malloc_heap_lock = PTHREAD_MUTEX_INITIALIZER;
 #endif
 #endif
 
 
 #if defined(MALLOC_USE_LOCKING) && defined(MALLOC_USE_SBRK)
 #if defined(MALLOC_USE_LOCKING) && defined(MALLOC_USE_SBRK)
 /* A lock protecting our use of sbrk.  */
 /* A lock protecting our use of sbrk.  */
-pthread_mutex_t __malloc_sbrk_lock;
+malloc_mutex_t __malloc_sbrk_lock;
 #endif /* MALLOC_USE_LOCKING && MALLOC_USE_SBRK */
 #endif /* MALLOC_USE_LOCKING && MALLOC_USE_SBRK */
 
 
 
 
@@ -48,7 +48,7 @@ struct malloc_mmb *__malloc_mmapped_blocks = 0;
 HEAP_DECLARE_STATIC_FREE_AREA (initial_mmb_fa, 48); /* enough for 3 mmbs */
 HEAP_DECLARE_STATIC_FREE_AREA (initial_mmb_fa, 48); /* enough for 3 mmbs */
 struct heap_free_area *__malloc_mmb_heap = HEAP_INIT_WITH_FA (initial_mmb_fa);
 struct heap_free_area *__malloc_mmb_heap = HEAP_INIT_WITH_FA (initial_mmb_fa);
 #ifdef HEAP_USE_LOCKING
 #ifdef HEAP_USE_LOCKING
-pthread_mutex_t __malloc_mmb_heap_lock = PTHREAD_MUTEX_INITIALIZER;
+malloc_mutex_t __malloc_mmb_heap_lock = PTHREAD_MUTEX_INITIALIZER;
 #endif
 #endif
 #endif /* __UCLIBC_UCLINUX_BROKEN_MUNMAP__ */
 #endif /* __UCLIBC_UCLINUX_BROKEN_MUNMAP__ */
 
 
@@ -61,7 +61,7 @@ pthread_mutex_t __malloc_mmb_heap_lock = PTHREAD_MUTEX_INITIALIZER;
 static void *
 static void *
 __malloc_from_heap (size_t size, struct heap_free_area **heap
 __malloc_from_heap (size_t size, struct heap_free_area **heap
 #ifdef HEAP_USE_LOCKING
 #ifdef HEAP_USE_LOCKING
-		, pthread_mutex_t *heap_lock
+		, malloc_mutex_t *heap_lock
 #endif
 #endif
 		)
 		)
 {
 {

+ 10 - 8
libc/stdlib/malloc/malloc.h

@@ -130,21 +130,24 @@ extern int __malloc_mmb_debug;
 
 
 
 
 /* Locking for multithreaded apps.  */
 /* Locking for multithreaded apps.  */
-#if defined __UCLIBC_HAS_THREADS__ && defined __LINUXTHREADS_OLD__
+#ifdef __UCLIBC_HAS_THREADS__
 
 
 # include <pthread.h>
 # include <pthread.h>
 # include <bits/uClibc_pthread.h>
 # include <bits/uClibc_pthread.h>
 
 
 # define MALLOC_USE_LOCKING
 # define MALLOC_USE_LOCKING
 
 
+typedef pthread_mutex_t malloc_mutex_t;
+# define MALLOC_MUTEX_INIT	PTHREAD_MUTEX_INITIALIZER
+
 # ifdef MALLOC_USE_SBRK
 # ifdef MALLOC_USE_SBRK
 /* This lock is used to serialize uses of the `sbrk' function (in both
 /* This lock is used to serialize uses of the `sbrk' function (in both
    malloc and free, sbrk may be used several times in succession, and
    malloc and free, sbrk may be used several times in succession, and
    things will break if these multiple calls are interleaved with another
    things will break if these multiple calls are interleaved with another
    thread's use of sbrk!).  */
    thread's use of sbrk!).  */
-__UCLIBC_MUTEX_EXTERN(__malloc_sbrk_lock);
-#  define __malloc_lock_sbrk()	__UCLIBC_MUTEX_LOCK(__malloc_sbrk_lock)
-#  define __malloc_unlock_sbrk() __UCLIBC_MUTEX_UNLOCK(__malloc_sbrk_lock)
+extern malloc_mutex_t __malloc_sbrk_lock;
+#  define __malloc_lock_sbrk()	__pthread_mutex_lock (&__malloc_sbrk_lock)
+#  define __malloc_unlock_sbrk() __pthread_mutex_unlock (&__malloc_sbrk_lock)
 # endif /* MALLOC_USE_SBRK */
 # endif /* MALLOC_USE_SBRK */
 
 
 #else /* !__UCLIBC_HAS_THREADS__ */
 #else /* !__UCLIBC_HAS_THREADS__ */
@@ -219,10 +222,9 @@ extern void __malloc_debug_printf (int indent, const char *fmt, ...);
 
 
 /* The malloc heap.  */
 /* The malloc heap.  */
 extern struct heap_free_area *__malloc_heap;
 extern struct heap_free_area *__malloc_heap;
-#if defined __UCLIBC_HAS_THREADS__
-#include <bits/uClibc_mutex.h>
-__UCLIBC_MUTEX_EXTERN(__malloc_heap_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+extern malloc_mutex_t __malloc_heap_lock;
 #ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__
 #ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__
-__UCLIBC_MUTEX_EXTERN(__malloc_mmb_heap_lock);
+extern malloc_mutex_t __malloc_mmb_heap_lock;
 #endif
 #endif
 #endif
 #endif

+ 3 - 3
libc/sysdeps/linux/common/bits/uClibc_mutex.h

@@ -18,9 +18,9 @@
 #define __UCLIBC_MUTEX_TYPE				pthread_mutex_t
 #define __UCLIBC_MUTEX_TYPE				pthread_mutex_t
 
 
 #define __UCLIBC_MUTEX(M)				pthread_mutex_t M
 #define __UCLIBC_MUTEX(M)				pthread_mutex_t M
-#define __UCLIBC_MUTEX_INIT(M,I)		pthread_mutex_t M = I
-#define __UCLIBC_MUTEX_STATIC(M,I)		static pthread_mutex_t M = I
-#define __UCLIBC_MUTEX_EXTERN(M)		extern pthread_mutex_t M attribute_hidden
+#define __UCLIBC_MUTEX_INIT(M,I)			pthread_mutex_t M = I
+#define __UCLIBC_MUTEX_STATIC(M,I)			static pthread_mutex_t M = I
+#define __UCLIBC_MUTEX_EXTERN(M)			extern pthread_mutex_t M
 
 
 #define __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(M)								\
 #define __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(M)								\
 		__pthread_mutex_lock(&(M))
 		__pthread_mutex_lock(&(M))