From 9990829d38e8d6b09ca6313b53ebc24368889ae0 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Sat, 28 Oct 2017 21:23:14 +0000 Subject: Change pthread_cleanup_{push,pop} to macros that store the cleanup info on the stack instead of mallocing the list and move the APIs from libpthread to libc so that they can be used inside libc. Note: the standard was explicitly written to permit/support this "macro with unmatched brace" style and it's what basically everyone else already does. We xor the info with random cookies with a random magic to detect/trip-up overwrites. Major bump to both libc and libpthread due to the API move. ok mpi@ --- src/lib/libc/include/thread_private.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/lib/libc') diff --git a/src/lib/libc/include/thread_private.h b/src/lib/libc/include/thread_private.h index 23faa73faa..6c695ee5ee 100644 --- a/src/lib/libc/include/thread_private.h +++ b/src/lib/libc/include/thread_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: thread_private.h,v 1.30 2017/09/05 02:40:54 guenther Exp $ */ +/* $OpenBSD: thread_private.h,v 1.31 2017/10/28 21:23:14 guenther Exp $ */ /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman */ @@ -344,12 +344,6 @@ struct rthread_storage { void *data; }; -struct rthread_cleanup_fn { - void (*fn)(void *); - void *arg; - struct rthread_cleanup_fn *next; -}; - struct tib; struct stack; struct pthread { @@ -367,7 +361,7 @@ struct pthread { pthread_cond_t blocking_cond; struct pthread_attr attr; struct rthread_storage *local_storage; - struct rthread_cleanup_fn *cleanup_fns; + struct __thread_cleanup *cleanup_fns; /* cancel received in a delayed cancel block? */ int delayed_cancel; -- cgit v1.2.3-55-g6feb