3 ms·
Dollars to donuts you'll find some of these system utilities poking at procfs/sysfs in the first place. That's where I'd start anyways.
by inferiorhuman 2y ago
Dollars to donuts you'll find some of these system utilities poking at procfs/sysfs in the first place. That's where I'd start anyways.
- c0l0 2y agoNecessarily, as this is the kind of API (a file system with a well-defined structure) that the kernel exposes for querying/providing that kind of information :)
- inferiorhuman 2y agoI've never dug too far beyond procfs on Linux, but always assumed there was a more formal C API backing most of these things up like with sysctl (or in general on the BSDs). Relying so heavily on string parsing seems great for quick shell scripts but less great for other languages.
- zokier 2y agostrace is quite useful too as a starting point. for example you can easily see that `ss` gets its information through netlink (ditto about netstat).