summaryrefslogtreecommitdiffstats
path: root/man3/dlinfo.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/dlinfo.3')
-rw-r--r--man3/dlinfo.330
1 files changed, 15 insertions, 15 deletions
diff --git a/man3/dlinfo.3 b/man3/dlinfo.3
index 5163aeab0..96ef06829 100644
--- a/man3/dlinfo.3
+++ b/man3/dlinfo.3
@@ -73,7 +73,7 @@ struct link_map {
shared object */
struct link_map *l_next, *l_prev;
/* Chain of loaded objects */
-
+\&
/* Plus additional fields private to the
implementation */
};
@@ -251,62 +251,62 @@ dls_serpath[1].dls_name = /usr/lib64
#include <link.h>
#include <stdio.h>
#include <stdlib.h>
-
+\&
int
main(int argc, char *argv[])
{
void *handle;
Dl_serinfo serinfo;
Dl_serinfo *sip;
-
+\&
if (argc != 2) {
fprintf(stderr, "Usage: %s <libpath>\en", argv[0]);
exit(EXIT_FAILURE);
}
-
+\&
/* Obtain a handle for shared object specified on command line. */
-
+\&
handle = dlopen(argv[1], RTLD_NOW);
if (handle == NULL) {
fprintf(stderr, "dlopen() failed: %s\en", dlerror());
exit(EXIT_FAILURE);
}
-
+\&
/* Discover the size of the buffer that we must pass to
RTLD_DI_SERINFO. */
-
+\&
if (dlinfo(handle, RTLD_DI_SERINFOSIZE, &serinfo) == \-1) {
fprintf(stderr, "RTLD_DI_SERINFOSIZE failed: %s\en", dlerror());
exit(EXIT_FAILURE);
}
-
+\&
/* Allocate the buffer for use with RTLD_DI_SERINFO. */
-
+\&
sip = malloc(serinfo.dls_size);
if (sip == NULL) {
perror("malloc");
exit(EXIT_FAILURE);
}
-
+\&
/* Initialize the \[aq]dls_size\[aq] and \[aq]dls_cnt\[aq] fields in the newly
allocated buffer. */
-
+\&
if (dlinfo(handle, RTLD_DI_SERINFOSIZE, sip) == \-1) {
fprintf(stderr, "RTLD_DI_SERINFOSIZE failed: %s\en", dlerror());
exit(EXIT_FAILURE);
}
-
+\&
/* Fetch and print library search list. */
-
+\&
if (dlinfo(handle, RTLD_DI_SERINFO, sip) == \-1) {
fprintf(stderr, "RTLD_DI_SERINFO failed: %s\en", dlerror());
exit(EXIT_FAILURE);
}
-
+\&
for (size_t j = 0; j < serinfo.dls_cnt; j++)
printf("dls_serpath[%zu].dls_name = %s\en",
j, sip\->dls_serpath[j].dls_name);
-
+\&
exit(EXIT_SUCCESS);
}
.EE