Lines Matching defs:efd

615 	struct eventfd *efd;
628 efd = malloc(sizeof(*efd), M_EPOLL, M_WAITOK | M_ZERO);
629 efd->efd_flags = flags;
630 efd->efd_count = initval;
631 mtx_init(&efd->efd_lock, "eventfd", NULL, MTX_DEF);
633 knlist_init_mtx(&efd->efd_sel.si_note, &efd->efd_lock);
639 finit(fp, fflags, DTYPE_LINUXEFD, efd, &eventfdops);
666 struct eventfd *efd;
668 efd = fp->f_data;
669 if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
672 seldrain(&efd->efd_sel);
673 knlist_destroy(&efd->efd_sel.si_note);
676 mtx_destroy(&efd->efd_lock);
677 free(efd, M_EPOLL);
686 struct eventfd *efd;
690 efd = fp->f_data;
691 if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
698 mtx_lock(&efd->efd_lock);
700 if (efd->efd_count == 0) {
701 if ((efd->efd_flags & LINUX_O_NONBLOCK) != 0) {
702 mtx_unlock(&efd->efd_lock);
705 error = mtx_sleep(&efd->efd_count, &efd->efd_lock, PCATCH, "lefdrd", 0);
710 if ((efd->efd_flags & LINUX_EFD_SEMAPHORE) != 0) {
712 --efd->efd_count;
714 count = efd->efd_count;
715 efd->efd_count = 0;
717 KNOTE_LOCKED(&efd->efd_sel.si_note, 0);
718 selwakeup(&efd->efd_sel);
719 wakeup(&efd->efd_count);
720 mtx_unlock(&efd->efd_lock);
723 mtx_unlock(&efd->efd_lock);
732 struct eventfd *efd;
736 efd = fp->f_data;
737 if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
749 mtx_lock(&efd->efd_lock);
751 if (UINT64_MAX - efd->efd_count <= count) {
752 if ((efd->efd_flags & LINUX_O_NONBLOCK) != 0) {
753 mtx_unlock(&efd->efd_lock);
758 error = mtx_sleep(&efd->efd_count, &efd->efd_lock,
764 efd->efd_count += count;
765 KNOTE_LOCKED(&efd->efd_sel.si_note, 0);
766 selwakeup(&efd->efd_sel);
767 wakeup(&efd->efd_count);
769 mtx_unlock(&efd->efd_lock);
778 struct eventfd *efd;
781 efd = fp->f_data;
782 if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
785 mtx_lock(&efd->efd_lock);
786 if ((events & (POLLIN|POLLRDNORM)) && efd->efd_count > 0)
788 if ((events & (POLLOUT|POLLWRNORM)) && UINT64_MAX - 1 > efd->efd_count)
791 selrecord(td, &efd->efd_sel);
792 mtx_unlock(&efd->efd_lock);
801 struct eventfd *efd;
803 efd = fp->f_data;
804 if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
807 mtx_lock(&efd->efd_lock);
816 mtx_unlock(&efd->efd_lock);
820 kn->kn_hook = efd;
821 knlist_add(&efd->efd_sel.si_note, kn, 1);
822 mtx_unlock(&efd->efd_lock);
830 struct eventfd *efd = kn->kn_hook;
832 mtx_lock(&efd->efd_lock);
833 knlist_remove(&efd->efd_sel.si_note, kn, 1);
834 mtx_unlock(&efd->efd_lock);
841 struct eventfd *efd = kn->kn_hook;
844 mtx_assert(&efd->efd_lock, MA_OWNED);
845 ret = (efd->efd_count > 0);
854 struct eventfd *efd = kn->kn_hook;
857 mtx_assert(&efd->efd_lock, MA_OWNED);
858 ret = (UINT64_MAX - 1 > efd->efd_count);
877 struct eventfd *efd;
879 efd = fp->f_data;
880 if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
887 efd->efd_flags |= LINUX_O_NONBLOCK;
889 efd->efd_flags &= ~LINUX_O_NONBLOCK;