Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

knote(9) [netbsd man page]

KNOTE(9)						   BSD Kernel Developer's Manual						  KNOTE(9)

NAME
knote, KNOTE -- raise kernel event SYNOPSIS
#include <sys/event.h> void knote(struct klist *list, long hint); KNOTE(struct klist *list, long hint); DESCRIPTION
The knote() function provides a hook into the kqueue kernel event notification mechanism to allow sections of the kernel to raise a kernel event in the form of a 'knote', which is a struct knote as defined in <sys/event.h>. knote() takes a singly linked list of knotes, along with a hint (which is passed to the appropriate filter routine). knote() then walks the list making calls to the filter routine for each knote. As each knote contains a reference to the data structure that it is attached to, the filter may choose to examine the data structure in deciding whether an event should be reported. The hint is used to pass in additional information, which may not be present in the data structure that the filter examines. If the filter decides that the event should be returned, it returns a non-zero value and knote() links the knote onto the tail end of the active list in the corresponding kqueue for the application to retrieve. If the knote is already on the active list, no action is taken, but the call to the filter occurs in order to provide an opportunity for the filter to record the activity. knote() must not be called from interrupt contexts running at an interrupt priority level higher than splsched(). KNOTE() is a macro that calls knote(list, hint) if list is not empty. SEE ALSO
kqueue(2), kfilter_register(9) HISTORY
The knote() and KNOTE() functions first appeared in FreeBSD 4.1, and then in NetBSD 2.0. AUTHORS
The kqueue() system was written by Jonathan Lemon <jlemon@FreeBSD.org>. BSD
February 18, 2004 BSD

Check Out this Related Man Page

KFILTER_REGISTER(9)					   BSD Kernel Developer's Manual				       KFILTER_REGISTER(9)

NAME
kfilter_register, kfilter_unregister -- add or remove kernel event filters SYNOPSIS
#include <sys/event.h> int kfilter_register(const char *name, struct filterops *filtops, int *retfilter); int kfilter_unregister(const char *name); DESCRIPTION
The kfilter_register() function adds a new kernel event filter (kfilter) to the system, for use by callers of kqueue(2) and kevent(2). name is the name of the new filter (which must not already exist), and filtops is a pointer to a filterops structure which describes the filter operations. Both name and filtops will be copied to an internal data structure, and a new filter number will be allocated. If retfilter is not NULL, then the new filter number will be returned in the address pointed at by retfilter. 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. RETURN VALUES
kfilter_register() returns 0 on success, EINVAL if there's an invalid argument, or EEXIST if the filter already exists, kfilter_unregister() returns 0 on success, EINVAL if there's an invalid argument, or ENOENT if the filter doesn't exist. SEE ALSO
kqueue(2), free(9), knote(9), malloc(9) HISTORY
The kfilter_register() and kfilter_unregister() functions first appeared in NetBSD 2.0. AUTHORS
The kfilter_register() and kfilter_unregister() functions were implemented by Luke Mewburn <lukem@NetBSD.org>. BSD
October 23, 2002 BSD
Man Page