I am studying about Linux Interrupt handling mechanism, just got doubt whether registering an interrupt handler from user-space is allowed or not?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
No, interrupts are registered in the kernel and a driver / module must be loaded into kernel space to receive the interrupt. It could pass handling onto a user space daemon that hooks into the kernel module, but the something must be inserted into the kernel.
回答2:
Cannot register user space interrupt handler directly.
Kernel ISR indicates interrupt by writing file / setting register / signalling. User space application polls this and goes on with the appropriate code.
Linux file abstraction is used to connect kernel and user space. This is mostly performed by character devices and ioctl() calls.
https://stackoverflow.com/a/47776006/5349798