fix bug get_timer

This commit is contained in:
zy
2023-12-01 04:59:56 -05:00
parent 21862f1271
commit 0d1f57f06e
2 changed files with 10 additions and 2 deletions

View File

@@ -69,7 +69,10 @@ static long device_ioctl(struct file *file, unsigned int ioctl_num,
warg.time_ns =
warg.time_ns == 0 ? def_interval_ns : warg.time_ns; // default 10us
// start watch variable
start_watch_variable(warg);
ret = start_watch_variable(warg);
if (ret) {
printk(KERN_INFO "start_watch_variable failed\n");
}
break;
case IOCTL_DUMP_LOG:
printk(KERN_INFO "variable_monitor IOCTL_DUMP_LOG\n");

View File

@@ -239,7 +239,7 @@ int monitor_init(void) {
if (ret)
return ret;
//!todo
ret = init_buffer(512 * 1024 * 1024); // 512M
ret = init_buffer(256 * 1024 * 1024); // 512M
if (ret)
return -1;
return 0;
@@ -284,6 +284,11 @@ int start_watch_variable(watch_arg warg) {
w_arg2k_w_arg(kptr, warg, &k_watch_arg);
timer = get_timer(warg.time_ns); // get a valuable timer
if (timer == NULL) {
printk(KERN_ERR "Timer is full\n");
return -1;
}
INIT_WORK(&timer->wk, diag_task_info_work);
printk(KERN_INFO "ptr transform kptr: %p\n", kptr);