diff options
author | 2008-01-01 00:43:39 +0000 | |
---|---|---|
committer | 2008-01-01 00:43:39 +0000 | |
commit | 229f4f6ee4c7ecffe38220a1baa321e3465d69d6 (patch) | |
tree | 8958250da2db5f655350d351427431e7df1af2e8 /lib/libc/include | |
parent | fix name (diff) | |
download | wireguard-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/include')
-rw-r--r-- | lib/libc/include/thread_private.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libc/include/thread_private.h b/lib/libc/include/thread_private.h index 146f0b0a015..f55880f7bae 100644 --- a/lib/libc/include/thread_private.h +++ b/lib/libc/include/thread_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: thread_private.h,v 1.21 2007/11/19 02:54:19 kurt Exp $ */ +/* $OpenBSD: thread_private.h,v 1.22 2008/01/01 00:43:39 kurt Exp $ */ /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ @@ -150,4 +150,16 @@ void _thread_atexit_unlock(void); _thread_atexit_unlock();\ } while (0) +void _thread_arc4_lock(void); +void _thread_arc4_unlock(void); + +#define _ARC4_LOCK() do { \ + if (__isthreaded) \ + _thread_arc4_lock(); \ + } while (0) +#define _ARC4_UNLOCK() do { \ + if (__isthreaded) \ + _thread_arc4_unlock();\ + } while (0) + #endif /* _THREAD_PRIVATE_H_ */ |