英文:
How can I flag a process from a kernel module?
问题
我有一个内核模块(用C编写),它正在工作,并希望实现以下功能:
- 接受用户输入的进程号
- 将该进程标记为SIGNAL_UNKILLABLE,就像Linux源代码中所示
#define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */
我已经在C中创建了一个内核模块并在网上搜索,但没有有效的结果。
英文:
I have a kernel module(in c), which is working and would like to:
- accept input from a user for a process number
- mark that process as SIGNAL_UNKILLABLE as in the linux source code
>#define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */
I created a kernel module in c and searched online, but no working results.
答案1
得分: 0
"How can I flag a process from a kernel module?
Looking at https://elixir.bootlin.com/linux/v6.0.19/A/ident/SIGNAL_UNKILLABLE, should be super normally.
struct task_struct *t = find_task_by_vpid(thepid);
t->signal->flags |= SIGNAL_UNKILLABLE;"
英文:
> How can I flag a process from a kernel module?
Looking at https://elixir.bootlin.com/linux/v6.0.19/A/ident/SIGNAL_UNKILLABLE, should be super normally.
struct task_struct *t = find_task_by_vpid(thepid);
t->signal->flags |= SIGNAL_UNKILLABLE;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论