From cd4a3339770a244c6af22e8353423c71d13b8091 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 30 May 2002 13:17:44 +0000 Subject: Fixup totally broken locking code... No storage for the mutex, wrong ifdef macro.. -Erik --- libc/misc/dirent/closedir.c | 8 ++++---- libc/misc/dirent/dirstream.h | 6 +++--- libc/misc/dirent/opendir.c | 4 ++-- libc/misc/dirent/readdir.c | 8 ++++---- libc/misc/dirent/readdir64.c | 8 ++++---- libc/misc/dirent/readdir_r.c | 8 ++++---- libc/misc/dirent/rewinddir.c | 8 ++++---- libc/misc/dirent/seekdir.c | 8 ++++---- 8 files changed, 29 insertions(+), 29 deletions(-) (limited to 'libc') diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c index c9486ac56..0e176deb7 100644 --- a/libc/misc/dirent/closedir.c +++ b/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); diff --git a/libc/misc/dirent/dirstream.h b/libc/misc/dirent/dirstream.h index 268ed1c91..92e81af0b 100644 --- a/libc/misc/dirent/dirstream.h +++ b/libc/misc/dirent/dirstream.h @@ -26,7 +26,7 @@ Cambridge, MA 02139, USA. */ #include #include -#ifdef _POSIX_THREADS +#ifdef __UCLIBC_HAS_THREADS__ #include #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 diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index 48911ce32..cae8800d8 100644 --- a/libc/misc/dirent/opendir.c +++ b/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; } diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c index b9f5f55bd..d74f9abb7 100644 --- a/libc/misc/dirent/readdir.c +++ b/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; } diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c index 85404bb52..b845b8139 100644 --- a/libc/misc/dirent/readdir64.c +++ b/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; diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c index 9d9db0dee..423dcb810 100644 --- a/libc/misc/dirent/readdir_r.c +++ b/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); } diff --git a/libc/misc/dirent/rewinddir.c b/libc/misc/dirent/rewinddir.c index a541f8963..6083abf13 100644 --- a/libc/misc/dirent/rewinddir.c +++ b/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 } diff --git a/libc/misc/dirent/seekdir.c b/libc/misc/dirent/seekdir.c index c00171a28..bfe61c0c2 100644 --- a/libc/misc/dirent/seekdir.c +++ b/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 } -- cgit v1.2.3