summaryrefslogtreecommitdiff
path: root/src/lib/libc/include/thread_private.h
diff options
context:
space:
mode:
authorguenther <>2015-04-07 01:27:07 +0000
committerguenther <>2015-04-07 01:27:07 +0000
commit8a98fefea13a82a7e7355353723c8ee1722456e7 (patch)
treef516e404d864d5abc848130431ad93c0aa43674c /src/lib/libc/include/thread_private.h
parent5bc886238be15ae40e7b95f920d80bf191b2ae70 (diff)
downloadopenbsd-8a98fefea13a82a7e7355353723c8ee1722456e7.tar.gz
openbsd-8a98fefea13a82a7e7355353723c8ee1722456e7.tar.bz2
openbsd-8a98fefea13a82a7e7355353723c8ee1722456e7.zip
Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback handling from libpthread to libc, though libpthread still overrides the inner call to handle locking and thread-library reinitialization. Major version bump for both libc and libpthread. verification that this fixes various ports ajacoutot@ asm assistance miod@; ok millert@ deraadt@
Diffstat (limited to 'src/lib/libc/include/thread_private.h')
-rw-r--r--src/lib/libc/include/thread_private.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/libc/include/thread_private.h b/src/lib/libc/include/thread_private.h
index 673fb9c6a6..43ebf7d96e 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.25 2011/10/16 06:29:56 guenther Exp $ */ 1/* $OpenBSD: thread_private.h,v 1.26 2015/04/07 01:27:07 guenther 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
@@ -160,6 +160,18 @@ void _thread_atexit_unlock(void);
160 _thread_atexit_unlock();\ 160 _thread_atexit_unlock();\
161 } while (0) 161 } while (0)
162 162
163void _thread_atfork_lock(void);
164void _thread_atfork_unlock(void);
165
166#define _ATFORK_LOCK() do { \
167 if (__isthreaded) \
168 _thread_atfork_lock(); \
169 } while (0)
170#define _ATFORK_UNLOCK() do { \
171 if (__isthreaded) \
172 _thread_atfork_unlock();\
173 } while (0)
174
163void _thread_arc4_lock(void); 175void _thread_arc4_lock(void);
164void _thread_arc4_unlock(void); 176void _thread_arc4_unlock(void);
165 177
@@ -172,4 +184,9 @@ void _thread_arc4_unlock(void);
172 _thread_arc4_unlock();\ 184 _thread_arc4_unlock();\
173 } while (0) 185 } while (0)
174 186
187/*
188 * Wrapper for _thread_sys_fork()
189 */
190pid_t _thread_fork(void);
191
175#endif /* _THREAD_PRIVATE_H_ */ 192#endif /* _THREAD_PRIVATE_H_ */