Print this page
3946 ::gcore
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

@@ -20,13 +20,14 @@
  */
 /*
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright (c) 2013 by Delphix. All rights reserved.
+ */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/avl.h>
 
 #include <mdb/mdb_modapi.h>
 
 struct aw_info {

@@ -280,6 +281,28 @@
 
         if (aw->aw_buff != NULL)
                 mdb_free(aw->aw_buff, aw->aw_tree.avl_size);
 
         mdb_free(aw, sizeof (struct aw_info));
+}
+
+/*
+ * This function is named avl_walk_mdb to avoid a naming conflict with the
+ * existing avl_walk function.
+ */
+int
+avl_walk_mdb(uintptr_t addr, mdb_walk_cb_t callback, void *cbdata)
+{
+        mdb_walk_state_t ws;
+        int ret;
+
+        ws.walk_addr = addr;
+        ws.walk_callback = callback;
+        ws.walk_cbdata = cbdata;
+
+        avl_walk_init(&ws);
+        while ((ret = avl_walk_step(&ws)) == WALK_NEXT)
+                continue;
+        avl_walk_fini(&ws);
+
+        return (ret);
 }