temp
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -161,7 +161,7 @@ int start_watch_variable(watch_arg warg) {
|
||||
* @param pid
|
||||
*/
|
||||
void clear_watch(pid_t pid) {
|
||||
printk(KERN_INFO "clear pid %d 's watch variable\n", pid);
|
||||
printk(KERN_INFO "Clear pid: %d's watch variable\n", pid);
|
||||
cancel_all_hrTimer(); // just in case
|
||||
del_all_kwarg_by_pid(pid); // delete all kwarg with pid
|
||||
free_page_list(pid); // free page with pid
|
||||
|
||||
@@ -22,7 +22,7 @@ int main()
|
||||
.ptr = &temps[i],
|
||||
.name = "temp",
|
||||
.length_byte = sizeof(int),
|
||||
.threshold = 150 + i,
|
||||
.threshold = 110 + i,
|
||||
.unsigned_flag = 0,
|
||||
.greater_flag = 1,
|
||||
.time_ns = 2000 + (i / 33) * 5000, // on hyper-v, 1us will block all system. 2us just fine, maybe 1us is too short for hyper-v
|
||||
@@ -48,4 +48,4 @@ int main()
|
||||
|
||||
cancel_watch();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user