Skip to content

Instantly share code, notes, and snippets.

@pavel-odintsov pavel-odintsov/Makefile Secret

Last active Aug 29, 2015
Embed
What would you like to do?
Kernel module example for jiffies check and timestamp tcp article
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("Dual BSD/GPL");
#define tcp_time_stamp ((__u32)(jiffies))
static int hello_init(void) {
printk("<1> Hello world!\n");
printk("Current jiffie: %lu\n", jiffies);
printk("Current jiffie converted to timestamp: %u\n", tcp_time_stamp);
printk("Current HZ: %d\n", HZ);
return 0;
}
static void hello_exit(void) {
printk("<1> Bye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
obj-m := hello.o
all:
$(MAKE) -C /lib/modules/3.16.0-4-amd64/build/ M=`pwd` modules
clean:
$(MAKE) -C /lib/modules/3.16.0-4-amd64/build/ M=`pwd` clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.