|
|
b1dca6 |
commit 94b63e66206a9ad38872a9136a623ce73cf7c858
|
|
|
b1dca6 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
b1dca6 |
Date: Thu Feb 7 09:02:00 2019 +0100
|
|
|
b1dca6 |
|
|
|
b1dca6 |
support: Implement xdlmopen
|
|
|
b1dca6 |
|
|
|
b1dca6 |
Put xdlmopen into its own file, to avoid disturbing static linking
|
|
|
b1dca6 |
tests (where dlmopen pulls in additional code).
|
|
|
b1dca6 |
|
|
|
b1dca6 |
diff --git a/support/Makefile b/support/Makefile
|
|
|
b1dca6 |
index 5808a42dce87151f..895b83a426369b0c 100644
|
|
|
b1dca6 |
--- a/support/Makefile
|
|
|
b1dca6 |
+++ b/support/Makefile
|
|
|
b1dca6 |
@@ -86,6 +86,7 @@ libsupport-routines = \
|
|
|
b1dca6 |
xconnect \
|
|
|
b1dca6 |
xcopy_file_range \
|
|
|
b1dca6 |
xdlfcn \
|
|
|
b1dca6 |
+ xdlmopen \
|
|
|
b1dca6 |
xdup2 \
|
|
|
b1dca6 |
xfclose \
|
|
|
b1dca6 |
xfopen \
|
|
|
b1dca6 |
diff --git a/support/xdlfcn.h b/support/xdlfcn.h
|
|
|
b1dca6 |
index ab1cbb3cb9bb1cc7..a53fb61b133af5c3 100644
|
|
|
b1dca6 |
--- a/support/xdlfcn.h
|
|
|
b1dca6 |
+++ b/support/xdlfcn.h
|
|
|
b1dca6 |
@@ -25,11 +25,11 @@ __BEGIN_DECLS
|
|
|
b1dca6 |
|
|
|
b1dca6 |
/* Each of these terminates process on failure with relevant error message. */
|
|
|
b1dca6 |
void *xdlopen (const char *filename, int flags);
|
|
|
b1dca6 |
+void *xdlmopen (Lmid_t lmid, const char *filename, int flags);
|
|
|
b1dca6 |
void *xdlsym (void *handle, const char *symbol);
|
|
|
b1dca6 |
void *xdlvsym (void *handle, const char *symbol, const char *version);
|
|
|
b1dca6 |
void xdlclose (void *handle);
|
|
|
b1dca6 |
|
|
|
b1dca6 |
-
|
|
|
b1dca6 |
__END_DECLS
|
|
|
b1dca6 |
|
|
|
b1dca6 |
#endif /* SUPPORT_DLOPEN_H */
|
|
|
b1dca6 |
diff --git a/support/xdlmopen.c b/support/xdlmopen.c
|
|
|
b1dca6 |
new file mode 100644
|
|
|
b1dca6 |
index 0000000000000000..9a39ba8801eb1617
|
|
|
b1dca6 |
--- /dev/null
|
|
|
b1dca6 |
+++ b/support/xdlmopen.c
|
|
|
b1dca6 |
@@ -0,0 +1,31 @@
|
|
|
b1dca6 |
+/* dlmopen with error checking.
|
|
|
b1dca6 |
+ Copyright (C) 2017-2019 Free Software Foundation, Inc.
|
|
|
b1dca6 |
+ This file is part of the GNU C Library.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
b1dca6 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
b1dca6 |
+ License as published by the Free Software Foundation; either
|
|
|
b1dca6 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
b1dca6 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
b1dca6 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
b1dca6 |
+ Lesser General Public License for more details.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
b1dca6 |
+ License along with the GNU C Library; if not, see
|
|
|
b1dca6 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+#include <support/check.h>
|
|
|
b1dca6 |
+#include <support/xdlfcn.h>
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+void *
|
|
|
b1dca6 |
+xdlmopen (Lmid_t lmid, const char *filename, int flags)
|
|
|
b1dca6 |
+{
|
|
|
b1dca6 |
+ void *dso = dlmopen (lmid, filename, flags);
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ if (dso == NULL)
|
|
|
b1dca6 |
+ FAIL_EXIT1 ("error: dlmopen: %s\n", dlerror ());
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ return dso;
|
|
|
b1dca6 |
+}
|