kernel_watch_timer add *task

This commit is contained in:
zy
2023-12-19 22:28:35 -05:00
parent 46a03f0357
commit f2c70efbd5
2 changed files with 49 additions and 16 deletions

View File

@@ -32,6 +32,8 @@ typedef struct {
unsigned long long time_ns; // hrTimer time interval (ns)
struct hrtimer hr_timer; // hrTimer
ktime_t kt; // hrTimer time
struct task_struct *task; // task pointer
// one timer one task(process)
unsigned sentinel; // sentinel
kernel_watch_arg
k_watch_args[TIMER_MAX_WATCH_NUM]; // all watched kernel_watch_arg
@@ -40,8 +42,6 @@ typedef struct {
int threshold_buffer[TIMER_MAX_WATCH_NUM]; //
struct work_struct wk; // for handle
unsigned long long tv; // time
struct task_struct *task; // task pointer
// one timer one task(process)
} kernel_watch_timer;
// Global variable
@@ -59,7 +59,7 @@ unsigned char del_all_kwarg_by_pid(pid_t pid);
#define TIMER_CANCEL(timer) (hrtimer_cancel(&timer->hr_timer))
// for timer
kernel_watch_timer *get_timer(unsigned long long time_ns);
kernel_watch_timer *get_timer(pid_t tid, unsigned long long time_ns);
unsigned char timer_add_watch(kernel_watch_timer *timer,
kernel_watch_arg k_watch_arg);
unsigned char timer_del_watch_by_pid(kernel_watch_timer *timer, pid_t pid);