彭浩翔
彭浩翔

Reputation: 93

Does signal sent from kernel to user space real time?

I am writing a driver and try sending something from kernel to user space, what I gonna to(which is the only way I know), is to send a signal from kernel to user space, and call signal(...) somewhere in user space, which will catch it and use ioctl(...), now is time kernel send things to user space.

My question is, when signal sent, it has to wait util user space call signal(), and then do something?

And is there any other ways to talk between kernel and user space?

Upvotes: 0

Views: 162

Answers (1)

Did you consider having your driver just send some bytes on a file descriptor (e.g some socket(7) or pipe(7) or character device..)? Or using netlink(7) ? Or interact with systemd ?

A common way would be to have some helper process in user land (started at boot time) handling that file descriptor. That program would probably use some multiplexing system call like poll(2).

Beware that when your driver is running (and you try to send some signal), the current task might not be a process using your driver. So sending signals from kernel land could be tricky.

Upvotes: 0

Related Questions