diff options
Diffstat (limited to 'libselinux/src/selinux_internal.h')
-rw-r--r-- | libselinux/src/selinux_internal.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libselinux/src/selinux_internal.h b/libselinux/src/selinux_internal.h index bbd9eee7..7a2c1ad5 100644 --- a/libselinux/src/selinux_internal.h +++ b/libselinux/src/selinux_internal.h @@ -1,4 +1,5 @@ #include <selinux/selinux.h> +#include <pthread.h> #include "dso.h" hidden_proto(selinux_mkload_policy) @@ -92,3 +93,19 @@ extern void reset_selinux_config(void) hidden; extern int load_setlocaldefs hidden; extern int require_seusers hidden; extern int selinux_page_size hidden; + +/* Make pthread_once optional */ +#pragma weak pthread_once + +/* Call handler iff the first call. */ +#define __selinux_once(ONCE_CONTROL, INIT_FUNCTION) \ + do { \ + if (pthread_once != NULL) \ + pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION)); \ + else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ + INIT_FUNCTION (); \ + (ONCE_CONTROL) = 2; \ + } \ + } while (0) + + |