Pservice.c revision 2a12f85ad140e332791b4bad1208a734c3f26bf3
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <stdarg.h>
#include <string.h>
#include "Pcontrol.h"
/*
* This file implements the process services declared in <proc_service.h>.
* This enables libproc to be used in conjunction with libc_db and
* librtld_db. As most of these facilities are already provided by
* (more elegant) interfaces in <libproc.h>, we can just call those.
*
* NOTE: We explicitly do *not* implement the functions ps_kill() and
* ps_lrolltoaddr() in this library. The very existence of these functions
* causes libc_db to create an "agent thread" in the target process.
* The only way to turn off this behavior is to omit these functions.
*/
{
return (PS_OK);
}
{
return (PS_BADADDR);
return (PS_OK);
}
{
return (PS_BADADDR);
return (PS_OK);
}
/*
* libc_db calls matched pairs of ps_pstop()/ps_pcontinue()
* in the belief that the client may have left the process
* running while calling in to the libc_db interfaces.
*
* We interpret the meaning of these functions to be an inquiry
* as to whether the process is stopped, not an action to be
* performed to make it stopped. For similar reasons, we also
* return PS_OK for core files in order to allow libc_db to
* operate on these as well.
*/
ps_pstop(struct ps_prochandle *P)
{
return (PS_ERR);
return (PS_OK);
}
ps_pcontinue(struct ps_prochandle *P)
{
return (PS_ERR);
return (PS_OK);
}
/*
* ps_lstop() and ps_lcontinue() are not called by any code in libc_db
* or librtld_db. We make them behave like ps_pstop() and ps_pcontinue().
*/
/* ARGSUSED1 */
{
return (PS_ERR);
return (PS_OK);
}
/* ARGSUSED1 */
{
return (PS_ERR);
return (PS_OK);
}
{
return (PS_ERR);
return (PS_OK);
return (PS_BADLID);
}
{
return (PS_ERR);
return (PS_OK);
return (PS_BADLID);
}
{
return (PS_ERR);
return (PS_OK);
return (PS_BADLID);
}
{
return (PS_ERR);
return (PS_OK);
return (PS_BADLID);
}
{
uint_t i;
*xrsize = sizeof (prxregset_t);
else
*xrsize = 0;
return (PS_OK);
}
}
return (PS_BADLID);
}
return (PS_BADLID);
return (PS_OK);
}
{
return (PS_ERR);
/* LINTED - alignment */
return (PS_OK);
return (PS_BADLID);
}
{
return (PS_ERR);
/* LINTED - alignment */
return (PS_OK);
return (PS_BADLID);
}
#endif /* sparc */
{
#endif
int nldt;
int i;
return (PS_ERR);
/*
* We need to get the ldt entry that matches the
* value in the lwp's GS register.
*/
return (error);
return (PS_ERR);
return (PS_ERR);
}
for (i = 0; i < nldt; i++) {
break;
}
}
if (i < nldt)
return (PS_OK);
}
#endif
return (PS_ERR);
}
#endif /* __i386 || __amd64 */
/*
* Libthread_db doesn't use this function currently, but librtld_db uses
* it for its debugging output. We turn this on via rd_log if our debugging
* switch is on, and then echo the messages sent to ps_plog to stderr.
*/
void
{
}
}
/*
* Store a pointer to our internal copy of the aux vector at the address
* specified by the caller. It should not hold on to this data for too long.
*/
{
Preadauxvec(P);
return (PS_ERR);
return (PS_OK);
}
{
}
/*
* Search for a symbol by name and return the corresponding address.
*/
{
dprintf("pglobal_lookup <%s> -> %p\n",
return (PS_OK);
}
return (PS_NOSYM);
}
/*
* Search for a symbol by name and return the corresponding symbol
* information. If we're compiled _LP64, we just call Plookup_by_name
* and return because ps_sym_t is defined to be an Elf64_Sym, which
* is the same as a GElf_Sym. In the _ILP32 case, we have to convert
* Plookup_by_name's result back to a ps_sym_t (which is an Elf32_Sym).
*/
{
#if defined(_ILP32)
return (PS_OK);
}
return (PS_OK);
#endif
return (PS_NOSYM);
}