Closed tal-zvon closed 3 years ago
The kernel has a queue per LineRequest which are not shared between processes. You should even be able to have multiple per process if you have a use case for that.
https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib-cdev.c#L469
Note that if the FIFO fills, events will be dropped:
https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib-cdev.c#L523
Just looking for a bit of clarification here.
From what I understand, this is how it works:
Importantly, this queue is per-process. As in, when our Rust application starts up, and uses
gpio_cdev
to register to be notified about a pin state change with:The kernel sets up a queue specifically for this process, for this one line.
The alternative, which I'm really hoping isn't the case, is that there's one queue per line that the kernel maintains, and when your Rust application starts, and registers to be notified, the queue may already have events in it that may potentially need to be discarded.