adjust output
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -315,17 +315,15 @@ int start_watch_variable(watch_arg warg) {
|
||||
timer = get_timer(warg.time_ns); // get a valuable timer
|
||||
|
||||
if (timer == NULL) {
|
||||
printk(KERN_ERR "Timer is full\n");
|
||||
printk(KERN_ERR "No timer available, ALL timer is full\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
INIT_WORK(&timer->wk, diag_task_info_work);
|
||||
|
||||
printk(KERN_INFO "ptr transform kptr: %p\n", kptr);
|
||||
printk(KERN_INFO "timer: %p\n", timer);
|
||||
printk(KERN_INFO "timer->sentinel: %d, timer->time_ns: %lld\n",
|
||||
timer->sentinel, timer->time_ns);
|
||||
printk(KERN_INFO "timer->hr_timer: %p\n", &timer->hr_timer);
|
||||
printk(KERN_INFO "Convert ptr to kptr: %p\n", kptr);
|
||||
printk(KERN_INFO "Associated timer: %p , there are already %d variables, timer period %lld.\n", timer, timer->sentinel, timer->time_ns);
|
||||
// printk(KERN_INFO "timer->hr_timer: %p\n", &timer->hr_timer);
|
||||
|
||||
TIMER_CANCEL(timer); // just in case
|
||||
timer_add_watch(timer, k_watch_arg);
|
||||
|
||||
@@ -67,7 +67,6 @@ kernel_watch_timer *get_timer(unsigned long long time_ns) {
|
||||
}
|
||||
// if all timer is full
|
||||
if (i >= MAX_TIMER_NUM) {
|
||||
printk(KERN_ERR "No timer available\n");
|
||||
return NULL;
|
||||
}
|
||||
// if a new timer, init it
|
||||
@@ -97,7 +96,7 @@ kernel_watch_timer *get_timer(unsigned long long time_ns) {
|
||||
unsigned char timer_add_watch(kernel_watch_timer *timer,
|
||||
kernel_watch_arg k_watch_arg) {
|
||||
if (TIMER_FILLED(timer)) {
|
||||
printk(KERN_ERR "Timer is full\n");
|
||||
printk(KERN_ERR "ALL Timer is full\n");
|
||||
return -1;
|
||||
}
|
||||
memcpy(&timer->k_watch_args[timer->sentinel], &k_watch_arg,
|
||||
|
||||
Reference in New Issue
Block a user