Created
October 10, 2017 23:32
-
-
Save hashbrowncipher/426c39c87a6675374fad3015d4481f02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/hrtimer.h> | |
#include <linux/module.h> | |
#include <linux/kernel.h> | |
static struct hrtimer timer; | |
enum hrtimer_restart yell_rick( struct hrtimer *timer ) | |
{ | |
ktime_t time; | |
printk(KERN_INFO "I turned myself into a logger morty! I'm dmesg RIIIICK!\n"); | |
time = ktime_set(0, 1E9L); | |
hrtimer_forward_now(timer, time); | |
return HRTIMER_RESTART; | |
} | |
static int __init init_rick(void) | |
{ | |
ktime_t time; | |
printk(KERN_INFO "morty! Morty! MORRRTY!\n"); | |
time = ktime_set(0, 1E9L); | |
hrtimer_init(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | |
timer.function = yell_rick; | |
hrtimer_start(&timer, time, HRTIMER_MODE_REL); | |
return 0; | |
} | |
static void __exit exit_rick(void) | |
{ | |
hrtimer_cancel(&timer); | |
printk(KERN_INFO "This is the mega-genius equivalent of dying on the toilet.\n"); | |
} | |
MODULE_LICENSE("Dual MIT/GPL"); | |
module_init(init_rick); | |
module_exit(exit_rick); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment