dlsym.3: SYNOPSIS: Use 'restrict' in prototypes; add missing 'const' too

POSIX specifies that the parameters of dlsym()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

The glibc specific dlvsym() also uses 'restrict'.
Its 2nd and 3rd parameters are 'const' too.

Fix the prototypes to add these qualifiers.

......

.../glibc$ grep_glibc_prototype dlsym
dlfcn/dlfcn.h:64:
extern void *dlsym (void *__restrict __handle,
		    const char *__restrict __name) __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype dlvsym
dlfcn/dlfcn.h:73:
extern void *dlvsym (void *__restrict __handle,
		     const char *__restrict __name,
		     const char *__restrict __version)
     __THROW __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2021-02-24 15:43:00 +01:00 committed by Michael Kerrisk
parent fbea610b4a
commit ad85578a68
1 changed files with 3 additions and 2 deletions

View File

@ -29,12 +29,13 @@ dlsym, dlvsym \- obtain address of a symbol in a shared object or executable
.nf
.B #include <dlfcn.h>
.PP
.BI "void *dlsym(void *" handle ", const char *" symbol );
.BI "void *dlsym(void *restrict " handle ", const char *restrict " symbol );
.PP
.B #define _GNU_SOURCE
.B #include <dlfcn.h>
.PP
.BI "void *dlvsym(void *" handle ", char *" symbol ", char *" version );
.BI "void *dlvsym(void *restrict " handle ", const char *restrict " symbol ,
.BI " const char *restrict " version );
.PP
Link with \fI\-ldl\fP.
.fi