Print this page
patch sccs-keywords
patch fix-mdb

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/modules/genunix/leaky_subr.c
          +++ new/usr/src/cmd/mdb/common/modules/genunix/leaky_subr.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23   23   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   27  #include <mdb/mdb_param.h>
  30   28  #include <mdb/mdb_modapi.h>
  31   29  
  32   30  #include <sys/fs/ufs_inode.h>
  33   31  #include <sys/kmem_impl.h>
  34   32  #include <sys/vmem_impl.h>
  35   33  #include <sys/modctl.h>
  36   34  #include <sys/kobj.h>
  37   35  #include <sys/kobj_impl.h>
  38   36  #include <vm/seg_vn.h>
↓ open down ↓ 238 lines elided ↑ open up ↑
 277  275  
 278  276          return (WALK_NEXT);
 279  277  }
 280  278  
 281  279  static int
 282  280  leaky_thread(uintptr_t addr, const kthread_t *t, unsigned long *pagesize)
 283  281  {
 284  282          uintptr_t size, base = (uintptr_t)t->t_stkbase;
 285  283          uintptr_t stk = (uintptr_t)t->t_stk;
 286  284  
 287      -        /*
 288      -         * If this thread isn't in memory, we can't look at its stack.  This
 289      -         * may result in false positives, so we print a warning.
 290      -         */
 291      -        if (!(t->t_schedflag & TS_LOAD)) {
 292      -                mdb_printf("findleaks: thread %p's stack swapped out; "
 293      -                    "false positives possible\n", addr);
 294      -                return (WALK_NEXT);
 295      -        }
 296      -
 297  285          if (t->t_state != TS_FREE)
 298  286                  leaky_grep(base, stk - base);
 299  287  
 300  288          /*
 301  289           * There is always gunk hanging out between t_stk and the page
 302  290           * boundary.  If this thread structure wasn't kmem allocated,
 303  291           * this will include the thread structure itself.  If the thread
 304  292           * _is_ kmem allocated, we'll be able to get to it via allthreads.
 305  293           */
 306  294          size = *pagesize - (stk & (*pagesize - 1));
↓ open down ↓ 618 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX