adjust output

This commit is contained in:
zy
2023-12-06 20:55:22 -05:00
parent b490da236e
commit 806356363c
3 changed files with 7 additions and 12 deletions

View File

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