Add a new function dlversion() which returns the version number of
the dynamic linker in the same form as __FreeBSD_version. This is mainly intended for checking the dynamic linker version during a make world.
This commit is contained in:
parent
b2e2337ba1
commit
14f5fa0596
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45398
@ -30,7 +30,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: dlfcn.h,v 1.2 1998/02/11 05:19:10 jdp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DLFCN_H_
|
#ifndef _DLFCN_H_
|
||||||
@ -66,6 +66,7 @@ int dlclose __P((void *));
|
|||||||
const char *dlerror __P((void));
|
const char *dlerror __P((void));
|
||||||
void *dlopen __P((const char *, int));
|
void *dlopen __P((const char *, int));
|
||||||
void *dlsym __P((void *, const char *));
|
void *dlsym __P((void *, const char *));
|
||||||
|
int dlversion __P((void));
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif /* !_DLFCN_H_ */
|
#endif /* !_DLFCN_H_ */
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: dlfcn.c,v 1.1 1998/02/09 06:05:24 jdp Exp $
|
* $Id: dlfcn.c,v 1.2 1998/03/07 19:57:05 jdp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -94,6 +94,14 @@ dlsym(void *handle, const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma weak dlversion
|
||||||
|
int
|
||||||
|
dlversion(void)
|
||||||
|
{
|
||||||
|
_rtld_error(sorry);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#else /* a.out format */
|
#else /* a.out format */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -165,4 +173,11 @@ dlsym(void *handle, const char *name)
|
|||||||
return (__ldso_entry->dlsym)(handle, name);
|
return (__ldso_entry->dlsym)(handle, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We don't support dlversion() on a.out systems. */
|
||||||
|
int
|
||||||
|
dlversion(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __ELF__ */
|
#endif /* __ELF__ */
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
.Os FreeBSD
|
.Os FreeBSD
|
||||||
.Dt DLOPEN 3
|
.Dt DLOPEN 3
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm dlopen, dlsym, dlerror, dlclose
|
.Nm dlopen, dlsym, dlerror, dlclose, dlversion
|
||||||
.Nd programmatic interface to the dynamic linker
|
.Nd programmatic interface to the dynamic linker
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Fd #include <dlfcn.h>
|
.Fd #include <dlfcn.h>
|
||||||
@ -46,6 +46,8 @@
|
|||||||
.Fn dlerror "void"
|
.Fn dlerror "void"
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn dlclose "void *handle"
|
.Fn dlclose "void *handle"
|
||||||
|
.Ft int
|
||||||
|
.Fn dlversion "void"
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
These functions provide a simple programmatic interface to the services of the
|
These functions provide a simple programmatic interface to the services of the
|
||||||
dynamic linker.
|
dynamic linker.
|
||||||
@ -219,6 +221,19 @@ The object-intrinsic functions
|
|||||||
and
|
and
|
||||||
.Fn _fini
|
.Fn _fini
|
||||||
are called with no arguments, and are not expected to return values.
|
are called with no arguments, and are not expected to return values.
|
||||||
|
.Pp
|
||||||
|
.Fn dlversion
|
||||||
|
returns the version number of the dynamic linker. Interpreted
|
||||||
|
as a decimal number, the version number has the form
|
||||||
|
.Em rrrsss .
|
||||||
|
.Em rrr
|
||||||
|
corresponds to the base operating system release version, e.g., 400
|
||||||
|
for release 4.0.0.
|
||||||
|
.Em sss
|
||||||
|
is a serial number that increases monotonically within each release
|
||||||
|
version. If the installed dynamic linker is too old to support
|
||||||
|
.Fn dlversion ,
|
||||||
|
0 is returned.
|
||||||
.Sh NOTES
|
.Sh NOTES
|
||||||
ELF executables need to be linked
|
ELF executables need to be linked
|
||||||
using the
|
using the
|
||||||
@ -234,6 +249,8 @@ and
|
|||||||
return the null pointer in the event of errors.
|
return the null pointer in the event of errors.
|
||||||
.Fn dlclose
|
.Fn dlclose
|
||||||
returns 0 on success, or -1 if an error occurred.
|
returns 0 on success, or -1 if an error occurred.
|
||||||
|
.Fn dlversion
|
||||||
|
returns 0 if the dynamic linker is too old to support it.
|
||||||
Whenever an error has been detected, a message detailing it can be
|
Whenever an error has been detected, a message detailing it can be
|
||||||
retrieved via a call to
|
retrieved via a call to
|
||||||
.Fn dlerror .
|
.Fn dlerror .
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: rtld.c,v 1.16 1999/04/04 06:01:09 peter Exp $
|
* $Id: rtld.c,v 1.17 1999/04/05 02:36:40 jdp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -51,6 +51,14 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "rtld.h"
|
#include "rtld.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Version number queried by dlversion(). The first 3 digits represent
|
||||||
|
* the base FreeBSD release. The last 3 digits are a serial number.
|
||||||
|
* Increase this when you fix a significant bug or add a significant
|
||||||
|
* feature.
|
||||||
|
*/
|
||||||
|
#define DL_VERSION 400001
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Debugging support.
|
* Debugging support.
|
||||||
*/
|
*/
|
||||||
@ -152,6 +160,7 @@ static func_ptr_type exports[] = {
|
|||||||
(func_ptr_type) &dlopen,
|
(func_ptr_type) &dlopen,
|
||||||
(func_ptr_type) &dlsym,
|
(func_ptr_type) &dlsym,
|
||||||
(func_ptr_type) &dladdr,
|
(func_ptr_type) &dladdr,
|
||||||
|
(func_ptr_type) &dlversion,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1272,6 +1281,12 @@ dlsym(void *handle, const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
dlversion(void)
|
||||||
|
{
|
||||||
|
return DL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dladdr(const void *addr, Dl_info *info)
|
dladdr(const void *addr, Dl_info *info)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user