summaryrefslogtreecommitdiff
path: root/libc/misc/mntent/mntent.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/mntent/mntent.c')
-rw-r--r--libc/misc/mntent/mntent.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c
index 3164f6634..a5db799dc 100644
--- a/libc/misc/mntent/mntent.c
+++ b/libc/misc/mntent/mntent.c
@@ -8,6 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <mntent.h>
+#include <bits/uClibc_mutex.h>
+
+__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER);
libc_hidden_proto(getmntent_r)
libc_hidden_proto(setmntent)
@@ -23,13 +26,6 @@ libc_hidden_proto(fgets)
libc_hidden_proto(abort)
libc_hidden_proto(fprintf)
-#ifdef __UCLIBC_HAS_THREADS__
-# include <pthread.h>
-static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
-#endif
-#define LOCK __pthread_mutex_lock(&mylock)
-#define UNLOCK __pthread_mutex_unlock(&mylock)
-
/* Reentrant version of getmntent. */
struct mntent *getmntent_r (FILE *filep,
struct mntent *mnt, char *buff, int bufsize)
@@ -85,7 +81,7 @@ struct mntent *getmntent(FILE * filep)
struct mntent *tmp;
static char *buff = NULL;
static struct mntent mnt;
- LOCK;
+ __UCLIBC_MUTEX_LOCK(mylock);
if (!buff) {
buff = malloc(BUFSIZ);
@@ -94,7 +90,7 @@ struct mntent *getmntent(FILE * filep)
}
tmp = getmntent_r(filep, &mnt, buff, BUFSIZ);
- UNLOCK;
+ __UCLIBC_MUTEX_UNLOCK(mylock);
return(tmp);
}