diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-12-06 01:29:10 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-12-06 01:29:10 +0000 |
commit | aab07d0500d06e1de93280cb9900b24fd0c0875b (patch) | |
tree | 7122ec94b0498c150b69401a13f06aaea803cf50 /libc/misc | |
parent | 680f8428162687caae571090e008b42d18f2bb5a (diff) |
macro out the thread funcs in libc if threading is disabled
Diffstat (limited to 'libc/misc')
-rw-r--r-- | libc/misc/dirent/closedir.c | 4 | ||||
-rw-r--r-- | libc/misc/dirent/opendir.c | 2 | ||||
-rw-r--r-- | libc/misc/dirent/readdir.c | 4 | ||||
-rw-r--r-- | libc/misc/dirent/readdir64.c | 4 | ||||
-rw-r--r-- | libc/misc/dirent/readdir64_r.c | 4 | ||||
-rw-r--r-- | libc/misc/dirent/readdir_r.c | 8 | ||||
-rw-r--r-- | libc/misc/dirent/rewinddir.c | 4 | ||||
-rw-r--r-- | libc/misc/dirent/seekdir.c | 5 | ||||
-rw-r--r-- | libc/misc/mntent/mntent.c | 9 | ||||
-rw-r--r-- | libc/misc/syslog/syslog.c | 9 | ||||
-rw-r--r-- | libc/misc/time/time.c | 13 | ||||
-rw-r--r-- | libc/misc/utmp/utent.c | 9 |
12 files changed, 13 insertions, 62 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 } diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index 1af5a6b67..35767280e 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -7,14 +7,11 @@ #include <mntent.h> #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) /* Reentrant version of getmntent. */ struct mntent *getmntent_r (FILE *filep, diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index e05297770..5605aecf1 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -86,14 +86,11 @@ #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) static int LogFile = -1; /* fd for log */ diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index d7cf1806e..65b925cf6 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -199,21 +199,12 @@ typedef struct { } rule_struct; #ifdef __UCLIBC_HAS_THREADS__ - -#include <pthread.h> - +# include <pthread.h> extern pthread_mutex_t _time_tzlock; - +#endif #define TZLOCK __pthread_mutex_lock(&_time_tzlock) #define TZUNLOCK __pthread_mutex_unlock(&_time_tzlock) -#else - -#define TZLOCK ((void) 0) -#define TZUNLOCK ((void) 0) - -#endif - extern rule_struct _time_tzinfo[2]; extern struct tm *_time_t2tm(const time_t *__restrict timer, diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index c3d9ab620..e03d4528f 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -23,14 +23,11 @@ #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t utmplock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&utmplock) -# define UNLOCK __pthread_mutex_unlock(&utmplock) -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&utmplock) +#define UNLOCK __pthread_mutex_unlock(&utmplock) |