April 2012
Intermediate to advanced
352 pages
8h
English
Example 3-3 is a complete KLD (based on code written by Andrzej Bialecki) that creates multiple sysctls.
Example 3-3. pointless.c
#include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/sysctl.h> static long a = 100; static int b = 200; static char *c = "Are you suggesting coconuts migrate?"; static struct sysctl_ctx_list clist; static struct sysctl_oid *poid; static intsysctl_pointless_procedure(SYSCTL_HANDLER_ARGS) { char *buf = "Not at all. They could be carried."; return (sysctl_handle_string(oidp, buf, strlen(buf), req)); } static int pointless_modevent(module_t ...
Read now
Unlock full access