Print this page
XXXX introduce drv_sectohz


3905 
3906 void
3907 mod_uninstall_daemon(void)
3908 {
3909         callb_cpr_t     cprinfo;
3910         clock_t         ticks;
3911 
3912         mod_aul_thread = curthread;
3913 
3914         CALLB_CPR_INIT(&cprinfo, &mod_uninstall_lock, callb_generic_cpr, "mud");
3915         for (;;) {
3916                 mutex_enter(&mod_uninstall_lock);
3917                 CALLB_CPR_SAFE_BEGIN(&cprinfo);
3918                 /*
3919                  * In DEBUG kernels, unheld drivers are uninstalled periodically
3920                  * every mod_uninstall_interval seconds.  Periodic uninstall can
3921                  * be disabled by setting mod_uninstall_interval to 0 which is
3922                  * the default for a non-DEBUG kernel.
3923                  */
3924                 if (mod_uninstall_interval) {
3925                         ticks = drv_usectohz(mod_uninstall_interval * 1000000);
3926                         (void) cv_reltimedwait(&mod_uninstall_cv,
3927                             &mod_uninstall_lock, ticks, TR_CLOCK_TICK);
3928                 } else {
3929                         cv_wait(&mod_uninstall_cv, &mod_uninstall_lock);
3930                 }
3931                 /*
3932                  * The whole daemon is safe for CPR except we don't want
3933                  * the daemon to run if FREEZE is issued and this daemon
3934                  * wakes up from the cv_wait above. In this case, it'll be
3935                  * blocked in CALLB_CPR_SAFE_END until THAW is issued.
3936                  *
3937                  * The reason of calling CALLB_CPR_SAFE_BEGIN twice is that
3938                  * mod_uninstall_lock is used to protect cprinfo and
3939                  * CALLB_CPR_SAFE_BEGIN assumes that this lock is held when
3940                  * called.
3941                  */
3942                 CALLB_CPR_SAFE_END(&cprinfo, &mod_uninstall_lock);
3943                 CALLB_CPR_SAFE_BEGIN(&cprinfo);
3944                 mutex_exit(&mod_uninstall_lock);
3945                 if ((modunload_disable_count == 0) &&




3905 
3906 void
3907 mod_uninstall_daemon(void)
3908 {
3909         callb_cpr_t     cprinfo;
3910         clock_t         ticks;
3911 
3912         mod_aul_thread = curthread;
3913 
3914         CALLB_CPR_INIT(&cprinfo, &mod_uninstall_lock, callb_generic_cpr, "mud");
3915         for (;;) {
3916                 mutex_enter(&mod_uninstall_lock);
3917                 CALLB_CPR_SAFE_BEGIN(&cprinfo);
3918                 /*
3919                  * In DEBUG kernels, unheld drivers are uninstalled periodically
3920                  * every mod_uninstall_interval seconds.  Periodic uninstall can
3921                  * be disabled by setting mod_uninstall_interval to 0 which is
3922                  * the default for a non-DEBUG kernel.
3923                  */
3924                 if (mod_uninstall_interval) {
3925                         ticks = drv_sectohz(mod_uninstall_interval);
3926                         (void) cv_reltimedwait(&mod_uninstall_cv,
3927                             &mod_uninstall_lock, ticks, TR_CLOCK_TICK);
3928                 } else {
3929                         cv_wait(&mod_uninstall_cv, &mod_uninstall_lock);
3930                 }
3931                 /*
3932                  * The whole daemon is safe for CPR except we don't want
3933                  * the daemon to run if FREEZE is issued and this daemon
3934                  * wakes up from the cv_wait above. In this case, it'll be
3935                  * blocked in CALLB_CPR_SAFE_END until THAW is issued.
3936                  *
3937                  * The reason of calling CALLB_CPR_SAFE_BEGIN twice is that
3938                  * mod_uninstall_lock is used to protect cprinfo and
3939                  * CALLB_CPR_SAFE_BEGIN assumes that this lock is held when
3940                  * called.
3941                  */
3942                 CALLB_CPR_SAFE_END(&cprinfo, &mod_uninstall_lock);
3943                 CALLB_CPR_SAFE_BEGIN(&cprinfo);
3944                 mutex_exit(&mod_uninstall_lock);
3945                 if ((modunload_disable_count == 0) &&