rtld_db.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <stdio.h>
#include <proc_service.h>
#include <link.h>
#include <rtld_db.h>
#include <rtld.h>
#include <_rtld_db.h>
#include <msg.h>
/*
* Mutex to protect global data
*/
int rtld_db_version = RD_VERSION1;
int rtld_db_logging = 0;
void
{
(void) mutex_lock(&glob_mutex);
(void) mutex_unlock(&glob_mutex);
}
/*
* Versioning Notes.
*
* The following have been added as the versions of librtld_db
* have grown:
*
* RD_VERSION1:
* o baseline version
*
* RD_VERSION2:
* o added support for the use of the AT_SUN_LDBASE auxvector
* to find the initialial debugging (r_debug) structures
* in ld.so.1
* o added the rl_dynamic field to rd_loadobj_t
* o added the RD_FLG_MEM_OBJECT to be used with the
* rl_dynamic->rl_flags field.
*
* RD_VERSION3:
* type:
* pi_baddr - bound address of PLT (if bound)
* pi_flags - flag field
* RD_FLG_PI_PLTBOUND (flag for pi_flags)
* if set - the PLT is bound and pi_baddr
* is filled in with the destination of the PLT.
*
* RD_VERSION4:
* o added the following field to the rd_loadobj_t structure:
* rl_tlsmodid - module ID for TLS references
*/
{
if ((version < RD_VERSION1) ||
(version > RD_VERSION))
return (RD_NOCAPAB);
return (RD_OK);
}
{
#ifdef _LP64
/*
* Determine if client is 32-bit or 64-bit.
*/
return (RD_DBERR);
}
else
#endif
return (err);
}
{
return (0);
return ((rd_agent_t *)0);
}
return (rap);
}
void
{
}
{
#ifdef _LP64
else
#endif
return (err);
}
{
#ifdef _LP64
rpi);
else
#endif
rpi);
return (err);
}
{
switch (num) {
case RD_NONE:
break;
case RD_PREINIT:
break;
case RD_POSTINIT:
break;
case RD_DLACTIVITY:
break;
default:
break;
}
}
return (rc);
}
/* ARGSUSED 0 */
{
#ifdef _LP64
else
#endif
return (err);
}
{
#ifdef _LP64
else
#endif
return (err);
}
{
if (rap->rd_tbinder) {
return (RD_OK);
}
bname));
return (RD_ERR);
}
return (RD_OK);
}
{
#ifdef _LP64
else
#endif
return (err);
}
char *
{
/*
* Convert an 'rd_err_e' to a string
*/
switch (rderr) {
case RD_OK:
case RD_ERR:
return ((char *)MSG_ORIG(MSG_ER_ERR));
case RD_DBERR:
return ((char *)MSG_ORIG(MSG_ER_DBERR));
case RD_NOCAPAB:
return ((char *)MSG_ORIG(MSG_ER_NOCAPAB));
case RD_NODYNAM:
return ((char *)MSG_ORIG(MSG_ER_NODYNAM));
case RD_NOBASE:
return ((char *)MSG_ORIG(MSG_ER_NOBASE));
case RD_NOMAPS:
return ((char *)MSG_ORIG(MSG_ER_NOMAPS));
default:
return ((char *)MSG_ORIG(MSG_ER_DEFAULT));
}
}