1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #include "mdinclude.h" 30 31 /* 32 * walk the sets 33 */ 34 /* ARGSUSED */ 35 int sets_walk_init(mdb_walk_state_t * wsp)36sets_walk_init(mdb_walk_state_t *wsp) 37 { 38 uintptr_t addr; 39 40 snarf_sets(); 41 addr = (uintptr_t)mdset[0].s_db; 42 wsp->walk_data = mdb_alloc(sizeof (int), UM_SLEEP); 43 /* walk_data will hold the set number of the set being printed */ 44 *((int *)wsp->walk_data) = 0; 45 wsp->walk_addr = addr; 46 return (WALK_NEXT); 47 } 48 49 int sets_walk_step(mdb_walk_state_t * wsp)50sets_walk_step(mdb_walk_state_t *wsp) 51 { 52 int status; 53 54 if (*((int *)wsp->walk_data) >= md_nsets) 55 return (WALK_DONE); 56 57 status = wsp->walk_callback(wsp->walk_addr, NULL, wsp->walk_cbdata); 58 59 *((int *)wsp->walk_data) += 1; 60 wsp->walk_addr = (uintptr_t)mdset[*((int *)wsp->walk_data)].s_db; 61 62 return (status); 63 } 64 65 void sets_walk_fini(mdb_walk_state_t * wsp)66sets_walk_fini(mdb_walk_state_t *wsp) 67 { 68 mdb_free(wsp->walk_data, sizeof (int)); 69 } 70