如何从 IRQ 处理程序终止用户应用程序?
我正在开发嵌入式 Linux 系统,当特定的 IRQ 处理程序运行时,我需要关闭系统。我没有很多时间(几十毫秒)。我正在使用 Emergency_restart(),但我现在需要执行一些无法从中断上下文中完成的工作(将与关闭相关的信息写入闪存),因为闪存驱动程序不支持它。
谁能推荐一个好方法来实现这一目标?我希望通过向用户空间应用程序发送信号来正确终止它们,以便它们可以进行闪存写入。我该怎么做?我想,作为替代方案,我可以有一个高优先级进程,等待我的中断生成的信号量......我有什么选择?提前致谢!
I am working on an embedded Linux system, and I need to shut the system down when a particular IRQ handler runs. I don't have a lot of time (tens of milliseconds). I was using emergency_restart(), but I now need to perform some work (writing shutdown-related info to flash) that cannot be done from an interrupt context because the flash driver will not support it.
Can anyone recommend a good way to accomplish this? I would love to properly kill my user-space applications by sending them a signal so that they can do the flash write. How do I do this? I suppose, as an alternative, I could have a high priority process that sits, waiting on a semaphore that my interrupt generates... What are my options? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这正是信号的用途。如果现有信号之一没有意义(请参阅
man 7 signal
),请使用用户可定义信号之一:That is exactly what signals are for. If one of the existing signals don't make sense (see
man 7 signal
), use one of the user definable signals: