1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-30 00:56:33 +00:00

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@
This commit is contained in:
guenther
2024-09-01 04:27:45 +00:00
parent 079591e77b
commit f2ddd4444c
2 changed files with 28 additions and 8 deletions

View File

@@ -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 */

View File

@@ -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*