You can refer to Interruptible_sleep_on and wake_up_interruptible code to implement sleep and awakening for the specified process,
Among them, use interruptible_sleep_on to place the current process into the sleep state and a sleep process management queue, the process in the queue can be disrupted, Wake_up_interruptible, wakes up the process in the sleep process management queue.
Below is a temporary written wake-up program for reference
#define __kernel__
#define module
#include
#include
#include
#include
Static Inline struct task_struct * self_find_task_by_pid (int PI)
{
Struct Task_struct * p, ** htable = & pidhash [pid_hashfn];
For (p = * htable; p && p-> pid! = pID; p = p-> pidhash_next);
Return P;
}
INT init_module (void)
{
Struct Task_struct * p;
PID_T PID = 9999; / * Need you to provide process number * /
Read_lock (& Tasklist_lock);
P = self_find_task_by_pid (pid);
Read_Unlock (& Tasklist_lock);
WAKE_UP_PROCESS (P); / * Wake-up * /
Return 0;
}
INT CLEANUP_MODULE ()
{
Return 0;
}