Linux kernel question.

Asked 1 years ago, Updated 1 years ago, 66 views

After adding one module as insmod to the kernel space, the added driver tries to generate a SIGUSR1. At this time, I want to receive and process the SIGUSR1 signal of kernel space from user space, so what is the way to give the SIGUSR1 signal from kernel space to user space?

Thank you.

linux kernel

2022-09-22 12:55

1 Answers

You can use send_sig().
send_sig(int sig, struct task_struct *p, int priv)

ex )

send_sig(SIGUSR1, my_task, 0);
send_sig(SIGUSR2, my_task, 0);

Related link

You can put a task structure to deliver a signal in my_task part, but I know the pidCotton

struct task_struct *my_task;
my_task = pid_task(find_vpid(process_pid), PIDTYPE_PID);

You can find out the task in the same way as above.


2022-09-22 12:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.