fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * CDDL HEADER START
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * The contents of this file are subject to the terms of the
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Common Development and Distribution License (the "License").
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * You may not use this file except in compliance with the License.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * See the License for the specific language governing permissions
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * and limitations under the License.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * When distributing Covered Code, include this CDDL HEADER in each
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * If applicable, add the following below this CDDL HEADER, with the
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * fields enclosed by brackets "[]" replaced with your own identifying
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * information: Portions Copyright [yyyy] [name of copyright owner]
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * CDDL HEADER END
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Use is subject to license terms.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#pragma ident "%Z%%M% %I% %E% SMI"
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Display group information and walk all elements of a group
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Display group information
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe/* ARGSUSED */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxegroup(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe /* Should provide an address */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe "CAPACITY",
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe if (mdb_vread(&group, sizeof (struct group), addr) == -1) {
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe addr, group.grp_size, group.grp_capacity, group.grp_set);
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Walk all elements in the group set.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Initialize the walk structure with the copy of a group set, its size and the
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * initial pointer position.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe gw = mdb_alloc(sizeof (group_walk_t), UM_SLEEP | UM_GC);
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe if (mdb_vread(&group, sizeof (struct group), wsp->walk_addr) == -1) {
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe mdb_warn("couldn't read 'group' at %p", wsp->walk_addr);
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Allocate space for the set and copy all set entries.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe gw->gw_set = mdb_alloc(group.grp_size * sizeof (uintptr_t),
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe if (mdb_vread(gw->gw_set, group.grp_size * sizeof (uintptr_t),
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe mdb_warn("couldn't read 'group set' at %p", group.grp_set);
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Print element of the set and advance the pointer.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Already visited all valid elements, nothing else to do.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Print non-NULL elements
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Adjust walk_addr to point to the next element