summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2024-09-01 04:27:46 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2024-09-01 04:27:46 +0000
commitc386afbd74e9a340d5f670b1602b0cf1ac2647e3 (patch)
tree410e30d7808d04e43ad83524909b843848f22bc8 /include
parent1c391c272047eb676e05b37a5c034b8fa12db32a (diff)
dladdr(3) is in POSIX-2024, though the structure type was renamed
to match Solaris and _not_ match glibc/BSDs and no one caught it before publication. Provide the new name but keep providing the existing names under the same conditions as before. Update #include visibility and dlfcn(3) manpage and add restrict qualifiers. ok deraadt@
Diffstat (limited to 'include')
-rw-r--r--include/dlfcn.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 5423bb29794..40d6a53b464 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dlfcn.h,v 1.16 2022/08/20 17:39:22 tb Exp $ */
+/* $OpenBSD: dlfcn.h,v 1.17 2024/09/01 04:27:45 guenther Exp $ */
/* $NetBSD: dlfcn.h,v 1.2 1995/06/05 19:38:00 pk Exp $ */
/*
@@ -52,17 +52,24 @@
#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
#define RTLD_SELF ((void *) -3) /* Search the caller itself. */
-#if __BSD_VISIBLE
-
+#if __BSD_VISIBLE || __POSIX_VISIBLE >= 202405
/*
* Structure filled in by dladdr().
*/
-typedef struct dl_info {
+typedef struct
+#if __BSD_VISIBLE
+ dl_info
+#endif
+{
const char *dli_fname; /* Pathname of shared object. */
void *dli_fbase; /* Base address of shared object. */
const char *dli_sname; /* Name of nearest symbol. */
void *dli_saddr; /* Address of nearest symbol. */
-} Dl_info;
+} Dl_info_t;
+#endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 202405 */
+
+#if __BSD_VISIBLE
+typedef Dl_info_t Dl_info;
/*
* dlctl() commands
@@ -90,8 +97,11 @@ int dlclose(void *);
void *dlsym(void *__restrict, const char *__restrict);
char *dlerror(void);
+#if __BSD_VISIBLE || __POSIX_VISIBLE >= 202405
+int dladdr(const void *__restrict, Dl_info_t *__restrict);
+#endif
+
#if __BSD_VISIBLE
-int dladdr(const void *, Dl_info *);
int dlctl(void *, int, void *);
#endif /* __BSD_VISIBLE */