如何执行“kill_proc()”在Linux内核2.6.31.5中
尝试这个面向开发人员的免费论坛。我正在将串行驱动程序迁移到内核 2.6.31.5。我使用了各种书籍和文章来解决从 2.4 开始的问题
现在我有几个在内核 2.6.31.5 中不再支持的kill_proc 将
其迁移到内核 2.6.31.5 杀死线程的最快方法是什么。在书中他们说使用kill(),但在2.6.31.5中似乎并非如此。使用 send_signal 是一个好方法,但是我该怎么做呢?必须有一个task_struct或其他东西,我希望我可以提供我的PID和SIGTERM,然后杀死我的线程,但它看起来更复杂,必须设置一个带有我不知道的参数的结构。
如果有人有一个真实的例子,或者一个包含内核 2.6.31 最新信息的链接,我将非常感激。简而言之,我需要杀死我的线程,这并不难。 ;)
这是我现在的代码:
kill_proc(ex_pid, SIGTERM, 1);
/约尔根
Trying this free forum for developers. I am migrating a serial driver to kernel 2.6.31.5. I have used various books and articles to solve problems going from 2.4
Now I have a couple of kill_proc that is not supported anymore in kernel 2.6.31.5
What would be the fastest way to migrate this into the kernel 2.6.31.5 way of killing a thread. In the books they say use kill() but it does not seem to be so in 2.6.31.5. Using send_signal would be a good way, but how do I do this? There must be a task_struct or something, I wich I could just provide my PID and SIGTERM and go ahaed and kill my thread, but it seems more complicated, having to set a struct with parameters I do not know of.
If anyone have a real example, or a link to a place with up to date info on kernel 2.6.31 I would be very thankful. Siply put, I need to kill my thread, and this is not suppose to be hard. ;)
This is my code now:
kill_proc(ex_pid, SIGTERM, 1);
/Jörgen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了与 kthreads 一起使用,现在调用者(例如模块的退出函数)可以调用
kthread_stop
。 kthread本身必须使用kthread_should_stop
进行检查。内核源代码树中很容易提供这样的示例。For use with kthreads, there is now
kthread_stop
that the caller (e.g. the module's exit function) can invoke. The kthread itself has to check usingkthread_should_stop
. Examples of that are readily available in the kernel source tree.