KFILTER_REGISTER(9) | Kernel Developer's Manual | KFILTER_REGISTER(9) |
int
kfilter_register(const char *name, struct filterops *filtops, int *retfilter);
int
kfilter_unregister(const char *name);
The kfilter_unregister() function removes a kfilter named name that was previously registered with kfilter_register(). If a filter with the same name is later reregistered with kfilter_register(), it will get a different filter number (i.e., filter numbers are not recycled). It is not possible to unregister the system filters (i.e., those that start with “EVFILT_” and are documented in kqueue(2)).
The filterops structure is defined as follows:
struct filterops { int f_isfd; /* true if ident == filedescriptor */ int (*f_attach)(struct knote *kn); /* called when knote is ADDed */ void (*f_detach)(struct knote *kn); /* called when knote is DELETEd */ int (*f_event)(struct knote *kn, long hint); /* called when event is triggered */ };
If the filter operation is for a file descriptor, f_isfd should be non-zero, otherwise it should be zero. This controls where the kqueue(2) system stores the knotes for an object.
kfilter_unregister() returns 0 on success, EINVAL if there's an invalid argument, or ENOENT if the filter doesn't exist.
October 23, 2002 | NetBSD 6.1 |