1 /* dlinfo -- Get information from the dynamic linker.
2 Copyright (C) 2003-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
24 #include <shlib-compat.h>
34 dlinfo_doit (void *argsblock
)
36 struct dlinfo_args
*const args
= argsblock
;
37 struct link_map
*l
= args
->handle
;
39 switch (args
->request
)
41 case RTLD_DI_CONFIGADDR
:
43 _dl_signal_error (0, NULL
, NULL
, N_("unsupported dlinfo request"));
47 *(Lmid_t
*) args
->arg
= l
->l_ns
;
51 *(struct link_map
**) args
->arg
= l
;
55 _dl_rtld_di_serinfo (l
, args
->arg
, false);
57 case RTLD_DI_SERINFOSIZE
:
58 _dl_rtld_di_serinfo (l
, args
->arg
, true);
62 strcpy (args
->arg
, l
->l_origin
);
65 case RTLD_DI_TLS_MODID
:
66 *(size_t *) args
->arg
= 0;
67 *(size_t *) args
->arg
= l
->l_tls_modid
;
70 case RTLD_DI_TLS_DATA
:
73 if (l
->l_tls_modid
!= 0)
74 data
= GLRO(dl_tls_get_addr_soft
) (l
);
75 *(void **) args
->arg
= data
;
82 dlinfo_implementation (void *handle
, int request
, void *arg
)
84 struct dlinfo_args args
= { handle
, request
, arg
};
85 return _dlerror_run (&dlinfo_doit
, &args
) ? -1 : 0;
90 ___dlinfo (void *handle
, int request
, void *arg
)
93 return GLRO (dl_dlfcn_hook
)->dlinfo (handle
, request
, arg
);
95 return dlinfo_implementation (handle
, request
, arg
);
97 versioned_symbol (libc
, ___dlinfo
, dlinfo
, GLIBC_2_34
);
99 # if OTHER_SHLIB_COMPAT (libdl, GLIBC_2_3_3, GLIBC_2_34)
100 compat_symbol (libc
, ___dlinfo
, dlinfo
, GLIBC_2_3_3
);
103 /* Also used with _dlfcn_hook. */
105 __dlinfo (void *handle
, int request
, void *arg
)
107 return dlinfo_implementation (handle
, request
, arg
);
109 weak_alias (__dlinfo
, dlinfo
)