summaryrefslogtreecommitdiffstats
path: root/lib/libc/thread
diff options
context:
space:
mode:
authormarc <marc@openbsd.org>2002-11-03 20:36:43 +0000
committermarc <marc@openbsd.org>2002-11-03 20:36:43 +0000
commit7d696152b04eda612deebda7dd931656647baf68 (patch)
treec8d6614acef79d09c5a8c85d3b59a6535a731ded /lib/libc/thread
parentYou can't always cast pointer to int on because the sizes are (diff)
downloadwireguard-openbsd-7d696152b04eda612deebda7dd931656647baf68.tar.xz
wireguard-openbsd-7d696152b04eda612deebda7dd931656647baf68.zip
libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@), powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@), sparc64 (marc@), and vax (millert@ and miod@). Thanks to millert@, miod@, and mickey@ for fixes along the way.
Diffstat (limited to 'lib/libc/thread')
-rw-r--r--lib/libc/thread/Makefile.inc4
-rw-r--r--lib/libc/thread/thread_fd.c37
-rw-r--r--lib/libc/thread/unithread_malloc_lock.c16
3 files changed, 20 insertions, 37 deletions
diff --git a/lib/libc/thread/Makefile.inc b/lib/libc/thread/Makefile.inc
index 8abec94f330..4d35600ff1c 100644
--- a/lib/libc/thread/Makefile.inc
+++ b/lib/libc/thread/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.2 2000/01/06 15:07:06 d Exp $
+# $OpenBSD: Makefile.inc,v 1.3 2002/11/03 20:36:43 marc Exp $
.PATH: ${LIBCSRCDIR}/thread
-SRCS+= thread_fd.c unithread_storage.c
+SRCS+= thread_fd.c unithread_storage.c unithread_malloc_lock.c
diff --git a/lib/libc/thread/thread_fd.c b/lib/libc/thread/thread_fd.c
index 1d0e50d65a6..ffea643f58f 100644
--- a/lib/libc/thread/thread_fd.c
+++ b/lib/libc/thread/thread_fd.c
@@ -1,52 +1,25 @@
-/* $OpenBSD: thread_fd.c,v 1.4 2001/09/04 22:17:45 fgsch Exp $ */
+/* $OpenBSD: thread_fd.c,v 1.5 2002/11/03 20:36:43 marc Exp $ */
#include <sys/time.h>
#include <pthread.h>
#include "thread_private.h"
WEAK_PROTOTYPE(_thread_fd_lock);
-WEAK_PROTOTYPE(_thread_fd_lock_debug);
WEAK_PROTOTYPE(_thread_fd_unlock);
-WEAK_PROTOTYPE(_thread_fd_unlock_debug);
WEAK_ALIAS(_thread_fd_lock);
-WEAK_ALIAS(_thread_fd_lock_debug);
WEAK_ALIAS(_thread_fd_unlock);
-WEAK_ALIAS(_thread_fd_unlock_debug);
int
-WEAK_NAME(_thread_fd_lock)(fd, lock_type, timeout)
- int fd;
- int lock_type;
- struct timespec *timeout;
+WEAK_NAME(_thread_fd_lock)(int fd, int lock_type, struct timespec *timeout,
+ const char *fname, int lineno)
{
return 0;
}
-int
-WEAK_NAME(_thread_fd_lock_debug)(fd, lock_type, timeout, fname, lineno)
- int fd;
- int lock_type;
- struct timespec *timeout;
- char *fname;
- int lineno;
-{
- return 0;
-}
-
-void
-WEAK_NAME(_thread_fd_unlock)(fd, lock_type)
- int fd;
- int lock_type;
-{
-}
-
void
-WEAK_NAME(_thread_fd_unlock_debug)(fd, lock_type, fname, lineno)
- int fd;
- int lock_type;
- char *fname;
- int lineno;
+WEAK_NAME(_thread_fd_unlock)(int fd, int lock_type, const char *fname,
+ int lineno)
{
}
diff --git a/lib/libc/thread/unithread_malloc_lock.c b/lib/libc/thread/unithread_malloc_lock.c
index 67e51559180..abe1a172b65 100644
--- a/lib/libc/thread/unithread_malloc_lock.c
+++ b/lib/libc/thread/unithread_malloc_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unithread_malloc_lock.c,v 1.1 2000/01/14 06:16:37 d Exp $ */
+/* $OpenBSD: unithread_malloc_lock.c,v 1.2 2002/11/03 20:36:43 marc Exp $ */
#include <sys/cdefs.h>
#include <pthread.h>
@@ -6,16 +6,26 @@
WEAK_PROTOTYPE(_thread_malloc_lock);
WEAK_PROTOTYPE(_thread_malloc_unlock);
+WEAK_PROTOTYPE(_thread_malloc_init);
WEAK_ALIAS(_thread_malloc_lock);
WEAK_ALIAS(_thread_malloc_unlock);
+WEAK_ALIAS(_thread_malloc_init);
void
-WEAK_NAME(_thread_malloc_lock)()
+WEAK_NAME(_thread_malloc_lock)(void)
{
+ return;
}
void
-WEAK_NAME(_thread_malloc_unlock)()
+WEAK_NAME(_thread_malloc_unlock)(void)
{
+ return;
+}
+
+void
+WEAK_NAME(_thread_malloc_init)(void)
+{
+ return;
}