summaryrefslogtreecommitdiffstats
path: root/lib/libc/thread/unithread_malloc_lock.c
diff options
context:
space:
mode:
authorkurt <kurt@openbsd.org>2008-01-01 00:43:39 +0000
committerkurt <kurt@openbsd.org>2008-01-01 00:43:39 +0000
commit229f4f6ee4c7ecffe38220a1baa321e3465d69d6 (patch)
tree8958250da2db5f655350d351427431e7df1af2e8 /lib/libc/thread/unithread_malloc_lock.c
parentfix name (diff)
downloadwireguard-openbsd-229f4f6ee4c7ecffe38220a1baa321e3465d69d6.tar.xz
wireguard-openbsd-229f4f6ee4c7ecffe38220a1baa321e3465d69d6.zip
- make arc4random*() functions thread safe. Use a custom spinlock function
instead of the generic pthread macros since free(3) uses __arc4_getbyte() when freeing small sized allocations and the generic pthread macros call malloc(3). - eliminate passing pointers to a static variable with global scope (rs) for additional code clarity and reduction. - shlib minor bumps for libc and libpthread due to new functions. From andreas@ with some bits from me. okay tedu@ marc@ w/some spot checking from millert@
Diffstat (limited to 'lib/libc/thread/unithread_malloc_lock.c')
-rw-r--r--lib/libc/thread/unithread_malloc_lock.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/libc/thread/unithread_malloc_lock.c b/lib/libc/thread/unithread_malloc_lock.c
index f7231915d6f..ca5081ba780 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.6 2006/02/22 07:16:32 otto Exp $ */
+/* $OpenBSD: unithread_malloc_lock.c,v 1.7 2008/01/01 00:43:39 kurt Exp $ */
#include <sys/time.h>
#include "thread_private.h"
@@ -17,6 +17,12 @@ WEAK_PROTOTYPE(_thread_atexit_unlock);
WEAK_ALIAS(_thread_atexit_lock);
WEAK_ALIAS(_thread_atexit_unlock);
+WEAK_PROTOTYPE(_thread_arc4_lock);
+WEAK_PROTOTYPE(_thread_arc4_unlock);
+
+WEAK_ALIAS(_thread_arc4_lock);
+WEAK_ALIAS(_thread_arc4_unlock);
+
void
WEAK_NAME(_thread_malloc_lock)(void)
{
@@ -46,3 +52,15 @@ WEAK_NAME(_thread_atexit_unlock)(void)
{
return;
}
+
+void
+WEAK_NAME(_thread_arc4_lock)(void)
+{
+ return;
+}
+
+void
+WEAK_NAME(_thread_arc4_unlock)(void)
+{
+ return;
+}