open-src/xserver/xorg/sun-src/os/solaris/mdb/modules/Xserver_clients.c
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Wed, 28 Apr 2010 18:08:17 -0700
changeset 943 294f64612d23
parent 919 425233ae7236
child 1192 60e4ec16e28d
permissions -rw-r--r--
6948254 Mass update of X gate sources to Oracle copyright format
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     1
/*
943
294f64612d23 6948254 Mass update of X gate sources to Oracle copyright format
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 919
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     3
 *
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     4
 * Permission is hereby granted, free of charge, to any person obtaining a
919
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     5
 * copy of this software and associated documentation files (the "Software"),
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     6
 * to deal in the Software without restriction, including without limitation
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     8
 * and/or sell copies of the Software, and to permit persons to whom the
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     9
 * Software is furnished to do so, subject to the following conditions:
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    10
 *
919
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    11
 * The above copyright notice and this permission notice (including the next
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    12
 * paragraph) shall be included in all copies or substantial portions of the
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    13
 * Software.
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    14
 *
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    21
 * DEALINGS IN THE SOFTWARE.
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    22
 */
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    23
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    24
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    25
#include <sys/mdb_modapi.h>
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    26
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    27
#include "xorg-server.h"
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    28
#include "dixstruct.h"
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    29
#include "misc.h"
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    30
#include "os/osdep.h"
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    31
#include "IA/interactive_srv.h"
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    32
#include "Xserver_mdb.h"
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    33
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    34
struct client_walk_data {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    35
    uintptr_t client_next;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    36
    uintptr_t clients_end;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    37
    ClientRec client_data;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    38
};
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    39
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    40
/* Copied from dix/privates.c in Xorg 1.6 */
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    41
struct _Private {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    42
    int state;
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    43
    pointer value;
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    44
};
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    45
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    46
/*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    47
 * Initialize the client walker by either using the given starting address,
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    48
 * or reading the value of the server's "clients" pointer.  We also allocate
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    49
 * a  for storage, and save this using the walk_data pointer.
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    50
 */
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    51
_X_HIDDEN int
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    52
client_walk_init(mdb_walk_state_t *wsp)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    53
{
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    54
    struct client_walk_data *cwda;
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    55
    short max_clients = MAXCLIENTS;
905
d2b59d5a79ed 6926932 Removal of Xsun on SPARC [PSARC 2008/033]: X consolidation portion
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 851
diff changeset
    56
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    57
# define CUR_MAX_CLIENTS "currentMaxClients"
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    58
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    59
    if (wsp->walk_addr == NULL) {
905
d2b59d5a79ed 6926932 Removal of Xsun on SPARC [PSARC 2008/033]: X consolidation portion
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 851
diff changeset
    60
       /* Xorg 1.6 - clients is the array itself */
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    61
       GElf_Sym clients_sym;
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    62
       if (mdb_lookup_by_name("clients", &clients_sym) == -1) {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    63
	   mdb_warn("failed to lookup 'clients'");
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    64
	   return (WALK_ERR);
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    65
       }
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
    66
       wsp->walk_addr = clients_sym.st_value;
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    67
       if (mdb_readvar(&max_clients, CUR_MAX_CLIENTS) == -1) {
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    68
	   mdb_warn("failed to read '%s'", CUR_MAX_CLIENTS);
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    69
	   return (WALK_ERR);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    70
       } else {
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    71
	   mdb_printf("%s = %d\n", CUR_MAX_CLIENTS, max_clients);
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    72
       }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    73
    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    74
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    75
    wsp->walk_data = mdb_alloc(sizeof (struct client_walk_data), UM_SLEEP);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    76
    cwda = (struct client_walk_data *) wsp->walk_data;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    77
    cwda->clients_end = wsp->walk_addr + (max_clients * (sizeof(void *)));
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    78
    return (WALK_NEXT);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    79
}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    80
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    81
/*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    82
 * At each step, read a client struct into our private storage, and then invoke
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    83
 * the callback function.  We terminate when we reach the end of the clients
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    84
 * array.
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    85
 */
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    86
_X_HIDDEN int
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    87
client_walk_step(mdb_walk_state_t *wsp)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    88
{
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    89
	int status;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    90
	uintptr_t clientPtr;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    91
	struct client_walk_data *cwda =
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    92
	  (struct client_walk_data *) wsp->walk_data;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    93
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    94
	if (wsp->walk_addr == NULL)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    95
		return (WALK_DONE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    96
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    97
	do {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    98
	    if (mdb_vread(&clientPtr, sizeof (void *), wsp->walk_addr) == -1) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    99
		mdb_warn("failed to read client table entry at %p", wsp->walk_addr);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   100
		return (WALK_DONE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   101
	    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   102
	    if (clientPtr == NULL) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   103
#ifdef DEBUG
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   104
		mdb_printf("NULL entry at %p", wsp->walk_addr);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   105
#endif
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   106
		wsp->walk_addr += sizeof(void *);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   107
	    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   108
	    if (wsp->walk_addr >= cwda->clients_end) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   109
#ifdef DEBUG
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   110
		mdb_printf("End of client list at %p", cwda->clients_end);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   111
#endif
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   112
		return (WALK_DONE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   113
	    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   114
	} while (clientPtr == NULL);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   115
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   116
	if (clientPtr == NULL) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   117
	    return (WALK_DONE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   118
	}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   119
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   120
	if (mdb_vread(&(cwda->client_data), sizeof (ClientRec), (uintptr_t) clientPtr) == -1) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   121
		mdb_warn("failed to read client data at %p", wsp->walk_addr);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   122
		return (WALK_DONE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   123
	}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   124
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   125
	status = wsp->walk_callback(wsp->walk_addr, &(cwda->client_data),
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   126
	  wsp->walk_cbdata);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   127
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   128
	wsp->walk_addr = wsp->walk_addr + sizeof(void *);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   129
	return (status);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   130
}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   131
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   132
/*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   133
 * The walker's fini function is invoked at the end of each walk.  Since we
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   134
 * dynamically allocated a proc_t in client_walk_init, we must free it now.
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   135
 */
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   136
_X_HIDDEN void
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   137
client_walk_fini(mdb_walk_state_t *wsp)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   138
{
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   139
	mdb_free(wsp->walk_data, sizeof (ClientRec));
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   140
}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   141
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   142
_X_HIDDEN int
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   143
client_pids(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   144
{
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   145
    uintptr_t clientP;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   146
    ClientRec client_data;
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   147
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   148
	if (argc != 0)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   149
		return (DCMD_USAGE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   150
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   151
	/*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   152
	 * If no client address was specified on the command line, we can
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   153
	 * print out all clients by invoking the walker, using this
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   154
	 * dcmd itself as the callback.
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   155
	 */
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   156
	if (!(flags & DCMD_ADDRSPEC)) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   157
		if (mdb_walk_dcmd("client_walk", "client_pids",
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   158
		    argc, argv) == -1) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   159
			mdb_warn("failed to walk 'client_walk'");
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   160
			return (DCMD_ERR);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   161
		}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   162
		return (DCMD_OK);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   163
	}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   164
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   165
	/*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   166
	 * If this is the first invocation of the command, print a nice
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   167
	 * header line for the output that will follow.
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   168
	 */
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   169
	if (DCMD_HDRSPEC(flags))
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   170
		mdb_printf("CLIENT SEQUENCE #  FD  PIDS\n");
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   171
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   172
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   173
	if (mdb_vread(&clientP, sizeof (clientP), addr) == sizeof (clientP)) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   174
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   175
	    if (mdb_vread(&client_data, sizeof (client_data), clientP) == sizeof (client_data)) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   176
		mdb_printf("%5d  %10d", client_data.index, client_data.sequence);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   177
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   178
		if (client_data.osPrivate != NULL) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   179
		    OsCommRec oscomm;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   180
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   181
		    if (mdb_vread(&oscomm, sizeof (oscomm),
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   182
		      (uintptr_t)client_data.osPrivate) == sizeof (oscomm)) {
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   183
			ClientProcessPtr cpp = NULL;
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   184
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   185
			mdb_printf("%4d ", oscomm.fd);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   186
905
d2b59d5a79ed 6926932 Removal of Xsun on SPARC [PSARC 2008/033]: X consolidation portion
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 851
diff changeset
   187
			/* Xorg 1.6 or later */
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   188
			{
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   189
			    int IAPrivKeyIndex;
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   190
			    GElf_Sym privkey_sym;
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   191
			    if (mdb_lookup_by_obj("libia.so", "IAPrivKeyIndex",
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   192
						   &privkey_sym) == -1) {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   193
				mdb_warn("failed to lookup 'libia.so`IAPrivKeyIndex'");
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   194
			    } else {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   195
				if (mdb_vread(&IAPrivKeyIndex, sizeof(int),
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   196
					      privkey_sym.st_value) != sizeof(int)) {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   197
				    mdb_warn("failed to read 'IAPrivKeyIndex'");
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   198
				} else {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   199
				    void *dpaddr = &(client_data.devPrivates[IAPrivKeyIndex]);
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   200
				    struct _Private devPriv;
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   201
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   202
				    if (mdb_vread(&devPriv, sizeof (devPriv),
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   203
						  (uintptr_t) dpaddr) != sizeof (devPriv)) {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   204
					mdb_warn("failed to read client_data.devPrivates[IAPrivKeyIndex]");
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   205
				    } else {
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   206
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   207
					void *cppaddr = devPriv.value;
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   208
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   209
					if (mdb_vread(&cpp, sizeof (cpp), (uintptr_t) cppaddr) != sizeof (cpp)) {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   210
					    cpp = NULL;
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   211
					    mdb_warn("failed to read client_data.devPrivates[IAPrivKeyIndex].value");
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   212
					}
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   213
				    }
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   214
				}
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   215
			    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   216
			}
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   217
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   218
			if (cpp != NULL) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   219
			    ClientProcessRec cpr;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   220
			    ConnectionPidRec pid;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   221
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   222
			    if (mdb_vread(&cpr, sizeof (cpr),
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   223
					  (uintptr_t)cpp) == sizeof (cpr)) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   224
				int i;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   225
				uintptr_t pidP = (uintptr_t) cpr.pids;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   226
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   227
				for (i = 0; i < cpr.count; i++, pidP += sizeof(pid)) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   228
				    if (mdb_vread(&pid, sizeof (pid), pidP) == sizeof (pid)) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   229
					mdb_printf("%d ", pid);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   230
				    } else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   231
					mdb_warn("failed to read pid #%d from %p", i, pidP);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   232
				    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   233
				}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   234
				mdb_printf("\n");
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   235
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   236
			    } else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   237
				mdb_warn("failed to read struct ClientProcessRec at %p", client_data.osPrivate);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   238
			    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   239
			} else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   240
			    mdb_printf(" ??? - NULL ClientProcessPtr\n");
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   241
			}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   242
		    } else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   243
			mdb_warn("failed to read struct OsCommRec at %p", client_data.osPrivate);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   244
		    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   245
		} else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   246
		    mdb_printf(" ??? - NULL ClientPtr->osPrivate\n");
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   247
		}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   248
	    } else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   249
		mdb_warn("failed to read ClientRec at %p", clientP);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   250
	    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   251
	} else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   252
	    mdb_warn("failed to read ClientPtr at %p", addr);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   253
	}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   254
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   255
	return (DCMD_OK);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   256
}