I am trying to understand the knote system (on 6.1) and I am having some troubles.
Specifically, I am confused by the uses of KN_DETACHED and EV_ONESHOT. >From what I can determine from the comments and code, knotes have a filterops member, kn_fop. This among other things has a callback to handle when a note is attached and detached. But e.g. in knlist_clear(), when knlist_remove_kq() removes a knote from the list, it sets KN_DETACHED but does not call the kn_fop->f_detach routine. Then, in the killkn case, KN_DETACHED is set (again). Otherwise, EV_ONESHOT is set, presumably so that kqueue_scan() will run on the knote. However, kqueue_scan() won't call kn_fop->f_detach either because KN_DETACHED is already set. It seems that in knlist_cleardel(), the killkn case should be calling kn_fop->f_detach before knote_drop(). It also seems that the !killkn case should not have KN_DETACHED set, which means that knlist_remove_kq() can't set it. Alternatively, knlist_remove_kq() should be calling kn_fop->f_detach itself before setting KN_DETACHED. But in that case I'm not sure I see why there needs to be a use of EV_ONESHOT. So am I reading this wrong, understanding it wrong, or is there a bug in the code? Thanks, matthew _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[email protected]"

