Browse Source

Fixup totally broken locking code... No storage for the mutex,
wrong ifdef macro..
-Erik

Eric Andersen 23 years ago
parent
commit
cd4a333977

+ 4 - 4
libc/misc/dirent/closedir.c

@@ -19,13 +19,13 @@ int closedir(DIR * dir)
 		__set_errno(EBADF);
 		return -1;
 	}
-#ifdef _POSIX_THREADS
-	pthread_mutex_lock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_lock(&(dir->dd_lock));
 #endif
 	fd = dir->dd_fd;
 	dir->dd_fd = -1;
-#ifdef _POSIX_THREADS
-	pthread_mutex_unlock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_unlock(&(dir->dd_lock));
 #endif
 	free(dir->dd_buf);
 	free(dir);

+ 3 - 3
libc/misc/dirent/dirstream.h

@@ -26,7 +26,7 @@ Cambridge, MA 02139, USA.  */
 
 #include <features.h>
 #include <sys/types.h>
-#ifdef _POSIX_THREADS
+#ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
 #endif
 
@@ -63,8 +63,8 @@ struct __dirstream {
   size_t dd_max;
  
   /* lock */
-#ifdef _POSIX_THREADS
-  pthread_mutex_t *dd_lock;
+#ifdef __UCLIBC_HAS_THREADS__
+  pthread_mutex_t dd_lock;
 #else
   void *dd_lock;
 #endif

+ 2 - 2
libc/misc/dirent/opendir.c

@@ -51,8 +51,8 @@ DIR *opendir(const char *name)
 		return NULL;
 	}
 	ptr->dd_buf = buf;
-#ifdef _POSIX_THREADS
-	pthread_mutex_init(ptr->dd_lock, NULL);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_init(&(ptr->dd_lock), NULL);
 #endif
 	return ptr;
 }

+ 4 - 4
libc/misc/dirent/readdir.c

@@ -18,8 +18,8 @@ struct dirent *readdir(DIR * dir)
 		return NULL;
 	}
 
-#ifdef _POSIX_THREADS
-	pthread_mutex_lock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_lock(&(dir->dd_lock));
 #endif
 
 	do {
@@ -46,8 +46,8 @@ struct dirent *readdir(DIR * dir)
 	} while (de->d_ino == 0);
 
 all_done:
-#ifdef _POSIX_THREADS
-	pthread_mutex_unlock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_unlock(&(dir->dd_lock));
 #endif
 	return de;
 }

+ 4 - 4
libc/misc/dirent/readdir64.c

@@ -33,8 +33,8 @@ struct dirent64 *readdir64(DIR * dir)
 		return NULL;
 	}
 
-#ifdef _POSIX_THREADS
-	pthread_mutex_lock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_lock(&(dir->dd_lock));
 #endif
 
 	do {
@@ -61,8 +61,8 @@ struct dirent64 *readdir64(DIR * dir)
 	} while (de->d_ino == 0);
 
 all_done:
-#ifdef _POSIX_THREADS
-	pthread_mutex_unlock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_unlock(&(dir->dd_lock));
 #endif
 
 	return de;

+ 4 - 4
libc/misc/dirent/readdir_r.c

@@ -20,8 +20,8 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
 	}
 	de = NULL;
 
-#ifdef _POSIX_THREADS
-	pthread_mutex_lock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_lock(&(dir->dd_lock));
 #endif
 
 	do {
@@ -56,8 +56,8 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
 
 all_done:
 
-#ifdef _POSIX_THREADS
-	pthread_mutex_unlock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_unlock(&(dir->dd_lock));
 #endif
         return((de != NULL)? 0 : ret);
 }

+ 4 - 4
libc/misc/dirent/rewinddir.c

@@ -11,12 +11,12 @@ void rewinddir(DIR * dir)
 		__set_errno(EBADF);
 		return;
 	}
-#ifdef _POSIX_THREADS
-	pthread_mutex_lock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_lock(&(dir->dd_lock));
 #endif
 	lseek(dir->dd_fd, 0, SEEK_SET);
 	dir->dd_nextoff = dir->dd_nextloc = dir->dd_size = 0;
-#ifdef _POSIX_THREADS
-	pthread_mutex_unlock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_unlock(&(dir->dd_lock));
 #endif
 }

+ 4 - 4
libc/misc/dirent/seekdir.c

@@ -10,12 +10,12 @@ void seekdir(DIR * dir, long int offset)
 		__set_errno(EBADF);
 		return;
 	}
-#ifdef _POSIX_THREADS
-	pthread_mutex_lock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_lock(&(dir->dd_lock));
 #endif
 	dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);
 	dir->dd_size = dir->dd_nextloc = 0;
-#ifdef _POSIX_THREADS
-	pthread_mutex_unlock(dir->dd_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+	pthread_mutex_unlock(&(dir->dd_lock));
 #endif
 }