gpt4 book ai didi

c - watchdog_fire 中的 usermodehelper API 调用

转载 作者:太空宇宙 更新时间:2023-11-04 11:22:24 24 4
gpt4 key购买 nike

我可以在软件 irq 中调用 usermodehelper API 吗?

例如,我想在内核执行watchdog_fire()时在用户空间执行“pstack”程序。我试过调用它,但它总是导致内核崩溃。

watchdog_fire+0xf4/0x138
run_timer_softirq+0x168/0x248
_do_softirq+0x114/0x158
do_softirq+0x68/0x70
plat_irq_dispatch+0xc0/0x180
ret_from_irq+0x0/0x4

最佳答案

看看 linux 3.4.4 内核树 (kernel/kmod.c) 中的这个注释。这在更新的内核版本中可能已经改变,也可能没有改变。请注意 wait 标志。

/**
* call_usermodehelper_exec - start a usermode application
* @sub_info: information about the subprocessa
* @wait: wait for the application to finish and return status.
* when -1 don't wait at all, but you get no useful error back when
* the program couldn't be exec'ed. This makes it safe to call
* from interrupt context.
*
* Runs a user-space application. The application is started
* asynchronously if wait is not set, and runs as a child of keventd.
* (ie. it runs with full root capabilities).
*/
int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)

关于c - watchdog_fire 中的 usermodehelper API 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17332114/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com