dlopen: take log_level argument and log in fallback stubs
Every dlopen_xxx() helper now takes an int log_level argument. It is passed through to dlopen_many_sym_or_warn() (which in turn propagates it to dlopen_verbose() for the library-not-installed case), and is used by the fallback stub when support for the library is not compiled in to emit a "<lib> support is not compiled in." message at the caller's level. Callers pass LOG_DEBUG when gracefully degrading, or a higher level when the failure should surface, and no longer need to log redundantly at the call site. As part of this, dlopen_bpf_full() (which already took a log_level) is merged into dlopen_bpf() rather than keeping both. The static inline fallbacks used to live in the headers, which required pulling log.h in from every header that declared a dlopen_xxx(). Move them into the .c files instead: the declaration is always outside the #if HAVE_XXX block, the impl sits outside the outer #if HAVE_XXX wrap with its own internal #if HAVE_XXX/#else/#endif, and apparmor-util.c, idn-util.c, libmount-util.c and pam-util.c are now always compiled so they can host their stubs.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
2d28d3cb91
commit
d49f3f287a
@@ -23,8 +23,6 @@ extern DLSYM_PROTOTYPE(seccomp_rule_add_exact);
|
||||
extern DLSYM_PROTOTYPE(seccomp_syscall_resolve_name);
|
||||
extern DLSYM_PROTOTYPE(seccomp_syscall_resolve_num_arch);
|
||||
|
||||
int dlopen_libseccomp(void);
|
||||
|
||||
DECLARE_STRING_TABLE_LOOKUP_TO_STRING(seccomp_arch, uint32_t);
|
||||
int seccomp_arch_from_string(const char *n, uint32_t *ret);
|
||||
|
||||
@@ -163,12 +161,11 @@ static inline bool is_seccomp_available(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int dlopen_libseccomp(void) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int dlopen_libseccomp(int log_level);
|
||||
|
||||
/* This is a special value to be used where syscall filters otherwise expect errno numbers, will be
|
||||
replaced with real seccomp action. */
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user