KNOTE(9)

πŸ“¦
version 11.0 Β· 2 versions
, in nixpkgs unstable

🌸 NAME 🌸

okay bestie, welcome to the KNOTE(9) page from the Kernel Developer’s Manual, section 9 β€” it’s giving kernel-event realness ✨

  • knote, KNOTE β€” raise kernel event πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <sys/event.h>

void
knote(struct klist *list, long hint);

KNOTE(struct klist *list, long hint);

✨ DESCRIPTION ✨

so the knote() function is literally the hook into the kqueue kernel event notification mechanism β€” it lets sections of the kernel 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, plus a hint (which is passed to the appropriate filter routine). then knote() 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(9). no cap, that’s the rule 😭

KNOTE() is a macro that calls knote(list, hint) if list is not empty ✨


πŸŽ€ SEE ALSO πŸŽ€


πŸ’œ HISTORY πŸ’œ

the knote() and KNOTE() functions first appeared in FreeBSD 4.1, and then in NetBSD 2.0 🌈


πŸ‘‘ AUTHORS πŸ‘‘

the kqueue(2) system was written by Jonathan Lemon <jlemon@FreeBSD.org> πŸ“


and that’s the whole page, bestie β€” the footer says Debian, dated February 18, 2004, and it’s the KNOTE(9) page πŸ’‹βœ¨

πŸ“¦ where this page comes from