+/*
+ * Extended codes returned by filter routines when f_extended_codes is set.
+ *
+ * FILTER_ACTIVE
+ * The filter is active and a call to f_process() may return an event.
+ *
+ * For f_process() the meaning is slightly different: the knote will be
+ * activated again as long as f_process returns FILTER_ACTIVE, unless
+ * EV_CLEAR is set, which require a new f_event to reactivate the knote.
+ *
+ * Valid: f_attach, f_event, f_touch, f_process, f_peek
+ * Implicit: -
+ * Ignored: -
+ *
+ * FILTER_REGISTER_WAIT
+ * The filter wants its f_post_register_wait() to be called.
+ *
+ * Note: It is only valid to ask for this behavior for a workloop kqueue,
+ * and is really only meant to be used by EVFILT_WORKLOOP.
+ *
+ * Valid: f_attach, f_touch
+ * Implicit: -
+ * Ignored: f_event, f_process, f_peek
+ *
+ * FILTER_UPDATE_REQ_QOS
+ * The filter wants the passed in QoS to be updated as the new intrinsic qos
+ * for this knote. If the kevent `qos` field is 0, no update is performed.
+ *
+ * This also will reset the event QoS, so FILTER_ADJUST_EVENT_QOS() must
+ * also be used if an override should be maintained.
+ *
+ * Valid: f_touch
+ * Implicit: f_attach
+ * Ignored: f_event, f_process, f_peek
+ *
+ * FILTER_RESET_EVENT_QOS
+ * FILTER_ADJUST_EVENT_QOS(qos)
+ * The filter wants the QoS of the next event delivery to be overridden
+ * at the specified QoS. This allows for the next event QoS to be elevated
+ * from the knote requested qos (See FILTER_UPDATE_REQ_QOS).
+ *
+ * Event QoS Overrides are reset when a particular knote is no longer
+ * active. Hence this is ignored if FILTER_ACTIVE isn't also returned.
+ *
+ * Races between an f_event() and any other f_* routine asking for
+ * a specific QoS override are handled generically and the filters do not
+ * have to worry about them.
+ *
+ * To use this facility, filters MUST set their f_adjusts_qos bit to true.
+ *
+ * It is expected that filters will return the new QoS they expect to be
+ * applied from any f_* callback except for f_process() where no specific
+ * information should be provided. Filters should not try to hide no-ops,
+ * kevent will already optimize these away.
+ *
+ * Valid: f_touch, f_attach, f_event, f_process
+ * Implicit: -
+ * Ignored: f_peek
+ *
+ * FILTER_THREADREQ_NODEFEER
+ * The filter has moved a turnstile priority push away from the current
+ * thread, preemption has been disabled, and thread requests need to be
+ * commited before preemption is re-enabled.
+ *
+ *
+ * Valid: f_attach, f_touch
+ * Implicit: -
+ * Invalid: f_event, f_process, f_peek
+ */
+#define FILTER_ACTIVE 0x00000001
+#define FILTER_REGISTER_WAIT 0x00000002
+#define FILTER_UPDATE_REQ_QOS 0x00000004
+#define FILTER_ADJUST_EVENT_QOS_BIT 0x00000008
+#define FILTER_ADJUST_EVENT_QOS_MASK 0x00000070
+#define FILTER_ADJUST_EVENT_QOS_SHIFT 4
+#define FILTER_ADJUST_EVENT_QOS(qos) \
+ (((qos) << FILTER_ADJUST_EVENT_QOS_SHIFT) | FILTER_ADJUST_EVENT_QOS_BIT)
+#define FILTER_RESET_EVENT_QOS FILTER_ADJUST_EVENT_QOS_BIT
+#define FILTER_THREADREQ_NODEFEER 0x00000080
+
+#define filter_call(_ops, call) \
+ ((_ops)->f_extended_codes ? (_ops)->call : !!((_ops)->call))