]> git.ipfire.org Git - thirdparty/kmod.git/commit
util: Add dlfcn helpers
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Sat, 30 Nov 2024 06:30:53 +0000 (00:30 -0600)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 6 Dec 2024 21:05:09 +0000 (13:05 -0800)
commit1f49475e3df9db13b4620b8e72fc3cd7d0e686f2
tree5c31f2ddc1cf36475bd72e02254fc6d5fb9d1a17
parent1c8fae2f778406457a3b106238fccfd789ebfed7
util: Add dlfcn helpers

Heavily based on systemd: add similar (but simplified) functions to
dlopen() a library and load specific symbols from it. This will be
useful to allow to load the compression libraries as needed. A few
differences from the systemd implementation:

1) It's allowed to link directly to the library and hence bypass the
   dlopen() + dlsym()
2) The only entrypoint is dlsym_many() which is already declared with
   the sentinel: it's expected callers will use an x-macro that doesn't
   allow forgetting the sentinel
3) No support yet for ELF info annotation yet

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/262
shared/macro.h
shared/util.c
shared/util.h