|
|
8a8cfb |
commit 17432d7150bdab3bce2ea66c70ad6c920f54077a
|
|
|
8a8cfb |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
8a8cfb |
Date: Fri Jun 28 10:15:30 2019 +0200
|
|
|
8a8cfb |
|
|
|
8a8cfb |
support: Add xdlvsym function
|
|
|
8a8cfb |
|
|
|
8a8cfb |
diff --git a/support/xdlfcn.c b/support/xdlfcn.c
|
|
|
8a8cfb |
index f34bb059c00f27f7..b4a6b85649d181c8 100644
|
|
|
8a8cfb |
--- a/support/xdlfcn.c
|
|
|
8a8cfb |
+++ b/support/xdlfcn.c
|
|
|
8a8cfb |
@@ -48,6 +48,26 @@ xdlsym (void *handle, const char *symbol)
|
|
|
8a8cfb |
return sym;
|
|
|
8a8cfb |
}
|
|
|
8a8cfb |
|
|
|
8a8cfb |
+void *
|
|
|
8a8cfb |
+xdlvsym (void *handle, const char *symbol, const char *version)
|
|
|
8a8cfb |
+{
|
|
|
8a8cfb |
+ /* Clear any pending errors. */
|
|
|
8a8cfb |
+ dlerror ();
|
|
|
8a8cfb |
+
|
|
|
8a8cfb |
+ void *sym = dlvsym (handle, symbol, version);
|
|
|
8a8cfb |
+
|
|
|
8a8cfb |
+ if (sym == NULL)
|
|
|
8a8cfb |
+ {
|
|
|
8a8cfb |
+ const char *error = dlerror ();
|
|
|
8a8cfb |
+ if (error != NULL)
|
|
|
8a8cfb |
+ FAIL_EXIT1 ("error: dlvsym: %s\n", error);
|
|
|
8a8cfb |
+ /* If there was no error, we found a NULL symbol. Return the
|
|
|
8a8cfb |
+ NULL value in this case. */
|
|
|
8a8cfb |
+ }
|
|
|
8a8cfb |
+
|
|
|
8a8cfb |
+ return sym;
|
|
|
8a8cfb |
+}
|
|
|
8a8cfb |
+
|
|
|
8a8cfb |
void
|
|
|
8a8cfb |
xdlclose (void *handle)
|
|
|
8a8cfb |
{
|
|
|
8a8cfb |
diff --git a/support/xdlfcn.h b/support/xdlfcn.h
|
|
|
8a8cfb |
index 5ab7494e70924f52..ab1cbb3cb9bb1cc7 100644
|
|
|
8a8cfb |
--- a/support/xdlfcn.h
|
|
|
8a8cfb |
+++ b/support/xdlfcn.h
|
|
|
8a8cfb |
@@ -26,6 +26,7 @@ __BEGIN_DECLS
|
|
|
8a8cfb |
/* Each of these terminates process on failure with relevant error message. */
|
|
|
8a8cfb |
void *xdlopen (const char *filename, int flags);
|
|
|
8a8cfb |
void *xdlsym (void *handle, const char *symbol);
|
|
|
8a8cfb |
+void *xdlvsym (void *handle, const char *symbol, const char *version);
|
|
|
8a8cfb |
void xdlclose (void *handle);
|
|
|
8a8cfb |
|
|
|
8a8cfb |
|