/* * Shutdown smbd and smbsrv kernel services. * * Called only by the main thread. */ static void smbd_service_fini(void) { smbd.s_shutting_down = B_TRUE; smbd_report("service shutting down"); smb_kmod_stop(); smb_logon_abort(); smb_lgrp_stop(); smbd_pipesvc_stop(); smbd_door_stop(); smbd_spool_stop(); smbd_kernel_unbind(); smbd_share_stop(); smb_shr_stop(); dyndns_stop(); smbd_nicmon_stop(); smb_ccache_remove(SMB_CCACHE_PATH); smb_pwd_fini(); smb_domain_fini(); mlsvc_fini(); smb_netbios_stop(); smbd_cups_fini(); smbd.s_initialized = B_FALSE; smbd_report("service terminated"); closelog(); }
/* * Shutdown smbd and smbsrv kernel services. * * Shutdown will not begin until initialization has completed. * Only one thread is allowed to perform the shutdown. Other * threads will be blocked on fini_in_progress until the process * has exited. */ static void smbd_service_fini(void) { static uint_t fini_in_progress; (void) mutex_lock(&smbd_service_mutex); while (!smbd.s_initialized) (void) cond_wait(&smbd_service_cv, &smbd_service_mutex); if (atomic_swap_uint(&fini_in_progress, 1) != 0) { while (fini_in_progress) (void) cond_wait(&smbd_service_cv, &smbd_service_mutex); /*NOTREACHED*/ } smbd.s_shutting_down = B_TRUE; smbd_report("service shutting down"); smb_kmod_stop(); smb_logon_abort(); smb_lgrp_stop(); smbd_opipe_stop(); smbd_door_stop(); smbd_refresh_fini(); smbd_kernel_unbind(); smbd_share_stop(); smb_shr_stop(); dyndns_stop(); smbd_nicmon_stop(); smb_ccache_remove(SMB_CCACHE_PATH); smb_pwd_fini(); smb_domain_fini(); mlsvc_fini(); smb_netbios_stop(); smbd_cups_fini(); smbd.s_initialized = B_FALSE; smbd_report("service terminated"); (void) mutex_unlock(&smbd_service_mutex); exit((smbd.s_fatal_error) ? SMF_EXIT_ERR_FATAL : SMF_EXIT_OK); }