Print this page
OS-2366 ddi_periodic_add(9F) is entirely rubbish

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/syscall/uadmin.c
          +++ new/usr/src/uts/common/syscall/uadmin.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25      - * Copyright 2011 Joyent, Inc.  All rights reserved.
       25 + * Copyright 2013 Joyent, Inc.  All rights reserved.
  26   26   */
  27   27  
  28   28  #include <sys/param.h>
  29   29  #include <sys/types.h>
  30   30  #include <sys/sysmacros.h>
  31   31  #include <sys/systm.h>
  32   32  #include <sys/errno.h>
  33   33  #include <sys/vfs.h>
  34   34  #include <sys/vnode.h>
  35   35  #include <sys/swap.h>
↓ open down ↓ 5 lines elided ↑ open up ↑
  41   41  #include <sys/time.h>
  42   42  #include <vm/seg_kmem.h>
  43   43  #include <sys/modctl.h>
  44   44  #include <sys/callb.h>
  45   45  #include <sys/dumphdr.h>
  46   46  #include <sys/debug.h>
  47   47  #include <sys/ftrace.h>
  48   48  #include <sys/cmn_err.h>
  49   49  #include <sys/panic.h>
  50   50  #include <sys/ddi.h>
       51 +#include <sys/ddi_periodic.h>
  51   52  #include <sys/sunddi.h>
  52   53  #include <sys/policy.h>
  53   54  #include <sys/zone.h>
  54   55  #include <sys/condvar.h>
  55   56  #include <sys/thread.h>
  56   57  #include <sys/sdt.h>
  57   58  
  58   59  /*
  59   60   * Administrivia system call.  We provide this in two flavors: one for calling
  60   61   * from the system call path (uadmin), and the other for calling from elsewhere
↓ open down ↓ 217 lines elided ↑ open up ↑
 278  279                   * from ever running again so that vfs_unmountall() and
 279  280                   * vfs_syncall() can acquire the vfs locks they need.
 280  281                   */
 281  282                  sema_p(&fsflush_sema);
 282  283                  (void) callb_execute_class(CB_CL_UADMIN_PRE_VFS, NULL);
 283  284  
 284  285                  vfs_unmountall();
 285  286                  (void) VFS_MOUNTROOT(rootvfs, ROOT_UNMOUNT);
 286  287                  vfs_syncall();
 287  288  
      289 +                /*
      290 +                 * Check for (and unregister) any DDI periodic handlers that
      291 +                 * still exist, as they most likely constitute resource leaks:
      292 +                 */
      293 +                ddi_periodic_fini();
      294 +
 288  295                  dump_ereports();
 289  296                  dump_messages();
 290  297  
 291  298                  invoke_cb = B_TRUE;
 292  299  
 293  300                  /* FALLTHROUGH */
 294  301          }
 295  302  
 296  303          case A_REBOOT:
 297  304                  if ((mdep != NULL) && (*(char *)mdep == '/')) {
↓ open down ↓ 164 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX