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/opendir.c2
-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.c8
-rw-r--r--libc/misc/dirent/rewinddir.c4
-rw-r--r--libc/misc/dirent/seekdir.c5
8 files changed, 2 insertions, 33 deletions
diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c
index 57600ab69..25c424566 100644
--- a/libc/misc/dirent/closedir.c
+++ b/libc/misc/dirent/closedir.c
@@ -19,14 +19,10 @@ int closedir(DIR * dir)
__set_errno(EBADF);
return -1;
}
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_lock(&(dir->dd_lock));
-#endif
fd = dir->dd_fd;
dir->dd_fd = -1;
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_unlock(&(dir->dd_lock));
-#endif
free(dir->dd_buf);
free(dir);
return __close(fd);
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index 9f5f75e3f..fd14213a5 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -51,8 +51,6 @@ DIR *opendir(const char *name)
return NULL;
}
ptr->dd_buf = buf;
-#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 1f196e1e7..68a465fc8 100644
--- a/libc/misc/dirent/readdir.c
+++ b/libc/misc/dirent/readdir.c
@@ -16,9 +16,7 @@ struct dirent *readdir(DIR * dir)
return NULL;
}
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_lock(&(dir->dd_lock));
-#endif
do {
if (dir->dd_size <= dir->dd_nextloc) {
@@ -44,8 +42,6 @@ struct dirent *readdir(DIR * dir)
} while (de->d_ino == 0);
all_done:
-#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 f798c6fbb..8d22a314e 100644
--- a/libc/misc/dirent/readdir64.c
+++ b/libc/misc/dirent/readdir64.c
@@ -31,9 +31,7 @@ struct dirent64 *readdir64(DIR * dir)
return NULL;
}
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_lock(&(dir->dd_lock));
-#endif
do {
if (dir->dd_size <= dir->dd_nextloc) {
@@ -59,9 +57,7 @@ struct dirent64 *readdir64(DIR * dir)
} while (de->d_ino == 0);
all_done:
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_unlock(&(dir->dd_lock));
-#endif
return de;
}
diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c
index 1daae5116..7daf890dd 100644
--- a/libc/misc/dirent/readdir64_r.c
+++ b/libc/misc/dirent/readdir64_r.c
@@ -32,9 +32,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
}
de = NULL;
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_lock(&(dir->dd_lock));
-#endif
do {
if (dir->dd_size <= dir->dd_nextloc) {
@@ -68,9 +66,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
all_done:
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_unlock(&(dir->dd_lock));
-#endif
return((de != NULL)? 0 : ret);
}
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c
index 1c8eeadce..25cb80b63 100644
--- a/libc/misc/dirent/readdir_r.c
+++ b/libc/misc/dirent/readdir_r.c
@@ -5,7 +5,6 @@
#include <dirent.h>
#include "dirstream.h"
-
int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
{
int ret;
@@ -18,9 +17,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
}
de = NULL;
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_lock(&(dir->dd_lock));
-#endif
do {
if (dir->dd_size <= dir->dd_nextloc) {
@@ -54,8 +51,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
all_done:
-#ifdef __UCLIBC_HAS_THREADS__
__pthread_mutex_unlock(&(dir->dd_lock));
-#endif
- return((de != NULL)? 0 : ret);
+
+ return((de != NULL)? 0 : ret);
}
diff --git a/libc/misc/dirent/rewinddir.c b/libc/misc/dirent/rewinddir.c
index 60ef71da7..f41ecc389 100644
--- a/libc/misc/dirent/rewinddir.c
+++ b/libc/misc/dirent/rewinddir.c
@@ -11,12 +11,8 @@ void rewinddir(DIR * dir)
__set_errno(EBADF);
return;
}
-#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 __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 139f1e1e5..507131097 100644
--- a/libc/misc/dirent/seekdir.c
+++ b/libc/misc/dirent/seekdir.c
@@ -3,19 +3,14 @@
#include <unistd.h>
#include "dirstream.h"
-
void seekdir(DIR * dir, long int offset)
{
if (!dir) {
__set_errno(EBADF);
return;
}
-#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 __UCLIBC_HAS_THREADS__
__pthread_mutex_unlock(&(dir->dd_lock));
-#endif
}