3 ms·
Agree, ioctls are a good replacement of /proc for exposing simple, structured information to/from the kernel. It is still not perfect for all use cases though,
by Galanwe 3y ago
Agree, ioctls are a good replacement of /proc for exposing simple, structured information to/from the kernel.
It is still not perfect for all use cases though, especially because it forces you to operate in a _polling_ fashion.
Programs like top/iotop/htop are a good example (also, who is not guilty of abusing one liners a-la `watch -n1 cat /proc/meminfo`?). Instead of polling /proc or ioctls, you would really like to register on events, and get notifications pushed.
Netlink is well suited for these kinds of scenarios, though mostly to get notified of network interface changes last I checked.
- twic 3y agoThat's an interesting point. I wonder if some sort of polling interface to ioctls would be feasible. On top of kqueue or io_uring or something maybe.
- zokier 3y agoNetlink is pretty much as good as it gets here. It is explicitly designed as improvement over ioctl mess > Netlink is often described as an ioctl() replacement. It aims to replace fixed-format C structures as supplied to ioctl() with a format which allows an easy way to add or extended the arguments.