Lines Matching refs:devsoftc

75 } devsoftc;  variable
151 mtx_init(&devsoftc.mtx, "dev mtx", "devd", MTX_DEF); in devctl_init()
152 cv_init(&devsoftc.cv, "dev cv"); in devctl_init()
153 STAILQ_INIT(&devsoftc.devq); in devctl_init()
154 knlist_init_mtx(&devsoftc.sel.si_note, &devsoftc.mtx); in devctl_init()
163 z = devsoftc.zone = uma_zcreate("DEVCTL", in devctl_init()
222 mtx_lock(&devsoftc.mtx); in devopen()
223 if (devsoftc.inuse) { in devopen()
224 mtx_unlock(&devsoftc.mtx); in devopen()
228 devsoftc.inuse = 1; in devopen()
229 mtx_unlock(&devsoftc.mtx); in devopen()
236 mtx_lock(&devsoftc.mtx); in devclose()
237 devsoftc.inuse = 0; in devclose()
238 devsoftc.nonblock = 0; in devclose()
239 devsoftc.async = 0; in devclose()
240 cv_broadcast(&devsoftc.cv); in devclose()
241 funsetown(&devsoftc.sigio); in devclose()
242 mtx_unlock(&devsoftc.mtx); in devclose()
260 mtx_lock(&devsoftc.mtx); in devread()
261 while (STAILQ_EMPTY(&devsoftc.devq)) { in devread()
262 if (devsoftc.nonblock) { in devread()
263 mtx_unlock(&devsoftc.mtx); in devread()
266 rv = cv_wait_sig(&devsoftc.cv, &devsoftc.mtx); in devread()
271 mtx_unlock(&devsoftc.mtx); in devread()
275 n1 = STAILQ_FIRST(&devsoftc.devq); in devread()
276 STAILQ_REMOVE_HEAD(&devsoftc.devq, dei_link); in devread()
277 devsoftc.queued--; in devread()
278 mtx_unlock(&devsoftc.mtx); in devread()
280 uma_zfree(devsoftc.zone, n1); in devread()
290 devsoftc.nonblock = 1; in devioctl()
292 devsoftc.nonblock = 0; in devioctl()
296 devsoftc.async = 1; in devioctl()
298 devsoftc.async = 0; in devioctl()
301 return fsetown(*(int *)data, &devsoftc.sigio); in devioctl()
303 *(int *)data = fgetown(&devsoftc.sigio); in devioctl()
321 mtx_lock(&devsoftc.mtx); in devpoll()
323 if (!STAILQ_EMPTY(&devsoftc.devq)) in devpoll()
326 selrecord(td, &devsoftc.sel); in devpoll()
328 mtx_unlock(&devsoftc.mtx); in devpoll()
340 knlist_add(&devsoftc.sel.si_note, kn, 0); in devkqfilter()
350 knlist_remove(&devsoftc.sel.si_note, kn, 0); in filt_devctl_detach()
356 kn->kn_data = devsoftc.queued; in filt_devctl_read()
366 return (devsoftc.inuse == 1); in devctl_process_running()
374 mtx_lock(&devsoftc.mtx); in devctl_alloc_dei()
377 dei = uma_zalloc(devsoftc.zone, M_NOWAIT); in devctl_alloc_dei()
379 dei = uma_zalloc(devsoftc.zone, M_NOWAIT | M_USE_RESERVE); in devctl_alloc_dei()
389 if (devsoftc.queued == 0) in devctl_alloc_dei()
391 dei = STAILQ_FIRST(&devsoftc.devq); in devctl_alloc_dei()
392 STAILQ_REMOVE_HEAD(&devsoftc.devq, dei_link); in devctl_alloc_dei()
393 devsoftc.queued--; in devctl_alloc_dei()
398 mtx_unlock(&devsoftc.mtx); in devctl_alloc_dei()
416 uma_zfree(devsoftc.zone, dei); in devctl_free_dei()
422 mtx_lock(&devsoftc.mtx); in devctl_queue()
423 STAILQ_INSERT_TAIL(&devsoftc.devq, dei, dei_link); in devctl_queue()
424 devsoftc.queued++; in devctl_queue()
425 cv_broadcast(&devsoftc.cv); in devctl_queue()
426 KNOTE_LOCKED(&devsoftc.sel.si_note, 0); in devctl_queue()
427 mtx_unlock(&devsoftc.mtx); in devctl_queue()
428 selwakeup(&devsoftc.sel); in devctl_queue()
429 if (devsoftc.async && devsoftc.sigio != NULL) in devctl_queue()
430 pgsigio(&devsoftc.sigio, SIGIO, 0); in devctl_queue()
558 if (!mtx_initialized(&devsoftc.mtx)) { in sysctl_devctl_queue()
572 mtx_lock(&devsoftc.mtx); in sysctl_devctl_queue()
574 uma_zdestroy(devsoftc.zone); in sysctl_devctl_queue()
575 devsoftc.zone = 0; in sysctl_devctl_queue()
576 mtx_unlock(&devsoftc.mtx); in sysctl_devctl_queue()