| 2319 | } |
| 2320 | |
| 2321 | static void |
| 2322 | knlist_remove_kq(struct knlist *knl, struct knote *kn, int knlislocked, |
| 2323 | int kqislocked) |
| 2324 | { |
| 2325 | |
| 2326 | KASSERT(!kqislocked || knlislocked, ("kq locked w/o knl locked")); |
| 2327 | KNL_ASSERT_LOCK(knl, knlislocked); |
| 2328 | mtx_assert(&kn->kn_kq->kq_lock, kqislocked ? MA_OWNED : MA_NOTOWNED); |
| 2329 | KASSERT(kqislocked || kn_in_flux(kn), ("knote %p not in flux", kn)); |
| 2330 | KASSERT((kn->kn_status & KN_DETACHED) == 0, |
| 2331 | ("knote %p was already detached", kn)); |
| 2332 | if (!knlislocked) |
| 2333 | knl->kl_lock(knl->kl_lockarg); |
| 2334 | SLIST_REMOVE(&knl->kl_list, kn, knote, kn_selnext); |
| 2335 | kn->kn_knlist = NULL; |
| 2336 | if (!knlislocked) |
| 2337 | kn_list_unlock(knl); |
| 2338 | if (!kqislocked) |
| 2339 | KQ_LOCK(kn->kn_kq); |
| 2340 | kn->kn_status |= KN_DETACHED; |
| 2341 | if (!kqislocked) |
| 2342 | KQ_UNLOCK(kn->kn_kq); |
| 2343 | } |
| 2344 | |
| 2345 | /* |
| 2346 | * remove knote from the specified knlist |
no test coverage detected