News for hackers. Stuff that matters.
Re:Not knowing the /proc file system by Galanwe on Wednesday October 25, 2023 @12:46PM (#38014831)
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.

Re:Not knowing the /proc file system by twic on Wednesday October 25, 2023 @02:43PM (#38016614)
That'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.
Re:Not knowing the /proc file system by zokier on Wednesday October 25, 2023 @06:32PM (#38019199)
Netlink 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.