init
This commit is contained in:
1
ass03/.gitignore
vendored
Normal file
1
ass03/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
30
ass03/main.c
Normal file
30
ass03/main.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static __init int do_work(int my_int)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < my_int; i++)
|
||||
udelay(10);
|
||||
if (my_int < 10)
|
||||
pr_info("We slept a long time");
|
||||
return i * my_int;
|
||||
}
|
||||
|
||||
static __init int my_init(void)
|
||||
{
|
||||
do_work(10);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __exit void my_exit(void)
|
||||
{
|
||||
}
|
||||
|
||||
module_init(my_init);
|
||||
module_exit(my_exit);
|
Reference in New Issue
Block a user