1#include <selinux/selinux.h>
2#include <pthread.h>
3#include "dso.h"
4
5hidden_proto(selinux_mkload_policy)
6    hidden_proto(set_selinuxmnt)
7    hidden_proto(security_disable)
8    hidden_proto(security_policyvers)
9    hidden_proto(security_load_policy)
10    hidden_proto(security_get_boolean_active)
11    hidden_proto(security_get_boolean_names)
12    hidden_proto(security_set_boolean)
13    hidden_proto(security_commit_booleans)
14    hidden_proto(security_check_context)
15    hidden_proto(security_check_context_raw)
16    hidden_proto(security_canonicalize_context)
17    hidden_proto(security_canonicalize_context_raw)
18    hidden_proto(security_compute_av)
19    hidden_proto(security_compute_av_raw)
20    hidden_proto(security_compute_av_flags)
21    hidden_proto(security_compute_av_flags_raw)
22    hidden_proto(security_compute_user)
23    hidden_proto(security_compute_user_raw)
24    hidden_proto(security_compute_create)
25    hidden_proto(security_compute_create_raw)
26    hidden_proto(security_compute_member_raw)
27    hidden_proto(security_compute_relabel_raw)
28    hidden_proto(is_selinux_enabled)
29    hidden_proto(is_selinux_mls_enabled)
30    hidden_proto(freecon)
31    hidden_proto(freeconary)
32    hidden_proto(getprevcon)
33    hidden_proto(getprevcon_raw)
34    hidden_proto(getcon)
35    hidden_proto(getcon_raw)
36    hidden_proto(setcon_raw)
37    hidden_proto(getpeercon_raw)
38    hidden_proto(getpidcon_raw)
39    hidden_proto(getexeccon_raw)
40    hidden_proto(getfilecon)
41    hidden_proto(getfilecon_raw)
42    hidden_proto(lgetfilecon_raw)
43    hidden_proto(fgetfilecon_raw)
44    hidden_proto(setfilecon_raw)
45    hidden_proto(lsetfilecon_raw)
46    hidden_proto(fsetfilecon_raw)
47    hidden_proto(setexeccon)
48    hidden_proto(setexeccon_raw)
49    hidden_proto(getfscreatecon_raw)
50    hidden_proto(getkeycreatecon_raw)
51    hidden_proto(getsockcreatecon_raw)
52    hidden_proto(setfscreatecon_raw)
53    hidden_proto(setkeycreatecon_raw)
54    hidden_proto(setsockcreatecon_raw)
55    hidden_proto(security_getenforce)
56    hidden_proto(security_setenforce)
57    hidden_proto(security_deny_unknown)
58    hidden_proto(selinux_binary_policy_path)
59    hidden_proto(selinux_default_context_path)
60    hidden_proto(selinux_securetty_types_path)
61    hidden_proto(selinux_failsafe_context_path)
62    hidden_proto(selinux_removable_context_path)
63    hidden_proto(selinux_virtual_domain_context_path)
64    hidden_proto(selinux_virtual_image_context_path)
65    hidden_proto(selinux_file_context_path)
66    hidden_proto(selinux_file_context_homedir_path)
67    hidden_proto(selinux_file_context_local_path)
68    hidden_proto(selinux_file_context_subs_path)
69    hidden_proto(selinux_netfilter_context_path)
70    hidden_proto(selinux_homedir_context_path)
71    hidden_proto(selinux_user_contexts_path)
72    hidden_proto(selinux_booleans_path)
73    hidden_proto(selinux_customizable_types_path)
74    hidden_proto(selinux_media_context_path)
75    hidden_proto(selinux_x_context_path)
76    hidden_proto(selinux_sepgsql_context_path)
77    hidden_proto(selinux_path)
78    hidden_proto(selinux_check_passwd_access)
79    hidden_proto(selinux_check_securetty_context)
80    hidden_proto(matchpathcon_init_prefix)
81    hidden_proto(selinux_users_path)
82    hidden_proto(selinux_usersconf_path);
83hidden_proto(selinux_translations_path);
84hidden_proto(selinux_colors_path);
85hidden_proto(selinux_getenforcemode);
86hidden_proto(selinux_getpolicytype);
87hidden_proto(selinux_raw_to_trans_context);
88hidden_proto(selinux_trans_to_raw_context);
89    hidden_proto(selinux_raw_context_to_color);
90hidden_proto(security_get_initial_context);
91hidden_proto(security_get_initial_context_raw);
92hidden_proto(selinux_reset_config);
93
94extern int selinux_page_size hidden;
95
96/* Make pthread_once optional */
97#pragma weak pthread_once
98#pragma weak pthread_key_create
99#pragma weak pthread_key_delete
100#pragma weak pthread_setspecific
101
102/* Call handler iff the first call.  */
103#define __selinux_once(ONCE_CONTROL, INIT_FUNCTION)	\
104	do {						\
105		if (pthread_once != NULL)		\
106			pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION));  \
107		else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) {		  \
108			INIT_FUNCTION ();		\
109			(ONCE_CONTROL) = 2;		\
110		}					\
111	} while (0)
112
113/* Pthread key macros */
114#define __selinux_key_create(KEY, DESTRUCTOR)			\
115	do {							\
116		if (pthread_key_create != NULL)			\
117			pthread_key_create(KEY, DESTRUCTOR);	\
118	} while (0)
119
120#define __selinux_key_delete(KEY)				\
121	do {							\
122		if (pthread_key_delete != NULL)			\
123			pthread_key_delete(KEY);		\
124	} while (0)
125
126#define __selinux_setspecific(KEY, VALUE)			\
127	do {							\
128		if (pthread_setspecific != NULL)		\
129			pthread_setspecific(KEY, VALUE);	\
130	} while (0)
131
132
133