summaryrefslogtreecommitdiff
path: root/libc/misc/dirent
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/dirent')
-rw-r--r--libc/misc/dirent/closedir.c4
-rw-r--r--libc/misc/dirent/dirstream.h11
-rw-r--r--libc/misc/dirent/readdir.c4
-rw-r--r--libc/misc/dirent/readdir64.c4
-rw-r--r--libc/misc/dirent/readdir64_r.c4
-rw-r--r--libc/misc/dirent/readdir_r.c5
-rw-r--r--libc/misc/dirent/rewinddir.c4
-rw-r--r--libc/misc/dirent/seekdir.c4
8 files changed, 17 insertions, 23 deletions
diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c
index f58857b82..3dc0bd17a 100644
--- a/libc/misc/dirent/closedir.c
+++ b/libc/misc/dirent/closedir.c
@@ -27,10 +27,10 @@ int closedir(DIR * dir)
__set_errno(EBADF);
return -1;
}
- __pthread_mutex_lock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_LOCK(dir->dd_lock);
fd = dir->dd_fd;
dir->dd_fd = -1;
- __pthread_mutex_unlock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
free(dir->dd_buf);
free(dir);
return close(fd);
diff --git a/libc/misc/dirent/dirstream.h b/libc/misc/dirent/dirstream.h
index a90ca6312..761111b9e 100644
--- a/libc/misc/dirent/dirstream.h
+++ b/libc/misc/dirent/dirstream.h
@@ -26,9 +26,8 @@ Cambridge, MA 02139, USA. */
#include <features.h>
#include <sys/types.h>
-#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
-#endif
+
+#include <bits/uClibc_mutex.h>
/* For now, syscall readdir () only supports one entry at a time. It
* will be changed in the future.
@@ -63,11 +62,7 @@ struct __dirstream {
size_t dd_max;
/* lock */
-#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_t dd_lock;
-#else
- void *dd_lock;
-#endif
+ __UCLIBC_MUTEX(dd_lock);
}; /* stream data from opendir() */
diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c
index 6fb1146eb..2fb7a7246 100644
--- a/libc/misc/dirent/readdir.c
+++ b/libc/misc/dirent/readdir.c
@@ -25,7 +25,7 @@ struct dirent *readdir(DIR * dir)
return NULL;
}
- __pthread_mutex_lock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_LOCK(dir->dd_lock);
do {
if (dir->dd_size <= dir->dd_nextloc) {
@@ -51,7 +51,7 @@ struct dirent *readdir(DIR * dir)
} while (de->d_ino == 0);
all_done:
- __pthread_mutex_unlock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
return de;
}
libc_hidden_def(readdir)
diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c
index 5386ee17e..36dc35379 100644
--- a/libc/misc/dirent/readdir64.c
+++ b/libc/misc/dirent/readdir64.c
@@ -25,7 +25,7 @@ struct dirent64 *readdir64(DIR * dir)
return NULL;
}
- __pthread_mutex_lock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_LOCK(dir->dd_lock);
do {
if (dir->dd_size <= dir->dd_nextloc) {
@@ -51,7 +51,7 @@ struct dirent64 *readdir64(DIR * dir)
} while (de->d_ino == 0);
all_done:
- __pthread_mutex_unlock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
return de;
}
diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c
index b42351702..23fd8f6d9 100644
--- a/libc/misc/dirent/readdir64_r.c
+++ b/libc/misc/dirent/readdir64_r.c
@@ -29,7 +29,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
}
de = NULL;
- __pthread_mutex_lock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_LOCK(dir->dd_lock);
do {
if (dir->dd_size <= dir->dd_nextloc) {
@@ -63,7 +63,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
all_done:
- __pthread_mutex_unlock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
return((de != NULL)? 0 : ret);
}
libc_hidden_def(readdir64_r)
diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c
index a1d8b9a77..9493ecc0d 100644
--- a/libc/misc/dirent/readdir_r.c
+++ b/libc/misc/dirent/readdir_r.c
@@ -26,7 +26,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
}
de = NULL;
- __pthread_mutex_lock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_LOCK(dir->dd_lock);
do {
if (dir->dd_size <= dir->dd_nextloc) {
@@ -60,8 +60,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
all_done:
- __pthread_mutex_unlock(&(dir->dd_lock));
-
+ __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
return((de != NULL)? 0 : ret);
}
libc_hidden_def(readdir_r)
diff --git a/libc/misc/dirent/rewinddir.c b/libc/misc/dirent/rewinddir.c
index 516700183..1bbda0809 100644
--- a/libc/misc/dirent/rewinddir.c
+++ b/libc/misc/dirent/rewinddir.c
@@ -18,8 +18,8 @@ void rewinddir(DIR * dir)
__set_errno(EBADF);
return;
}
- __pthread_mutex_lock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_LOCK(dir->dd_lock);
lseek(dir->dd_fd, 0, SEEK_SET);
dir->dd_nextoff = dir->dd_nextloc = dir->dd_size = 0;
- __pthread_mutex_unlock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
}
diff --git a/libc/misc/dirent/seekdir.c b/libc/misc/dirent/seekdir.c
index ba25ffd40..c41844856 100644
--- a/libc/misc/dirent/seekdir.c
+++ b/libc/misc/dirent/seekdir.c
@@ -17,8 +17,8 @@ void seekdir(DIR * dir, long int offset)
__set_errno(EBADF);
return;
}
- __pthread_mutex_lock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_LOCK(dir->dd_lock);
dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);
dir->dd_size = dir->dd_nextloc = 0;
- __pthread_mutex_unlock(&(dir->dd_lock));
+ __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
}