summaryrefslogtreecommitdiff
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
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@
-rw-r--r--include/dlfcn.h22
-rw-r--r--share/man/man3/dlfcn.314
2 files changed, 28 insertions, 8 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 */
diff --git a/share/man/man3/dlfcn.3 b/share/man/man3/dlfcn.3
index b8395976a6b..fb24e044ecc 100644
--- a/share/man/man3/dlfcn.3
+++ b/share/man/man3/dlfcn.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dlfcn.3,v 1.35 2023/08/26 01:38:28 deraadt Exp $
+.\" $OpenBSD: dlfcn.3,v 1.36 2024/09/01 04:27:45 guenther Exp $
.\" $NetBSD: dlfcn.3,v 1.3 1996/01/09 19:43:34 pk Exp $
.\"
.\" Copyright (c) 1995 Paul Kranenburg
@@ -29,7 +29,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: August 26 2023 $
+.Dd $Mdocdate: September 1 2024 $
.Dt DLOPEN 3
.Os
.Sh NAME
@@ -301,6 +301,16 @@ being returned.
.Xr ld 1 ,
.Xr ld.so 1 ,
.Xr elf 5
+.Sh STANDARDS
+The
+.Fn dladdr ,
+.Fn dlclose ,
+.Fn dlerror ,
+.Fn dlopen ,
+and
+.Fn dlsym
+functions conform to
+.St -p1003.1-2024 .
.Sh HISTORY
Some of the
.Nm dl*