#include "unaligned.h"
#if HAVE_XZ
-static void *lzma_dl = NULL;
-
static DLSYM_PROTOTYPE(lzma_code) = NULL;
static DLSYM_PROTOTYPE(lzma_easy_encoder) = NULL;
static DLSYM_PROTOTYPE(lzma_end) = NULL;
#endif
#if HAVE_LZ4
-static void *lz4_dl = NULL;
-
static DLSYM_PROTOTYPE(LZ4F_compressBegin) = NULL;
static DLSYM_PROTOTYPE(LZ4F_compressBound) = NULL;
static DLSYM_PROTOTYPE(LZ4F_compressEnd) = NULL;
#endif
#if HAVE_ZSTD
-static void *zstd_dl = NULL;
-
static DLSYM_PROTOTYPE(ZSTD_CCtx_setParameter) = NULL;
static DLSYM_PROTOTYPE(ZSTD_compress) = NULL;
static DLSYM_PROTOTYPE(ZSTD_compressStream2) = NULL;
#endif
#if HAVE_ZLIB
-static void *zlib_dl = NULL;
-
static DLSYM_PROTOTYPE(deflateInit2_) = NULL;
static DLSYM_PROTOTYPE(deflate) = NULL;
static DLSYM_PROTOTYPE(deflateEnd) = NULL;
#endif
#if HAVE_BZIP2
-static void *bzip2_dl = NULL;
-
static DLSYM_PROTOTYPE(BZ2_bzCompressInit) = NULL;
static DLSYM_PROTOTYPE(BZ2_bzCompress) = NULL;
static DLSYM_PROTOTYPE(BZ2_bzCompressEnd) = NULL;
int dlopen_xz(int log_level) {
#if HAVE_XZ
+ static void *lzma_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"lzma",
"Support lzma compression in journal and coredump files",
int dlopen_lz4(int log_level) {
#if HAVE_LZ4
+ static void *lz4_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"lz4",
"Support lz4 compression in journal and coredump files",
int dlopen_zstd(int log_level) {
#if HAVE_ZSTD
+ static void *zstd_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"zstd",
"Support zstd compression in journal and coredump files",
int dlopen_zlib(int log_level) {
#if HAVE_ZLIB
+ static void *zlib_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"zlib",
"Support gzip compression and decompression",
int dlopen_bzip2(int log_level) {
#if HAVE_BZIP2
+ static void *bzip2_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"bzip2",
"Support bzip2 compression and decompression",
#if HAVE_GCRYPT
-static void *gcrypt_dl = NULL;
-
static DLSYM_PROTOTYPE(gcry_control) = NULL;
static DLSYM_PROTOTYPE(gcry_check_version) = NULL;
DLSYM_PROTOTYPE(gcry_md_close) = NULL;
int dlopen_gcrypt(int log_level) {
#if HAVE_GCRYPT
+ static void *gcrypt_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"gcrypt",
"Support for journald forward-sealing",
#include "tests.h"
#if HAVE_GLIB
-static void *glib_dl = NULL;
static DLSYM_PROTOTYPE(g_dbus_message_new_from_blob) = NULL;
static DLSYM_PROTOTYPE(g_dbus_message_print) = NULL;
static DLSYM_PROTOTYPE(g_free) = NULL;
static DLSYM_PROTOTYPE(g_object_unref) = NULL;
static int dlopen_glib(void) {
+ static void *glib_dl = NULL;
+
return dlopen_many_sym_or_warn(
&glib_dl, "libgio-2.0.so.0", LOG_DEBUG,
DLSYM_ARG(g_dbus_message_new_from_blob),
#endif
#if HAVE_DBUS
-static void *libdbus_dl = NULL;
static DLSYM_PROTOTYPE(dbus_error_init) = NULL;
static DLSYM_PROTOTYPE(dbus_error_free) = NULL;
static DLSYM_PROTOTYPE(dbus_message_demarshal) = NULL;
static DLSYM_PROTOTYPE(dbus_message_unref) = NULL;
static int dlopen_libdbus(void) {
+ static void *libdbus_dl = NULL;
+
return dlopen_many_sym_or_warn(
&libdbus_dl, "libdbus-1.so.3", LOG_DEBUG,
DLSYM_ARG(dbus_error_init),
#include "xkbcommon-util.h"
#if HAVE_XKBCOMMON
-static void *xkbcommon_dl = NULL;
-
DLSYM_PROTOTYPE(xkb_context_new) = NULL;
DLSYM_PROTOTYPE(xkb_context_unref) = NULL;
DLSYM_PROTOTYPE(xkb_context_set_log_fn) = NULL;
DLSYM_PROTOTYPE(xkb_keymap_unref) = NULL;
static int dlopen_xkbcommon(int log_level) {
+ static void *xkbcommon_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"xkbcommon",
"Support for keyboard locale descriptions",
#include "user-util.h"
#if HAVE_ACL
-static void *libacl_dl = NULL;
-
DLSYM_PROTOTYPE(acl_add_perm);
DLSYM_PROTOTYPE(acl_calc_mask);
DLSYM_PROTOTYPE(acl_copy_entry);
int dlopen_libacl(int log_level) {
#if HAVE_ACL
+ static void *libacl_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"acl",
"Support for file Access Control Lists (ACLs)",
#include "fileio.h"
-static void *libapparmor_dl = NULL;
-
DLSYM_PROTOTYPE(aa_change_onexec) = NULL;
DLSYM_PROTOTYPE(aa_change_profile) = NULL;
DLSYM_PROTOTYPE(aa_features_new_from_kernel) = NULL;
int dlopen_libapparmor(int log_level) {
#if HAVE_APPARMOR
+ static void *libapparmor_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"apparmor",
"Support for AppArmor policies",
#include "string-util.h"
#if HAVE_BLKID
-static void *libblkid_dl = NULL;
-
DLSYM_PROTOTYPE(blkid_do_fullprobe) = NULL;
DLSYM_PROTOTYPE(blkid_do_probe) = NULL;
DLSYM_PROTOTYPE(blkid_do_safeprobe) = NULL;
int dlopen_libblkid(int log_level) {
#if HAVE_BLKID
+ static void *libblkid_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"blkid",
"Support for block device identification",
#endif
};
-static void *libcrypto_dl = NULL;
-
static DLSYM_PROTOTYPE(ASN1_INTEGER_dup) = NULL;
static DLSYM_PROTOTYPE(ASN1_INTEGER_free) = NULL;
static DLSYM_PROTOTYPE(ASN1_INTEGER_set) = NULL;
int dlopen_libcrypto(int log_level) {
#if HAVE_OPENSSL
+ static void *libcrypto_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"libcrypto",
"Support for cryptographic operations",
#include "strv.h"
#if HAVE_LIBCRYPTSETUP
-static void *cryptsetup_dl = NULL;
-
DLSYM_PROTOTYPE(crypt_activate_by_passphrase) = NULL;
DLSYM_PROTOTYPE(crypt_activate_by_signed_key) = NULL;
DLSYM_PROTOTYPE(crypt_activate_by_token_pin) = NULL;
int dlopen_cryptsetup(int log_level) {
#if HAVE_LIBCRYPTSETUP
+ static void *cryptsetup_dl = NULL;
int r;
/* libcryptsetup added crypt_reencrypt() in 2.2.0, and marked it obsolete in 2.4.0, replacing it with
#include "time-util.h"
#include "version.h"
-static void *curl_dl = NULL;
-
DLSYM_PROTOTYPE(curl_easy_cleanup) = NULL;
DLSYM_PROTOTYPE(curl_easy_getinfo) = NULL;
DLSYM_PROTOTYPE(curl_easy_init) = NULL;
int dlopen_curl(int log_level) {
#if HAVE_LIBCURL
+ static void *curl_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"curl",
"Support for downloading and uploading files over HTTP",
#if HAVE_ELFUTILS
-static void *dw_dl = NULL;
-static void *elf_dl = NULL;
-
/* libdw symbols */
static DLSYM_PROTOTYPE(dwarf_attr_integrate) = NULL;
static DLSYM_PROTOTYPE(dwarf_diename) = NULL;
int dlopen_dw(int log_level) {
#if HAVE_ELFUTILS
+ static void *dw_dl = NULL;
int r;
SD_ELF_NOTE_DLOPEN(
int dlopen_elf(int log_level) {
#if HAVE_ELFUTILS
+ static void *elf_dl = NULL;
int r;
SD_ELF_NOTE_DLOPEN(
#include "parse-util.h"
#include "string-util.h"
-static void *fdisk_dl = NULL;
-
DLSYM_PROTOTYPE(fdisk_add_partition) = NULL;
DLSYM_PROTOTYPE(fdisk_apply_table) = NULL;
DLSYM_PROTOTYPE(fdisk_ask_get_type) = NULL;
int dlopen_fdisk(int log_level) {
#if HAVE_LIBFDISK
+ static void *fdisk_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"fdisk",
"Support for reading and writing partition tables",
#include "log.h" /* IWYU pragma: keep */
#if HAVE_GNUTLS
-static void *gnutls_dl = NULL;
-
DLSYM_PROTOTYPE(gnutls_certificate_get_peers) = NULL;
DLSYM_PROTOTYPE(gnutls_certificate_type_get) = NULL;
DLSYM_PROTOTYPE(gnutls_certificate_verification_status_print) = NULL;
int dlopen_gnutls(int log_level) {
#if HAVE_GNUTLS
+ static void *gnutls_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"gnutls",
"Support for TLS via GnuTLS",
#include "user-util.h" /* IWYU pragma: keep */
#if HAVE_LIBARCHIVE
-static void *libarchive_dl = NULL;
-
DLSYM_PROTOTYPE(archive_entry_acl_add_entry) = NULL;
DLSYM_PROTOTYPE(archive_entry_acl_next) = NULL;
DLSYM_PROTOTYPE(archive_entry_acl_reset) = NULL;
int dlopen_libarchive(int log_level) {
#if HAVE_LIBARCHIVE
+ static void *libarchive_dl = NULL;
int r;
SD_ELF_NOTE_DLOPEN(
#include "socket-util.h"
#if HAVE_AUDIT
-static void *libaudit_dl = NULL;
-
static DLSYM_PROTOTYPE(audit_close) = NULL;
DLSYM_PROTOTYPE(audit_log_acct_message) = NULL;
DLSYM_PROTOTYPE(audit_log_user_avc_message) = NULL;
int dlopen_libaudit(int log_level) {
#if HAVE_AUDIT
+ static void *libaudit_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"audit",
"Support for Audit logging",
#if HAVE_LIBCRYPT
#ifdef __GLIBC__
-static void *libcrypt_dl = NULL;
static DLSYM_PROTOTYPE(crypt_gensalt_ra) = NULL;
static DLSYM_PROTOTYPE(crypt_preferred_method) = NULL;
static DLSYM_PROTOTYPE(crypt_ra) = NULL;
int dlopen_libcrypt(int log_level) {
#if HAVE_LIBCRYPT
#ifdef __GLIBC__
+ static void *libcrypt_dl = NULL;
static int cached = 0;
int r = -ENOENT;
#define FIDO_ERR_UV_BLOCKED 0x3c
#endif
-static void *libfido2_dl = NULL;
-
DLSYM_PROTOTYPE(fido_assert_allow_cred) = NULL;
DLSYM_PROTOTYPE(fido_assert_free) = NULL;
DLSYM_PROTOTYPE(fido_assert_hmac_secret_len) = NULL;
int dlopen_libfido2(int log_level) {
#if HAVE_LIBFIDO2
+ static void *libfido2_dl = NULL;
int r;
SD_ELF_NOTE_DLOPEN(
#include "fstab-util.h"
-static void *libmount_dl = NULL;
-
DLSYM_PROTOTYPE(mnt_free_iter) = NULL;
DLSYM_PROTOTYPE(mnt_free_table) = NULL;
DLSYM_PROTOTYPE(mnt_fs_get_fs_options) = NULL;
int dlopen_libmount(int log_level) {
#if HAVE_LIBMOUNT
+ static void *libmount_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"mount",
"Support for mount enumeration",
#include "strv.h"
#if HAVE_MICROHTTPD
-static void *microhttpd_dl = NULL;
-
DLSYM_PROTOTYPE(MHD_add_response_header) = NULL;
DLSYM_PROTOTYPE(MHD_create_response_from_buffer) = NULL;
DLSYM_PROTOTYPE(MHD_create_response_from_callback) = NULL;
int dlopen_microhttpd(int log_level) {
#if HAVE_MICROHTTPD
+ static void *microhttpd_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"microhttpd",
"Support for embedded HTTP server via libmicrohttpd",
#if HAVE_KMOD
-static void *libkmod_dl = NULL;
-
DLSYM_PROTOTYPE(kmod_list_next) = NULL;
DLSYM_PROTOTYPE(kmod_load_resources) = NULL;
DLSYM_PROTOTYPE(kmod_module_get_initstate) = NULL;
int dlopen_libkmod(int log_level) {
#if HAVE_KMOD
+ static void *libkmod_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"kmod",
"Support for loading kernel modules",
#include "stdio-util.h"
#include "string-util.h"
-static void *libpam_dl = NULL;
-
DLSYM_PROTOTYPE(pam_acct_mgmt) = NULL;
DLSYM_PROTOTYPE(pam_close_session) = NULL;
DLSYM_PROTOTYPE(pam_end) = NULL;
int dlopen_libpam(int log_level) {
#if HAVE_PAM
+ static void *libpam_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"pam",
"Support for LinuxPAM",
#include "memory-util.h"
#include "strv.h"
-static void *passwdqc_dl = NULL;
-
static DLSYM_PROTOTYPE(passwdqc_params_reset) = NULL;
static DLSYM_PROTOTYPE(passwdqc_params_load) = NULL;
static DLSYM_PROTOTYPE(passwdqc_params_parse) = NULL;
int dlopen_passwdqc(int log_level) {
#if HAVE_PASSWDQC
+ static void *passwdqc_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"passwdqc",
"Support for password quality checks",
#include "string-util.h"
#include "strv.h"
-static void *pwquality_dl = NULL;
-
static DLSYM_PROTOTYPE(pwquality_check) = NULL;
static DLSYM_PROTOTYPE(pwquality_default_settings) = NULL;
static DLSYM_PROTOTYPE(pwquality_free_settings) = NULL;
int dlopen_pwquality(int log_level) {
#if HAVE_PWQUALITY
+ static void *pwquality_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"pwquality",
"Support for password quality checks",
#include "pcre2-util.h"
#if HAVE_PCRE2
-static void *pcre2_dl = NULL;
-
DLSYM_PROTOTYPE(pcre2_match_data_create) = NULL;
DLSYM_PROTOTYPE(pcre2_match_data_free) = NULL;
DLSYM_PROTOTYPE(pcre2_code_free) = NULL;
int dlopen_pcre2(int log_level) {
#if HAVE_PCRE2
+ static void *pcre2_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"pcre2",
"Support for regular expressions",
assert(message);
/* pattern_compile_and_log() must be called before this function is called and that function already
* dlopens pcre2 so we can assert on it being available here. */
- assert(pcre2_dl);
+ assert(sym_pcre2_match);
md = sym_pcre2_match_data_create(1, NULL);
if (!md)
#if HAVE_P11KIT
-static void *p11kit_dl = NULL;
-
DLSYM_PROTOTYPE(p11_kit_module_get_name) = NULL;
DLSYM_PROTOTYPE(p11_kit_modules_finalize_and_release) = NULL;
DLSYM_PROTOTYPE(p11_kit_modules_load_and_initialize) = NULL;
int dlopen_p11kit(int log_level) {
#if HAVE_P11KIT
+ static void *p11kit_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"p11-kit",
"Support for PKCS11 hardware tokens",
#define UNICODE_UPPER_HALF_BLOCK UTF8("▀")
#if HAVE_QRENCODE
-static void *qrcode_dl = NULL;
-
static DLSYM_PROTOTYPE(QRcode_encodeString) = NULL;
static DLSYM_PROTOTYPE(QRcode_free) = NULL;
#endif
int dlopen_qrencode(int log_level) {
#if HAVE_QRENCODE
+ static void *qrcode_dl = NULL;
int r;
SD_ELF_NOTE_DLOPEN(
#include "strv.h"
#if HAVE_SECCOMP
-static void *libseccomp_dl = NULL;
-
DLSYM_PROTOTYPE(seccomp_api_get) = NULL;
DLSYM_PROTOTYPE(seccomp_arch_add) = NULL;
DLSYM_PROTOTYPE(seccomp_arch_exist) = NULL;
int dlopen_libseccomp(int log_level) {
#if HAVE_SECCOMP
+ static void *libseccomp_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"seccomp",
"Support for Seccomp Sandboxes",
return 0;
}
-static void *libselinux_dl = NULL;
-
DLSYM_PROTOTYPE(avc_open) = NULL;
DLSYM_PROTOTYPE(context_free) = NULL;
DLSYM_PROTOTYPE(context_new) = NULL;
int dlopen_libselinux(int log_level) {
#if HAVE_SELINUX
+ static void *libselinux_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"selinux",
"Support for SELinux",
#if HAVE_OPENSSL
-static void *libssl_dl = NULL;
-
DLSYM_PROTOTYPE(SSL_ctrl) = NULL;
DLSYM_PROTOTYPE(SSL_CTX_ctrl) = NULL;
DLSYM_PROTOTYPE(SSL_CTX_free) = NULL;
int dlopen_libssl(int log_level) {
#if HAVE_OPENSSL
+ static void *libssl_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"libssl",
"Support for TLS",
#include "virt.h"
#if HAVE_TPM2
-static void *libtss2_esys_dl = NULL;
-static void *libtss2_rc_dl = NULL;
-static void *libtss2_mu_dl = NULL;
-static void *libtss2_tcti_device_dl = NULL;
-
static DLSYM_PROTOTYPE(Esys_Create) = NULL;
static DLSYM_PROTOTYPE(Esys_CreateLoaded) = NULL;
static DLSYM_PROTOTYPE(Esys_CreatePrimary) = NULL;
static DLSYM_PROTOTYPE(Tss2_RC_Decode) = NULL;
static int dlopen_tpm2_esys(int log_level) {
+ static void *libtss2_esys_dl = NULL;
int r;
SD_ELF_NOTE_DLOPEN(
}
static int dlopen_tpm2_rc(int log_level) {
+ static void *libtss2_rc_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"tpm",
"Support for TPM",
}
static int dlopen_tpm2_mu(int log_level) {
+ static void *libtss2_mu_dl = NULL;
+
SD_ELF_NOTE_DLOPEN(
"tpm",
"Support for TPM",
}
static int dlopen_tpm2_tcti_device(int log_level) {
+ static void *libtss2_tcti_device_dl = NULL;
+
/* The "device" TCTI is the most relevant one, let's also load it explicitly on dlopen_tpm2(), even
* if we don't resolve any symbols here. */