用kernel_thread创建的内核进程,在内核中调用什么函数可以杀死这个进程
来源:互联网 发布:如何快速上传淘宝宝贝 编辑:程序博客网 时间:2024/04/29 08:32
创建kernel thread时调用allow_signal指定它响应什么信号;
别处的内核代码可以: 用 kill_proc发送信号给它
- /*
- * file mythread.c
- */
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
- #include <linux/param.h>
- #include <linux/jiffies.h>
- #include <asm/system.h>
- #include <asm/processor.h>
- #include <asm/signal.h>
- /*
- struct student {
- int age;
- char name[128];
- int score;
- };
- */
- static pid_t thread_id;
- struct completion exit_completion;
- int my_fuction(void *arg)
- {
- daemonize("demo-thread");
- allow_signal(SIGKILL);
- while(!signal_pending(current))
- {
- printk("jiffies is %lu/n", jiffies);
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(10 * HZ);
- }
- complete_and_exit(&exit_completion, 1);
- return 0;
- }
- static int __init init(void)
- {
- thread_id = kernel_thread(my_fuction, NULL, CLONE_FS | CLONE_FILES);
- return 0;
- }
- static void __exit fini(void)
- {
- kill_proc(thread_id, SIGKILL, 1);
- wait_for_completion(&exit_completion);
- printk("Goodbye/n");
- }
- module_init(init);
- module_exit(fini);
- MODULE_LICENSE("GPL");
- 用kernel_thread创建的内核进程,在内核中调用什么函数可以杀死这个进程
- Linux进程管理内核API函数kernel_thread( )
- Linux内核中 kernel_thread函数的若干问题说明
- linux内核函数kernel_thread
- 内核模块中错误调用kernel_thread创建内核线程导致模块无法卸载
- 浅析内核中用户进程的创建
- 内核线程函数kernel_thread解析
- Linux0.11内核--fork()函数创建进程
- Linux 内核--fork()函数创建进程
- Linux 内核--fork()函数创建进程
- Linux 内核--fork()函数创建进程
- 内核空间创建进程
- 在内核中添加一个可以在用户态调用的函数
- 内核中取得调用进程PID
- 通过fork函数创建进程的跟踪,分析linux内核进程的创建
- 找到调用内核接口的上层进程
- CreateProcess进程创建的内核跟踪分析
- CreateProcess进程创建的内核跟踪分析
- 3月3日更新!中国移动MobileMarket重点支持机型信息
- ShellExecute与ShellExecuteEx的用法
- SQL两表匹配,将A表的指定字段所有内容根据条件更新B表指定字段的所有内容
- 从小到大输出四个数(用if else)
- v$sql,v$sqlarea,v$sqltext有什么区别
- 用kernel_thread创建的内核进程,在内核中调用什么函数可以杀死这个进程
- 纠结归纠结
- 几个小游戏(用win-tc可以编译)
- Windows C++多线程与Linux C++多线程编程
- 类方法完成圆算法 (vc_0pengl)
- pku1351 Number of Locks
- 求救 各位帮帮忙
- apache 编译重写模块
- 并发及竞态