OSDN Git Service

Fixup totally broken locking code... No storage for the mutex,
authorEric Andersen <andersen@codepoet.org>
Thu, 30 May 2002 13:17:44 +0000 (13:17 -0000)
committerEric Andersen <andersen@codepoet.org>
Thu, 30 May 2002 13:17:44 +0000 (13:17 -0000)
wrong ifdef macro..
 -Erik

libc/misc/dirent/closedir.c
libc/misc/dirent/dirstream.h
libc/misc/dirent/opendir.c
libc/misc/dirent/readdir.c
libc/misc/dirent/readdir64.c
libc/misc/dirent/readdir_r.c
libc/misc/dirent/rewinddir.c
libc/misc/dirent/seekdir.c

index c9486ac..0e176de 100644 (file)
@@ -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);
index 268ed1c..92e81af 100644 (file)
@@ -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
index 48911ce..cae8800 100644 (file)
@@ -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;
 }
index b9f5f55..d74f9ab 100644 (file)
@@ -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;
 }
index 85404bb..b845b81 100644 (file)
@@ -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;
index 9d9db0d..423dcb8 100644 (file)
@@ -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);
 }
index a541f89..6083abf 100644 (file)
@@ -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
 }
index c00171a..bfe61c0 100644 (file)
@@ -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
 }