diff options
author | kurt <> | 2008-01-01 00:43:39 +0000 |
---|---|---|
committer | kurt <> | 2008-01-01 00:43:39 +0000 |
commit | d08c4e4910d78ef0ddd9e7917c1f2d61b0021d4a (patch) | |
tree | 1b1ce1f0d947d24732897206517a88ade3843c65 /src/lib/libc/include | |
parent | dea3d5b72ccc6bd1dad92e25f49aaa4f48cc4064 (diff) | |
download | openbsd-d08c4e4910d78ef0ddd9e7917c1f2d61b0021d4a.tar.gz openbsd-d08c4e4910d78ef0ddd9e7917c1f2d61b0021d4a.tar.bz2 openbsd-d08c4e4910d78ef0ddd9e7917c1f2d61b0021d4a.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 'src/lib/libc/include')
-rw-r--r-- | src/lib/libc/include/thread_private.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/libc/include/thread_private.h b/src/lib/libc/include/thread_private.h index 146f0b0a01..f55880f7ba 100644 --- a/src/lib/libc/include/thread_private.h +++ b/src/lib/libc/include/thread_private.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: thread_private.h,v 1.21 2007/11/19 02:54:19 kurt Exp $ */ | 1 | /* $OpenBSD: thread_private.h,v 1.22 2008/01/01 00:43:39 kurt Exp $ */ |
2 | 2 | ||
3 | /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ | 3 | /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ |
4 | 4 | ||
@@ -150,4 +150,16 @@ void _thread_atexit_unlock(void); | |||
150 | _thread_atexit_unlock();\ | 150 | _thread_atexit_unlock();\ |
151 | } while (0) | 151 | } while (0) |
152 | 152 | ||
153 | void _thread_arc4_lock(void); | ||
154 | void _thread_arc4_unlock(void); | ||
155 | |||
156 | #define _ARC4_LOCK() do { \ | ||
157 | if (__isthreaded) \ | ||
158 | _thread_arc4_lock(); \ | ||
159 | } while (0) | ||
160 | #define _ARC4_UNLOCK() do { \ | ||
161 | if (__isthreaded) \ | ||
162 | _thread_arc4_unlock();\ | ||
163 | } while (0) | ||
164 | |||
153 | #endif /* _THREAD_PRIVATE_H_ */ | 165 | #endif /* _THREAD_PRIVATE_H_ */ |