This commit is contained in:
zy
2023-11-17 01:59:41 -05:00
parent f47a39b2d7
commit 91f573d5f7
3 changed files with 5 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ struct my_device_data {
static int device_open(struct inode *inode, struct file *file) {
struct my_device_data *data;
printk(KERN_INFO "%s: with pid %d\n", __FUNCTION__, current->pid);
printk(KERN_INFO "variable_monitor fun: %s with pid %d\n", __FUNCTION__, current->pid);
// save pid
data = kmalloc(sizeof(*data), GFP_KERNEL);
if (!data)
@@ -32,9 +32,9 @@ static int device_open(struct inode *inode, struct file *file) {
}
static int device_release(struct inode *inode, struct file *file) {
// printk(KERN_INFO "%s\n", __FUNCTION__);
// load pid
struct my_device_data *data = file->private_data;
printk(KERN_INFO "variable_monitor fun: %s with pid %d\n", __FUNCTION__, data->pid);
// clear watch with pid
clear_watch(data->pid);
kfree(data); // free data memory