Lines Matching refs:vntsdp
81 static vntsd_t *vntsdp; variable
92 if (thr_self() != vntsdp->tid) { in exit_sig_handler()
94 (void) thr_kill(vntsdp->tid, sig); in exit_sig_handler()
112 if (vntsdp->timeout == 0) { in vntsd_attach_timer()
116 (void) mutex_lock(&vntsdp->tmo_lock); in vntsd_attach_timer()
117 rv = vntsd_que_append(&vntsdp->tmoq, (void *)tmop); in vntsd_attach_timer()
118 (void) mutex_unlock(&vntsdp->tmo_lock); in vntsd_attach_timer()
128 if (vntsdp->timeout == 0) { in vntsd_detach_timer()
132 (void) mutex_lock(&vntsdp->tmo_lock); in vntsd_detach_timer()
133 rv = vntsd_que_rm(&vntsdp->tmoq, (void *)tmop); in vntsd_detach_timer()
134 (void) mutex_unlock(&vntsdp->tmo_lock); in vntsd_detach_timer()
145 if (tmop->minutes == vntsdp->timeout) { in chk_timeout()
169 if (vntsdp->timeout == 0) { in vntsd_reset_timer()
173 (void) mutex_lock(&vntsdp->tmo_lock); in vntsd_reset_timer()
174 (void) vntsd_que_find(vntsdp->tmoq, (compare_func_t)reset_timeout, in vntsd_reset_timer()
176 (void) mutex_unlock(&vntsdp->tmo_lock); in vntsd_reset_timer()
189 if (vntsdp->timeout == 0) { in vntsd_alarm_sig_handler()
205 (void) mutex_lock(&vntsdp->tmo_lock); in vntsd_alarm_sig_handler()
208 (void) vntsd_que_walk(vntsdp->tmoq, (el_func_t)chk_timeout); in vntsd_alarm_sig_handler()
209 (void) mutex_unlock(&vntsdp->tmo_lock); in vntsd_alarm_sig_handler()
235 (void) mutex_lock(&vntsdp->lock); in vntsd_exit()
237 if (vntsdp->timeout > 0) { in vntsd_exit()
242 vntsd_free_que(&vntsdp->grouppq, (clean_func_t)vntsd_clean_group); in vntsd_exit()
245 (void) close(vntsdp->ctrl_fd); in vntsd_exit()
247 assert(vntsdp->tmoq == NULL); in vntsd_exit()
248 (void) mutex_unlock(&vntsdp->lock); in vntsd_exit()
251 (void) mutex_destroy(&vntsdp->tmo_lock); in vntsd_exit()
252 (void) mutex_destroy(&vntsdp->lock); in vntsd_exit()
253 free(vntsdp); in vntsd_exit()
361 vntsdp = calloc(sizeof (vntsd_t), 1); in main()
362 if (vntsdp == NULL) { in main()
367 vntsdp->ctrl_fd = -1; in main()
368 vntsdp->devinst = NULL; in main()
370 (void) mutex_init(&vntsdp->lock, USYNC_THREAD|LOCK_ERRORCHECK, NULL); in main()
371 (void) mutex_init(&vntsdp->tmo_lock, USYNC_THREAD|LOCK_ERRORCHECK, in main()
379 vntsdp->options |= VNTSD_OPT_DAEMON_OFF; in main()
383 vntsdp->devinst = optarg; in main()
390 n = sscanf(optarg, "%d", &(vntsdp->timeout)); in main()
392 vntsdp->timeout = -1; in main()
411 vntsdp->options |= VNTSD_OPT_AUTH_CHECK; in main()
420 if ((vntsdp->devinst == NULL) || (vntsdp->timeout == -1)) { in main()
429 vntsdp->ip_addr.s_addr = htonl(INADDR_LOOPBACK); in main()
430 } else if ((vntsdp->options & VNTSD_OPT_AUTH_CHECK) != 0) { in main()
434 vntsdp->ip_addr.s_addr = htonl(INADDR_LOOPBACK); in main()
436 vntsdp->ip_addr.s_addr = htonl(INADDR_ANY); in main()
438 vntsdp->ip_addr.s_addr = get_listen_ip_addr(listen_addr); in main()
439 if (vntsdp->ip_addr.s_addr == VNTSD_INVALID_LISTEN_ADDR) { in main()
448 vntsdp->options, vntsdp->devinst, in main()
452 sz = strlen(VCC_DEVICE_CTL_PATH) + strlen(vntsdp->devinst) + 1; in main()
458 (void) snprintf(path, sz-1, VCC_DEVICE_CTL_PATH, vntsdp->devinst, in main()
459 sizeof (vntsdp->devinst)); in main()
460 vntsdp->ctrl_fd = open(path, O_RDWR); in main()
462 if (vntsdp->ctrl_fd == -1) { in main()
473 if ((vntsdp->options & VNTSD_OPT_DAEMON_OFF) == 0) { in main()
492 for (i = 3; i < vntsdp->ctrl_fd; i++) { in main()
495 closefrom(vntsdp->ctrl_fd + 1); in main()
553 if (vntsdp->timeout > 0) { in main()
557 vntsdp->tid = thr_self(); in main()
560 vntsd_get_config(vntsdp); in main()
566 poll_drv[0].fd = vntsdp->ctrl_fd; in main()
572 vntsd_delete_cons(vntsdp); in main()
583 vntsd_daemon_wakeup(vntsdp); in main()
588 vntsd_delete_cons(vntsdp); in main()
600 return (vntsdp->ip_addr); in vntsd_ip_addr()
626 if (ioctl(vntsdp->ctrl_fd, ioctl_code, (caddr_t)buf)) { in vntsd_vcc_ioctl()
673 (void) thr_kill(vntsdp->tid, SIGUSR1); in vntsd_vcc_err()