Lines Matching refs:devsoftc

407 } devsoftc;
425 mtx_init(&devsoftc.mtx, "dev mtx", "devd", MTX_DEF);
426 cv_init(&devsoftc.cv, "dev cv");
427 TAILQ_INIT(&devsoftc.devq);
428 knlist_init_mtx(&devsoftc.sel.si_note, &devsoftc.mtx);
436 mtx_lock(&devsoftc.mtx);
437 if (devsoftc.inuse) {
438 mtx_unlock(&devsoftc.mtx);
442 devsoftc.inuse = 1;
443 mtx_unlock(&devsoftc.mtx);
451 mtx_lock(&devsoftc.mtx);
452 devsoftc.inuse = 0;
453 devsoftc.nonblock = 0;
454 devsoftc.async = 0;
455 cv_broadcast(&devsoftc.cv);
456 funsetown(&devsoftc.sigio);
457 mtx_unlock(&devsoftc.mtx);
475 mtx_lock(&devsoftc.mtx);
476 while (TAILQ_EMPTY(&devsoftc.devq)) {
477 if (devsoftc.nonblock) {
478 mtx_unlock(&devsoftc.mtx);
481 rv = cv_wait_sig(&devsoftc.cv, &devsoftc.mtx);
486 mtx_unlock(&devsoftc.mtx);
490 n1 = TAILQ_FIRST(&devsoftc.devq);
491 TAILQ_REMOVE(&devsoftc.devq, n1, dei_link);
492 devsoftc.queued--;
493 mtx_unlock(&devsoftc.mtx);
507 devsoftc.nonblock = 1;
509 devsoftc.nonblock = 0;
513 devsoftc.async = 1;
515 devsoftc.async = 0;
518 return fsetown(*(int *)data, &devsoftc.sigio);
520 *(int *)data = fgetown(&devsoftc.sigio);
538 mtx_lock(&devsoftc.mtx);
540 if (!TAILQ_EMPTY(&devsoftc.devq))
543 selrecord(td, &devsoftc.sel);
545 mtx_unlock(&devsoftc.mtx);
557 knlist_add(&devsoftc.sel.si_note, kn, 0);
568 knlist_remove(&devsoftc.sel.si_note, kn, 0);
574 kn->kn_data = devsoftc.queued;
584 return (devsoftc.inuse == 1);
607 mtx_lock(&devsoftc.mtx);
609 mtx_unlock(&devsoftc.mtx);
615 while (devsoftc.queued > devctl_queue_length - 1) {
616 n2 = TAILQ_FIRST(&devsoftc.devq);
617 TAILQ_REMOVE(&devsoftc.devq, n2, dei_link);
620 devsoftc.queued--;
622 TAILQ_INSERT_TAIL(&devsoftc.devq, n1, dei_link);
623 devsoftc.queued++;
624 cv_broadcast(&devsoftc.cv);
625 KNOTE_LOCKED(&devsoftc.sel.si_note, 0);
626 mtx_unlock(&devsoftc.mtx);
627 selwakeup(&devsoftc.sel);
628 if (devsoftc.async && devsoftc.sigio != NULL)
629 pgsigio(&devsoftc.sigio, SIGIO, 0);
797 if (mtx_initialized(&devsoftc.mtx))
798 mtx_lock(&devsoftc.mtx);
800 while (!TAILQ_EMPTY(&devsoftc.devq)) {
801 n1 = TAILQ_FIRST(&devsoftc.devq);
802 TAILQ_REMOVE(&devsoftc.devq, n1, dei_link);
806 devsoftc.queued = 0;
811 if (mtx_initialized(&devsoftc.mtx))
812 mtx_unlock(&devsoftc.mtx);
828 if (mtx_initialized(&devsoftc.mtx))
829 mtx_lock(&devsoftc.mtx);
831 while (devsoftc.queued > devctl_queue_length) {
832 n1 = TAILQ_FIRST(&devsoftc.devq);
833 TAILQ_REMOVE(&devsoftc.devq, n1, dei_link);
836 devsoftc.queued--;
838 if (mtx_initialized(&devsoftc.mtx))
839 mtx_unlock(&devsoftc.mtx);