fasync_helper() and kill_fasync()¶
Purpose¶
The fasync API allows a driver to notify user space through SIGIO.
Driver Callback¶
static int mydev_fasync(int fd, struct file *file, int on)
{
struct mydev_data *dev = file->private_data;
return fasync_helper(fd, file, on, &dev->async_queue);
}
Event Notification¶
User-space Setup¶
User space typically needs to:
- Set the owner with
F_SETOWN - Enable
O_ASYNC - Install a
SIGIOhandler
Common Pitfalls¶
Warning
Signals are not a structured event queue. For complex event loops, bridging SIGIO into eventfd may be easier to integrate with epoll.