aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dirent/readdir_r.c2
-rw-r--r--src/dirent/rewinddir.c2
-rw-r--r--src/dirent/seekdir.c2
-rw-r--r--src/exit/abort.c2
-rw-r--r--src/exit/at_quick_exit.c1
-rw-r--r--src/exit/atexit.c1
-rw-r--r--src/internal/libc.h6
-rw-r--r--src/internal/lock.h9
-rw-r--r--src/locale/dcngettext.c1
-rw-r--r--src/locale/locale_map.c2
-rw-r--r--src/locale/setlocale.c2
-rw-r--r--src/malloc/lite_malloc.c2
-rw-r--r--src/misc/syslog.c2
-rw-r--r--src/prng/random.c2
-rw-r--r--src/signal/sigaction.c1
-rw-r--r--src/stdio/ofl.c2
-rw-r--r--src/thread/pthread_atfork.c1
-rw-r--r--src/thread/pthread_create.c1
-rw-r--r--src/thread/pthread_getschedparam.c1
-rw-r--r--src/thread/pthread_kill.c1
-rw-r--r--src/thread/pthread_setschedparam.c1
-rw-r--r--src/thread/pthread_setschedprio.c1
-rw-r--r--src/thread/sem_open.c2
-rw-r--r--src/thread/synccall.c1
-rw-r--r--src/time/__tz.c1
25 files changed, 32 insertions, 17 deletions
diff --git a/src/dirent/readdir_r.c b/src/dirent/readdir_r.c
index 6293a51..e2a818f 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 f205300..7ddda43 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 5be47d4..bf6cc6e 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 7c323d2..e1980f1 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 4079b24..d3ce652 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 cd3b0a6..160d277 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 0a27918..10bd66b 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 0000000..c77db6f
--- /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 eefa31a..7fbe719 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 e7b518a..2321bac 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 60e3353..11d823c 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 49157d3..050d84f 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 410709d..13d4b0a 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 13a5e6d..633a17f 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 2adedaa..af47195 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 0e3602a..f2d3215 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 c6f77b3..7649740 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 23dfe0a..3293dcd 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 05be424..1cba073 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 6d70e62..3d9395c 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 ab45f2f..038d13d 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 c353f6b..5bf4a01 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 1bd8020..de8555c 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 ba2f258..cc66bd2 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 6f5257f..51e6651 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;