/* * Called from kcf:_init() */ void kcf_rnd_init() { hrtime_t ts; time_t now; mutex_init(&rndpool_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&rndpool_read_cv, NULL, CV_DEFAULT, NULL); /* * Add bytes to the cache using * . 2 unpredictable times: high resolution time since the boot-time, * and the current time-of-the day. * This is used only to make the timeout value in the timer * unpredictable. */ ts = gethrtime(); rndc_addbytes((uint8_t *)&ts, sizeof (ts)); (void) drv_getparm(TIME, &now); rndc_addbytes((uint8_t *)&now, sizeof (now)); rnbyte_cnt = 0; findex = rindex = 0; num_waiters = 0; rnd_alloc_magazines(); (void) taskq_dispatch(system_taskq, rnd_init2, NULL, TQ_SLEEP); }
int nskernd_isdaemon(void) { void *this_proc; if (proc_nskernd == NULL) return (0); if (drv_getparm(UPROCP, (void *)&this_proc) != 0) return (0); return (proc_nskernd == this_proc); }
static clock_t nskern_lbolt(void) { #ifdef _SunOS_5_6 clock_t lbolt; if (drv_getparm(LBOLT, &lbolt) == 0) return (lbolt); return (0); #else return (ddi_get_lbolt()); #endif }
extern clock_t emlxs_timeout(emlxs_hba_t *hba, uint32_t timeout) { emlxs_config_t *cfg = &CFG; clock_t time; /* Set thread timeout */ if (cfg[CFG_TIMEOUT_ENABLE].current) { (void) drv_getparm(LBOLT, &time); time += (timeout * drv_usectohz(1000000)); } else { time = -1; } return (time); } /* emlxs_timeout() */
static int nskernd_start(const int iscluster) { int rc = 0; mutex_enter(&nskernd_lock); if (proc_nskernd != NULL) { rc = 1; } else if (nskernd_norun != 0) { rc = 2; } else { (void) drv_getparm(UPROCP, (void *)&proc_nskernd); nskernd_iscluster = iscluster; } mutex_exit(&nskernd_lock); return (rc); }
RTR0DECL(RTR0PROCESS) RTR0ProcHandleSelf(void) { proc_t *pProcess = NULL; drv_getparm(UPROCP, &pProcess); return (RTR0PROCESS)pProcess; }
/* * Online trace * * Requires Lock (( M: Mandatory, P: Prohibited, A: Allowed )) * -. uinst_t->lock : P * -. uinst_t->u_lock : P * -. uinst_t->l_lock : P * -. uinst_t->c_lock : P */ void oplmsu_cmn_trace(queue_t *q, mblk_t *mp, int op) { struct iocblk *iocp; if ((op < MSU_TRC_UI) || (op > MSU_TRC_CLS)) { return; } mutex_enter(&oplmsu_ltrc_lock); if (oplmsu_debug_mode & MSU_DPRINT_ON) { oplmsu_cmn_msglog(mp, op); } /* Trace current counter */ drv_getparm(LBOLT, (void *)&oplmsu_ltrc_ccnt); if (oplmsu_ltrc_cur == oplmsu_ltrc_tail) { oplmsu_ltrc_cur = oplmsu_ltrc_top; } else { oplmsu_ltrc_cur++; } oplmsu_ltrc_cur->q = q; oplmsu_ltrc_cur->mp = mp; switch (op) { case MSU_TRC_UI : oplmsu_ltrc_cur->op[0] = 'u'; oplmsu_ltrc_cur->op[1] = 'i'; break; case MSU_TRC_UO : oplmsu_ltrc_cur->op[0] = 'u'; oplmsu_ltrc_cur->op[1] = 'o'; break; case MSU_TRC_LI : oplmsu_ltrc_cur->op[0] = 'l'; oplmsu_ltrc_cur->op[1] = 'i'; break; case MSU_TRC_LO : oplmsu_ltrc_cur->op[0] = 'l'; oplmsu_ltrc_cur->op[1] = 'o'; break; case MSU_TRC_OPN : oplmsu_ltrc_cur->op[0] = 'o'; oplmsu_ltrc_cur->op[1] = 'p'; break; case MSU_TRC_CLS : oplmsu_ltrc_cur->op[0] = 'c'; oplmsu_ltrc_cur->op[1] = 'l'; break; } if ((op == MSU_TRC_LI) || (op == MSU_TRC_LO)) { mutex_enter(&oplmsu_uinst->l_lock); oplmsu_ltrc_cur->pathno = ((lpath_t *)q->q_ptr)->path_no; mutex_exit(&oplmsu_uinst->l_lock); } else { oplmsu_ltrc_cur->pathno = 0; } if ((op == MSU_TRC_OPN) || (op == MSU_TRC_CLS)) { oplmsu_ltrc_cur->msg_type = 0; oplmsu_ltrc_cur->msg_cmd = 0; oplmsu_ltrc_cur->data = 0; switch ((ulong_t)mp) { case MSU_NODE_USER : oplmsu_ltrc_cur->data = MSU_TRC_USER; break; case MSU_NODE_META : oplmsu_ltrc_cur->data = MSU_TRC_META; break; } oplmsu_ltrc_cur->mp = NULL; } else { oplmsu_ltrc_cur->msg_type = mp->b_datap->db_type; iocp = (struct iocblk *)mp->b_rptr; oplmsu_ltrc_cur->msg_cmd = iocp->ioc_cmd; if ((mp->b_datap->db_type == M_IOCTL) || (mp->b_datap->db_type == M_IOCACK) || (mp->b_datap->db_type == M_IOCNAK)) { oplmsu_ltrc_cur->msg_cmd = iocp->ioc_cmd; if (mp->b_cont != NULL) { oplmsu_ltrc_cur->data = (ulong_t)mp->b_cont->b_rptr; } else { oplmsu_ltrc_cur->data = 0; } } else { oplmsu_ltrc_cur->msg_cmd = 0; if (mp->b_rptr == NULL) { oplmsu_ltrc_cur->data = 0; } else { oplmsu_ltrc_cur->data = *(ulong_t *)mp->b_rptr; } } } mutex_exit(&oplmsu_ltrc_lock); }