#include #include #include static int __cpuinit my_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; switch (action) { case CPU_ONLINE: case CPU_ONLINE_FROZEN: printk("cpu 0x%x aktiviert\n", cpu); break; case CPU_DEAD: case CPU_DEAD_FROZEN: printk("cpu 0x%x deaktiviert\n", cpu); break; } return NOTIFY_OK; } static struct notifier_block my_cpu_notifier = { .notifier_call = my_cpu_callback; }; static int __init mod_initialize(void) { register_hotcpu_notifier(&my_cpu_notifier); printk("cpu_notifier angemeldet\n"); return 0; } static void __exit mod_release(void) { unregister_hotcpu_notifier(&my_cpu_notifier); printk("cpu_notifier abgemeldet\n"); } module_init( mod_initialize ); module_exit( mod_release ); MODULE_LICENSE("GPL");