aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-02-18 01:44:51 -0500
committerMike Frysinger <vapier@gentoo.org>2009-02-18 02:21:10 -0500
commit72c4aa8d9f0f96c3c58c5d3d1f50066b386f0924 (patch)
treeb6153be43753c2aa74c3f39501854763766e2fa9
parentlibsandbox: simplify WRAPPER_PRE_CHECKS() a bit (diff)
downloadsandbox-72c4aa8d9f0f96c3c58c5d3d1f50066b386f0924.tar.gz
sandbox-72c4aa8d9f0f96c3c58c5d3d1f50066b386f0924.tar.bz2
sandbox-72c4aa8d9f0f96c3c58c5d3d1f50066b386f0924.zip
libsandbox: create hidden targets for most functions
In case we want to access a standard function unwrapped, create hidden functions that do just that. This creates a standard for most functions of the form sb_unwrapped_foo(). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--libsandbox/wrapper-funcs/__wrapper_simple.c17
-rw-r--r--localdecls.h1
2 files changed, 14 insertions, 4 deletions
diff --git a/libsandbox/wrapper-funcs/__wrapper_simple.c b/libsandbox/wrapper-funcs/__wrapper_simple.c
index b4f0328..8aaf612 100644
--- a/libsandbox/wrapper-funcs/__wrapper_simple.c
+++ b/libsandbox/wrapper-funcs/__wrapper_simple.c
@@ -21,15 +21,24 @@
extern WRAPPER_RET_TYPE EXTERN_NAME(WRAPPER_ARGS_PROTO);
static WRAPPER_RET_TYPE (*WRAPPER_TRUE_NAME)(WRAPPER_ARGS_PROTO) = NULL;
+#ifndef SB_HIDDEN_FUNC
+# define _SB_HIDDEN_FUNC(x) sb_unwrapped_##x
+# define SB_HIDDEN_FUNC(x) _SB_HIDDEN_FUNC(x)
+#endif
+attribute_hidden
+WRAPPER_RET_TYPE SB_HIDDEN_FUNC(WRAPPER_NAME)(WRAPPER_ARGS_PROTO)
+{
+ check_dlsym(WRAPPER_TRUE_NAME, WRAPPER_SYMNAME, WRAPPER_SYMVER);
+ return WRAPPER_TRUE_NAME(WRAPPER_ARGS);
+}
+
WRAPPER_RET_TYPE WRAPPER_NAME(WRAPPER_ARGS_PROTO)
{
WRAPPER_RET_TYPE result = WRAPPER_RET_DEFAULT;
if (WRAPPER_PRE_CHECKS())
- if (WRAPPER_SAFE()) {
- check_dlsym(WRAPPER_TRUE_NAME, WRAPPER_SYMNAME, WRAPPER_SYMVER);
- result = WRAPPER_TRUE_NAME(WRAPPER_ARGS);
- }
+ if (WRAPPER_SAFE())
+ result = SB_HIDDEN_FUNC(WRAPPER_NAME)(WRAPPER_ARGS);
return result;
}
diff --git a/localdecls.h b/localdecls.h
index 0371831..da8ad4c 100644
--- a/localdecls.h
+++ b/localdecls.h
@@ -78,5 +78,6 @@ extern char **environ;
# define weak_alias(_name, _aliasname) \
extern __typeof (_name) _aliasname __attribute__ ((weak, alias (#_name)));
+#define attribute_hidden __attribute__((visibility("hidden")))
#endif