don't call f_detach if the filter has alread removed the knote.. This

happens when a proc exits, but needs to inform the user that this has
happened..  This also means we can remove the check for detached from
proc and sig f_detach functions as this is doing in kqueue now...

MFC after:	5 days
This commit is contained in:
John-Mark Gurney 2004-09-06 19:02:42 +00:00
parent 1c932d5559
commit 9b90387dcf
2 changed files with 10 additions and 11 deletions

View File

@ -334,9 +334,6 @@ filt_procdetach(struct knote *kn)
{
struct proc *p;
if (kn->kn_status & KN_DETACHED)
return;
p = kn->kn_ptr.p_proc;
knlist_remove(&p->p_klist, kn, 0);
kn->kn_ptr.p_proc = NULL;
@ -859,7 +856,8 @@ findkn:
} else if (kev->flags & EV_DELETE) {
kn->kn_status |= KN_INFLUX;
KQ_UNLOCK(kq);
kn->kn_fop->f_detach(kn);
if (!(kn->kn_status & KN_DETACHED))
kn->kn_fop->f_detach(kn);
knote_drop(kn, td);
goto done;
}
@ -1158,7 +1156,8 @@ start:
* it _INFLUX.
*/
*kevp = kn->kn_kevent;
kn->kn_fop->f_detach(kn);
if (!(kn->kn_status & KN_DETACHED))
kn->kn_fop->f_detach(kn);
knote_drop(kn, td);
KQ_LOCK(kq);
kn = NULL;
@ -1357,7 +1356,8 @@ kqueue_close(struct file *fp, struct thread *td)
("KN_INFLUX set when not suppose to be"));
kn->kn_status |= KN_INFLUX;
KQ_UNLOCK(kq);
kn->kn_fop->f_detach(kn);
if (!(kn->kn_status & KN_DETACHED))
kn->kn_fop->f_detach(kn);
knote_drop(kn, td);
KQ_LOCK(kq);
}
@ -1369,7 +1369,8 @@ kqueue_close(struct file *fp, struct thread *td)
("KN_INFLUX set when not suppose to be"));
kn->kn_status |= KN_INFLUX;
KQ_UNLOCK(kq);
kn->kn_fop->f_detach(kn);
if (!(kn->kn_status & KN_DETACHED))
kn->kn_fop->f_detach(kn);
knote_drop(kn, td);
KQ_LOCK(kq);
}
@ -1672,7 +1673,8 @@ again:
}
kn->kn_status |= KN_INFLUX;
KQ_UNLOCK(kq);
kn->kn_fop->f_detach(kn);
if (!(kn->kn_status & KN_DETACHED))
kn->kn_fop->f_detach(kn);
knote_drop(kn, td);
influx = 1;
KQ_LOCK(kq);

View File

@ -219,9 +219,6 @@ filt_netdetach(struct knote *kn)
{
struct knlist *klist = (struct knlist *)kn->kn_hook;
if (kn->kn_status & KN_DETACHED)
return;
knlist_remove(klist, kn, 0);
}