diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dirent/readdir_r.c | 2 | ||||
-rw-r--r-- | src/dirent/rewinddir.c | 2 | ||||
-rw-r--r-- | src/dirent/seekdir.c | 2 | ||||
-rw-r--r-- | src/exit/abort.c | 2 | ||||
-rw-r--r-- | src/exit/at_quick_exit.c | 1 | ||||
-rw-r--r-- | src/exit/atexit.c | 1 | ||||
-rw-r--r-- | src/internal/libc.h | 6 | ||||
-rw-r--r-- | src/internal/lock.h | 9 | ||||
-rw-r--r-- | src/locale/dcngettext.c | 1 | ||||
-rw-r--r-- | src/locale/locale_map.c | 2 | ||||
-rw-r--r-- | src/locale/setlocale.c | 2 | ||||
-rw-r--r-- | src/malloc/lite_malloc.c | 2 | ||||
-rw-r--r-- | src/misc/syslog.c | 2 | ||||
-rw-r--r-- | src/prng/random.c | 2 | ||||
-rw-r--r-- | src/signal/sigaction.c | 1 | ||||
-rw-r--r-- | src/stdio/ofl.c | 2 | ||||
-rw-r--r-- | src/thread/pthread_atfork.c | 1 | ||||
-rw-r--r-- | src/thread/pthread_create.c | 1 | ||||
-rw-r--r-- | src/thread/pthread_getschedparam.c | 1 | ||||
-rw-r--r-- | src/thread/pthread_kill.c | 1 | ||||
-rw-r--r-- | src/thread/pthread_setschedparam.c | 1 | ||||
-rw-r--r-- | src/thread/pthread_setschedprio.c | 1 | ||||
-rw-r--r-- | src/thread/sem_open.c | 2 | ||||
-rw-r--r-- | src/thread/synccall.c | 1 | ||||
-rw-r--r-- | src/time/__tz.c | 1 |
25 files changed, 32 insertions, 17 deletions
diff --git a/src/dirent/readdir_r.c b/src/dirent/readdir_r.c index 6293a514..e2a818f3 100644 --- a/src/dirent/readdir_r.c +++ b/src/dirent/readdir_r.c @@ -2,7 +2,7 @@ #include <errno.h> #include <string.h> #include "__dirent.h" -#include "libc.h" +#include "lock.h" int readdir_r(DIR *restrict dir, struct dirent *restrict buf, struct dirent **restrict result) { diff --git a/src/dirent/rewinddir.c b/src/dirent/rewinddir.c index f2053008..7ddda437 100644 --- a/src/dirent/rewinddir.c +++ b/src/dirent/rewinddir.c @@ -1,7 +1,7 @@ #include <dirent.h> #include <unistd.h> #include "__dirent.h" -#include "libc.h" +#include "lock.h" void rewinddir(DIR *dir) { diff --git a/src/dirent/seekdir.c b/src/dirent/seekdir.c index 5be47d4a..bf6cc6ec 100644 --- a/src/dirent/seekdir.c +++ b/src/dirent/seekdir.c @@ -1,7 +1,7 @@ #include <dirent.h> #include <unistd.h> #include "__dirent.h" -#include "libc.h" +#include "lock.h" void seekdir(DIR *dir, long off) { diff --git a/src/exit/abort.c b/src/exit/abort.c index 7c323d26..e1980f10 100644 --- a/src/exit/abort.c +++ b/src/exit/abort.c @@ -3,7 +3,7 @@ #include "syscall.h" #include "pthread_impl.h" #include "atomic.h" -#include "libc.h" +#include "lock.h" #include "ksigaction.h" hidden volatile int __abort_lock[1]; diff --git a/src/exit/at_quick_exit.c b/src/exit/at_quick_exit.c index 4079b242..d3ce6522 100644 --- a/src/exit/at_quick_exit.c +++ b/src/exit/at_quick_exit.c @@ -1,5 +1,6 @@ #include <stdlib.h> #include "libc.h" +#include "lock.h" #define COUNT 32 diff --git a/src/exit/atexit.c b/src/exit/atexit.c index cd3b0a64..160d277a 100644 --- a/src/exit/atexit.c +++ b/src/exit/atexit.c @@ -1,6 +1,7 @@ #include <stdlib.h> #include <stdint.h> #include "libc.h" +#include "lock.h" /* Ensure that at least 32 atexit handlers can be registered without malloc */ #define COUNT 32 diff --git a/src/internal/libc.h b/src/internal/libc.h index 0a279184..10bd66bd 100644 --- a/src/internal/libc.h +++ b/src/internal/libc.h @@ -51,12 +51,6 @@ extern char *__progname, *__progname_full; extern hidden const char __libc_version[]; -/* Designed to avoid any overhead in non-threaded processes */ -hidden void __lock(volatile int *); -hidden void __unlock(volatile int *); -#define LOCK(x) __lock(x) -#define UNLOCK(x) __unlock(x) - hidden void __synccall(void (*)(void *), void *); hidden int __setxid(int, int, int, int); diff --git a/src/internal/lock.h b/src/internal/lock.h new file mode 100644 index 00000000..c77db6f7 --- /dev/null +++ b/src/internal/lock.h @@ -0,0 +1,9 @@ +#ifndef LOCK_H +#define LOCK_H + +hidden void __lock(volatile int *); +hidden void __unlock(volatile int *); +#define LOCK(x) __lock(x) +#define UNLOCK(x) __unlock(x) + +#endif diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c index eefa31a8..7fbe7196 100644 --- a/src/locale/dcngettext.c +++ b/src/locale/dcngettext.c @@ -9,6 +9,7 @@ #include "locale_impl.h" #include "atomic.h" #include "pleval.h" +#include "lock.h" struct binding { struct binding *next; diff --git a/src/locale/locale_map.c b/src/locale/locale_map.c index e7b518a1..2321bac0 100644 --- a/src/locale/locale_map.c +++ b/src/locale/locale_map.c @@ -3,7 +3,7 @@ #include <sys/mman.h> #include "locale_impl.h" #include "libc.h" -#include "atomic.h" +#include "lock.h" const char *__lctrans_impl(const char *msg, const struct __locale_map *lm) { diff --git a/src/locale/setlocale.c b/src/locale/setlocale.c index 60e3353c..11d823ce 100644 --- a/src/locale/setlocale.c +++ b/src/locale/setlocale.c @@ -3,7 +3,7 @@ #include <string.h> #include "locale_impl.h" #include "libc.h" -#include "atomic.h" +#include "lock.h" static char buf[LC_ALL*(LOCALE_NAME_MAX+1)]; diff --git a/src/malloc/lite_malloc.c b/src/malloc/lite_malloc.c index 49157d36..050d84f6 100644 --- a/src/malloc/lite_malloc.c +++ b/src/malloc/lite_malloc.c @@ -2,7 +2,7 @@ #include <stdint.h> #include <limits.h> #include <errno.h> -#include "libc.h" +#include "lock.h" #include "malloc_impl.h" #define ALIGN 16 diff --git a/src/misc/syslog.c b/src/misc/syslog.c index 410709d7..13d4b0a6 100644 --- a/src/misc/syslog.c +++ b/src/misc/syslog.c @@ -9,7 +9,7 @@ #include <pthread.h> #include <errno.h> #include <fcntl.h> -#include "libc.h" +#include "lock.h" static volatile int lock[1]; static char log_ident[32]; diff --git a/src/prng/random.c b/src/prng/random.c index 13a5e6df..633a17f6 100644 --- a/src/prng/random.c +++ b/src/prng/random.c @@ -1,6 +1,6 @@ #include <stdlib.h> #include <stdint.h> -#include "libc.h" +#include "lock.h" /* this code uses the same lagged fibonacci generator as the diff --git a/src/signal/sigaction.c b/src/signal/sigaction.c index 2adedaa4..af47195e 100644 --- a/src/signal/sigaction.c +++ b/src/signal/sigaction.c @@ -4,6 +4,7 @@ #include "syscall.h" #include "pthread_impl.h" #include "libc.h" +#include "lock.h" #include "ksigaction.h" volatile int dummy_lock[1] = { 0 }; diff --git a/src/stdio/ofl.c b/src/stdio/ofl.c index 0e3602aa..f2d3215a 100644 --- a/src/stdio/ofl.c +++ b/src/stdio/ofl.c @@ -1,5 +1,5 @@ #include "stdio_impl.h" -#include "libc.h" +#include "lock.h" static FILE *ofl_head; static volatile int ofl_lock[1]; diff --git a/src/thread/pthread_atfork.c b/src/thread/pthread_atfork.c index c6f77b3f..76497401 100644 --- a/src/thread/pthread_atfork.c +++ b/src/thread/pthread_atfork.c @@ -1,5 +1,6 @@ #include <pthread.h> #include "libc.h" +#include "lock.h" static struct atfork_funcs { void (*prepare)(void); diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 23dfe0ad..3293dcd5 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -2,6 +2,7 @@ #include "pthread_impl.h" #include "stdio_impl.h" #include "libc.h" +#include "lock.h" #include <sys/mman.h> #include <string.h> #include <stddef.h> diff --git a/src/thread/pthread_getschedparam.c b/src/thread/pthread_getschedparam.c index 05be4242..1cba073d 100644 --- a/src/thread/pthread_getschedparam.c +++ b/src/thread/pthread_getschedparam.c @@ -1,4 +1,5 @@ #include "pthread_impl.h" +#include "lock.h" int pthread_getschedparam(pthread_t t, int *restrict policy, struct sched_param *restrict param) { diff --git a/src/thread/pthread_kill.c b/src/thread/pthread_kill.c index 6d70e626..3d9395cb 100644 --- a/src/thread/pthread_kill.c +++ b/src/thread/pthread_kill.c @@ -1,4 +1,5 @@ #include "pthread_impl.h" +#include "lock.h" int pthread_kill(pthread_t t, int sig) { diff --git a/src/thread/pthread_setschedparam.c b/src/thread/pthread_setschedparam.c index ab45f2ff..038d13d8 100644 --- a/src/thread/pthread_setschedparam.c +++ b/src/thread/pthread_setschedparam.c @@ -1,4 +1,5 @@ #include "pthread_impl.h" +#include "lock.h" int pthread_setschedparam(pthread_t t, int policy, const struct sched_param *param) { diff --git a/src/thread/pthread_setschedprio.c b/src/thread/pthread_setschedprio.c index c353f6b5..5bf4a019 100644 --- a/src/thread/pthread_setschedprio.c +++ b/src/thread/pthread_setschedprio.c @@ -1,4 +1,5 @@ #include "pthread_impl.h" +#include "lock.h" int pthread_setschedprio(pthread_t t, int prio) { diff --git a/src/thread/sem_open.c b/src/thread/sem_open.c index 1bd8020a..de8555c5 100644 --- a/src/thread/sem_open.c +++ b/src/thread/sem_open.c @@ -11,7 +11,7 @@ #include <sys/stat.h> #include <stdlib.h> #include <pthread.h> -#include "libc.h" +#include "lock.h" static struct { ino_t ino; diff --git a/src/thread/synccall.c b/src/thread/synccall.c index ba2f258e..cc66bd24 100644 --- a/src/thread/synccall.c +++ b/src/thread/synccall.c @@ -7,6 +7,7 @@ #include "futex.h" #include "atomic.h" #include "../dirent/__dirent.h" +#include "lock.h" static struct chain { struct chain *next; diff --git a/src/time/__tz.c b/src/time/__tz.c index 6f5257fe..51e66514 100644 --- a/src/time/__tz.c +++ b/src/time/__tz.c @@ -5,6 +5,7 @@ #include <string.h> #include <sys/mman.h> #include "libc.h" +#include "lock.h" long __timezone = 0; int __daylight = 0; |