我可以在内核中设置 Linux SIGUSR1 吗?
我可能会完全错误地处理这个问题,但是...
我有一个 Linux 内核设备驱动程序,它处理外部中断,并且当前在发生时执行 printk() 。
我想做的是告诉用户空间应用程序此事件已发生,以便它可以唤醒并执行一些操作。
是否可以(/简单/良好实践)从内核内部设置 SIGUSR1,然后通过
signal (SIGUSR1, <handler function>);
感谢从用户空间捕获它
I might be approaching this all wrong but...
I have a linux kernel device driver that handles an external interrupt and currently performs a printk() when it occurs.
What I would like to do is tell a user space app that this event has occurred so it can wake up and do some stuff.
Is it possible (/simple /good practice) to set the SIGUSR1 from within the kernel and then capture it from user space via
signal (SIGUSR1, <handler function>);
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这听起来不是一个好主意。如果可能的话,您必须以某种方式向驱动程序提供用户空间人员的进程 ID,以便驱动程序可以欺骗其获取信号。
我将创建一个 /dev/xxx,打开它,驱动程序可以在事件发生时使文件描述符处于活动状态。甚至可能提供更多信息。
This doesn't sound like a very good idea. If it is even possible, you'd have to somehow give the driver the process id of the user-space guy so the driver could finagle getting a signal to it.
I would create a /dev/xxx, open it, and the driver could make the file descriptor active when the event occurs. Maybe even provide more information.