diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-06-21 23:28:46 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-06-24 10:05:50 +0200 |
commit | 2d32453bc808a061a45bc5d345746a7c99b4b52f (patch) | |
tree | 126eae7343c9a45e0470876976e327fa83d7e7a7 /src/shared/dlfcn-util.h | |
parent | 6a818c3cb4cba768dc42efa84db2fbd938f5def0 (diff) | |
download | systemd-2d32453bc808a061a45bc5d345746a7c99b4b52f.tar.gz |
basic,shared: move dlopen helpers to shared/
This was added in 88d775b734644f26fb490836769c2bc275498fde,
with the apparent intent of using in shared/ and the rest of our code.
It doesn't matter much for our code, since libdl is part of glibc anyway,
but moving it removes one linkage from libsystemd. (libshared was already
linking to libdl explicitly).
Diffstat (limited to 'src/shared/dlfcn-util.h')
-rw-r--r-- | src/shared/dlfcn-util.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/dlfcn-util.h b/src/shared/dlfcn-util.h new file mode 100644 index 0000000000..aa713d328b --- /dev/null +++ b/src/shared/dlfcn-util.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include <dlfcn.h> + +#include "macro.h" + +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(void*, dlclose, NULL); + +int dlsym_many_and_warn(void *dl, int level, ...); + +/* Macro useful for putting together variable/symbol name pairs when calling dlsym_many_and_warn(). Assumes + * that each library symbol to resolve will be placed in a variable with the "sym_" prefix, i.e. a symbol + * "foobar" is loaded into a variable "sym_foobar". */ +#define DLSYM_ARG(arg) \ + &sym_##arg, STRINGIFY(arg) |