-/* $OpenBSD: kern_event.c,v 1.193 2022/08/14 01:58:27 jsg Exp $ */
+/* $OpenBSD: kern_event.c,v 1.194 2022/11/09 22:25:36 claudio Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
error = 0;
reinserted = 0;
- /* msleep() with PCATCH requires kernel lock. */
- KERNEL_LOCK();
-
mtx_enter(&kq->kq_lock);
if (kq->kq_state & KQ_DYING) {
mtx_leave(&kq->kq_lock);
- KERNEL_UNLOCK();
error = EBADF;
goto done;
}
if ((tsp != NULL && !timespecisset(tsp)) ||
scan->kqs_nevent != 0) {
mtx_leave(&kq->kq_lock);
- KERNEL_UNLOCK();
error = 0;
goto done;
}
kq->kq_state |= KQ_SLEEP;
error = kqueue_sleep(kq, tsp);
/* kqueue_sleep() has released kq_lock. */
- KERNEL_UNLOCK();
if (error == 0 || error == EWOULDBLOCK)
goto retry;
/* don't restart after signals... */
goto done;
}
- /* The actual scan does not sleep on kq, so unlock the kernel. */
- KERNEL_UNLOCK();
-
/*
* Put the end marker in the queue to limit the scan to the events
* that are currently active. This prevents events from being