x
Loading
 Loading
Hello, Guest | Login | Register

Notifier Chains and Completion Functions

Kernel helper interfaces make life easier for developers. Learn about notifier chains, completion functions and error handling aids.

Over the last couple of months,” Gearheads” showed how you can benefit from kernel helpers, such as linked lists, work queues and seq files. This month, let’s continue and explore more helper interfaces, like notifier chains, completion functions, kernel thread helpers, and error handling aids.

Notifier Chains

Notifier chains send status change messages to code regions that request them. Unlike hard-coded mechanisms, notifiers offer a versatile technique for dynamically loadable code to get notified when events of interest occur. Notifier chains were originally added to pass network events to concerned sections of the kernel, but are now used for many other purposes.
The kernel implements a number of predefined notifiers for significant events. For example:
1.A die notification is sent when a kernel function triggers a trap or a fault, caused by an oops, page fault, or a breakpoint.
2.A network device notification is generated when a network interface goes up or down.
3.A CPU frequency notification is generated when there’s a transition in processor frequency.
4.A Internet address notification is sent when a change is detected in the IP address of a network interface.
To attach your code into a notifier chain, you register an event handler function with the corresponding chain. When the requisite event occurs, the handler is passed two arguments: an event identifier and a chain-specific data argument. To define your own (user-defined) notifier chain, you must also implement the infrastructure to initiate the chain…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace