Watching for new files/symlinks/devices in sysfs (possible? which syscall?)

Richard richard_siegfried at systemli.org
Tue Jun 13 18:24:14 EDT 2023


Update (because someone asked):

udev is no viable alternative.
We tried it with udev, it's too slow. It's about an embedded device 
where time is of essence.
And we made some measurements, even simply polling with a python script 
in /sys/ is over a second faster than waiting for udev.

-- Richard


On 13.06.23 23:31, Richard wrote:
> Hi,
> is there a possibility, in sysfs, to watch for new symlinks (i.e. 
> devices) beeing added to /sys/bus/usb/devices (like with inotify for 
> normal directories)?
> 
> I know you can use select() (userspace) and sysfs_notify() (kernelspace) 
> for attributes , but is there something for folders and new devices (or 
> symlinks)?
> 
> Thanks,
> -- Richard
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



More information about the Kernelnewbies mailing list