i want to set rise the priority and the affinity of irq processes (spi, gpiod) in linux, from a program written in C/C++. To set the priority of my own process I use pthread_setschedparam
to set the affinity of my own process I use pthread_setaffinity_np
. I use pthread_self() for this functions. However especially the gpio irqs are tricky because they only are created after
gpiod_line_request_rising_edge_events
[1] is called. Until now I just use a shell command similar to chrt -f -p 90 $(pgrep myGpio)
to give the irqs higher prioritys on my system I could just put that in a system("..")
function but there should be a better solution which I just do not know.
Thank you in Advance
[1]https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/include/gpiod.h#n499
I solved it by using libprocps. It is possible to get the pid of the irq via the name of the gpio or of the spi device and then to set the cpu affinity/priority of the irq.