-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsys_call8.c
59 lines (46 loc) · 1.19 KB
/
sys_call8.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <linux/linkage.h>
#include <linux/moduleloader.h>
#include <linux/slab.h>
#include <linux/notifier.h>
#include <linux/netdevice.h>
extern struct atomic_notifier_head my_noti_chain;
asmlinkage extern long (*sysptr8)(void *arg);
int val = 8;
int my_event_handler (struct notifier_block *self,
unsigned long val, void *data);
/*
* BUG : CONFIG_DEBUG_NOTIFIER
* invalid callback function called
*/
static struct notifier_block my_notifier = {
.notifier_call = my_event_handler,
};
int my_event_handler (struct notifier_block *self,
unsigned long val, void *data)
{
printk ("my_event: Val=%ld\n", val);
return 0;
}
asmlinkage long call8(void *arg)
{
return 0;
}
static int __init init_sys_call8(void)
{
printk("installed new sys_call8 module\n");
if (sysptr8 == NULL)
sysptr8 = call8;
/* Register User defined Notifier */
atomic_notifier_chain_register (&my_noti_chain, &my_notifier);
return 0;
}
static void __exit exit_sys_call8(void)
{
if (sysptr8 != NULL)
sysptr8 = NULL;
/* Unregister User defined Notifier */
atomic_notifier_chain_unregister (&my_noti_chain, &my_notifier);
}
module_init(init_sys_call8);
module_exit(exit_sys_call8);
MODULE_LICENSE("GPL");