diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-02-18 01:44:51 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-02-18 02:21:10 -0500 |
commit | 72c4aa8d9f0f96c3c58c5d3d1f50066b386f0924 (patch) | |
tree | b6153be43753c2aa74c3f39501854763766e2fa9 | |
parent | libsandbox: simplify WRAPPER_PRE_CHECKS() a bit (diff) | |
download | sandbox-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.c | 17 | ||||
-rw-r--r-- | localdecls.h | 1 |
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 |