summaryrefslogtreecommitdiff
path: root/libc/misc/dirent
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-12-27 23:30:50 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-12-27 23:30:50 +0000
commitd05dafe2fc23137f8decd641d82d23f45e16281c (patch)
tree83fb903ed075f81269ef2b1ee4b0edf0741ff70f /libc/misc/dirent
parentcb19f2f71fa01b6d40dae3190cb6dd1d2116f852 (diff)
Fix a long-standing bug with pthreads. A couple of linuxthreads files
were including libc-lock.h which had a bunch of weak pragmas. Also, uClibc supplied a number of no-op weak thread functions even though many weren't needed. This combined result was that sometimes the functional versions of thread functions in pthread would not override the weaks in libc. While fixing this, I also prepended double-underscore to all necessary weak thread funcs in uClibc, and removed all unused weaks. I did a test build, but haven't tested this since these changes are a backport from my working tree. I did test the changes there and no longer need to explicitly add -lpthread in the perl build for perl to pass its thread self tests.
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.c4
-rw-r--r--libc/misc/dirent/rewinddir.c4
-rw-r--r--libc/misc/dirent/seekdir.c4
8 files changed, 15 insertions, 15 deletions
diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c
index 0e176deb7..068e2d3e2 100644
--- a/libc/misc/dirent/closedir.c
+++ b/libc/misc/dirent/closedir.c
@@ -20,12 +20,12 @@ int closedir(DIR * dir)
return -1;
}
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_lock(&(dir->dd_lock));
+ __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));
+ __pthread_mutex_unlock(&(dir->dd_lock));
#endif
free(dir->dd_buf);
free(dir);
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index cae8800d8..017684b40 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -52,7 +52,7 @@ DIR *opendir(const char *name)
}
ptr->dd_buf = buf;
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_init(&(ptr->dd_lock), NULL);
+ __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 8c5fd7f1a..1f196e1e7 100644
--- a/libc/misc/dirent/readdir.c
+++ b/libc/misc/dirent/readdir.c
@@ -17,7 +17,7 @@ struct dirent *readdir(DIR * dir)
}
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_lock(&(dir->dd_lock));
+ __pthread_mutex_lock(&(dir->dd_lock));
#endif
do {
@@ -45,7 +45,7 @@ struct dirent *readdir(DIR * dir)
all_done:
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_unlock(&(dir->dd_lock));
+ __pthread_mutex_unlock(&(dir->dd_lock));
#endif
return de;
}
diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c
index ae9e771e8..f798c6fbb 100644
--- a/libc/misc/dirent/readdir64.c
+++ b/libc/misc/dirent/readdir64.c
@@ -32,7 +32,7 @@ struct dirent64 *readdir64(DIR * dir)
}
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_lock(&(dir->dd_lock));
+ __pthread_mutex_lock(&(dir->dd_lock));
#endif
do {
@@ -60,7 +60,7 @@ struct dirent64 *readdir64(DIR * dir)
all_done:
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_unlock(&(dir->dd_lock));
+ __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 6b22261db..da3564edb 100644
--- a/libc/misc/dirent/readdir64_r.c
+++ b/libc/misc/dirent/readdir64_r.c
@@ -33,7 +33,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
de = NULL;
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_lock(&(dir->dd_lock));
+ __pthread_mutex_lock(&(dir->dd_lock));
#endif
do {
@@ -69,7 +69,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
all_done:
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_unlock(&(dir->dd_lock));
+ __pthread_mutex_unlock(&(dir->dd_lock));
#endif
return((de != NULL)? 0 : ret);
}
diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c
index 50bc9bb6d..245dcbdde 100644
--- a/libc/misc/dirent/readdir_r.c
+++ b/libc/misc/dirent/readdir_r.c
@@ -19,7 +19,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
de = NULL;
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_lock(&(dir->dd_lock));
+ __pthread_mutex_lock(&(dir->dd_lock));
#endif
do {
@@ -55,7 +55,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
all_done:
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_unlock(&(dir->dd_lock));
+ __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 6083abf13..60ef71da7 100644
--- a/libc/misc/dirent/rewinddir.c
+++ b/libc/misc/dirent/rewinddir.c
@@ -12,11 +12,11 @@ void rewinddir(DIR * dir)
return;
}
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_lock(&(dir->dd_lock));
+ __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));
+ __pthread_mutex_unlock(&(dir->dd_lock));
#endif
}
diff --git a/libc/misc/dirent/seekdir.c b/libc/misc/dirent/seekdir.c
index bfe61c0c2..139f1e1e5 100644
--- a/libc/misc/dirent/seekdir.c
+++ b/libc/misc/dirent/seekdir.c
@@ -11,11 +11,11 @@ void seekdir(DIR * dir, long int offset)
return;
}
#ifdef __UCLIBC_HAS_THREADS__
- pthread_mutex_lock(&(dir->dd_lock));
+ __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));
+ __pthread_mutex_unlock(&(dir->dd_lock));
#endif
}