/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <sys/mdb_modapi.h>
#include "Xserver_mdb.h"
#include "xorg-server.h"
#include "dixstruct.h"
#include "misc.h"
#include "client.h"
#include "IA/interactive_srv.h"
struct client_walk_data {
};
/* Just here to satisfy linkage from inlines in privates.h
Should never ever be called from the module. */
{
abort();
return NULL; /* compiler whines about not returning a value after abort() */
}
/* Just here to satisfy linkage from inlines in dixstruct.h
Should never ever be called from the module. */
_X_HIDDEN void
{
}
/*
* Initialize the client walker by either using the given starting address,
* or reading the value of the server's "clients" pointer. We also allocate
* a for storage, and save this using the walk_data pointer.
*/
_X_HIDDEN int
{
/* Xorg 1.6 - clients is the array itself */
mdb_warn("failed to lookup 'clients'");
return (WALK_ERR);
}
return (WALK_ERR);
} else {
}
}
return (WALK_NEXT);
}
/*
* At each step, read a client struct into our private storage, and then invoke
* the callback function. We terminate when we reach the end of the clients
* array.
*/
_X_HIDDEN int
{
int status;
return (WALK_DONE);
do {
return (WALK_DONE);
}
#ifdef DEBUG
#endif
}
#ifdef DEBUG
#endif
return (WALK_DONE);
}
return (WALK_DONE);
}
return (WALK_DONE);
}
wsp->walk_cbdata);
return (status);
}
/*
* The walker's fini function is invoked at the end of each walk. Since we
* dynamically allocated a proc_t in client_walk_init, we must free it now.
*/
_X_HIDDEN void
{
}
_X_HIDDEN void
client_pids_help(void)
{
"Prints information about a ClientRec entry in the X server's array\n"
"of currently connected X clients. Prints process pid and name that\n"
"was recorded at connection time for each client, if available.\n"
"\n"
"If no %<u>addr%</u> is specified, uses ::client_walk to walk the linked list\n"
"of ClientRec entries stored in the global array \"clients\" and print\n"
"information about each one.\n"
"\n");
(void) mdb_dec_indent(2);
mdb_printf("%<b>OPTIONS%</b>\n");
(void) mdb_inc_indent(2);
"-w\tPrint arguments with process name when available.\n");
}
_X_HIDDEN int
{
return (DCMD_USAGE);
/*
* If no client address was specified on the command line, we can
* print out all clients by invoking the walker, using this
* dcmd itself as the callback.
*/
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk 'client_walk'");
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*
* If this is the first invocation of the command, print a nice
* header line for the output that will follow.
*/
if (DCMD_HDRSPEC(flags))
mdb_printf("CLIENT SEQUENCE # FD PROCESS\n");
} else {
!= sizeof (client_data)) {
} else {
/* Find file descriptor for this client */
!= sizeof (oscomm)) {
mdb_warn("failed to read struct OsCommRec at %p",
} else {
}
} else {
mdb_printf("NULL ");
}
/* Find client pid & cmd recorded on connection setup by
Xorg 1.11 and later */
!= sizeof (cir)) {
mdb_warn("failed to read struct ClientIdRec at %p",
} else {
cmd[0] = '\0';
}
mdb_warn("failed to read cmdargs at %p",
cmd[0] = '\0';
}
} else {
}
}
} else {
mdb_printf(" ???? - NULL ClientPtr->clientIds\n");
}
/* Check to see if any additional pids were registered
with SolarisIA extension. */
if ((iaprivkey_sym.st_value == 0) &&
== -1)) {
mdb_warn("failed to lookup 'IAPrivKeyRec'");
}
if (iaprivkey_sym.st_value != 0) {
!= sizeof(DevPrivateKeyRec)) {
mdb_warn("failed to read 'IAPrivKeyRec'");
} else if (!IAPrivKeyRec.initialized) {
mdb_warn("IAPrivKeyRec is uninitialized");
} else {
/*
* ClientProcessPtr is the first entry in the
* IAClientPrivatePtr that devPrivates points to
*/
!= sizeof (cppaddr)) {
mdb_warn("failed to read "
" client_data.devPrivates+offset");
/*
* if osPrivate is NULL, client connection is closed,
* and it's no surprise we can't find ClientProcessPtr
*/
mdb_warn("no ClientProcessPtr found");
!= sizeof (cpp)) {
mdb_warn("failed to read IAClientPrivatePtr");
}
}
!= sizeof (cpr)) {
mdb_warn("failed to read struct ClientProcessRec"
} else {
int i, num_printed = 0;
== sizeof (pid)) {
if (pid != client_pid) {
if (num_printed == 0)
num_printed++;
}
} else {
mdb_warn("failed to read pid #%d from %p",
i, pidP);
}
}
if (num_printed != 0)
mdb_printf("\n");
}
}
}
}
}
return (DCMD_OK);
}