Killing off /dev/kmem
Killing off /dev/kmem
Posted Apr 7, 2021 2:50 UTC (Wed) by songmaster (subscriber, #1748)In reply to: Killing off /dev/kmem by shakkhar
Parent article: Killing off /dev/kmem
This isn’t an example of reading the loadavg values, but for some code that goes delving into the internals of the OS to get data out of it I recommend looking at the legacy branch of the lsof program at https://github.com/lsof-org/lsof/tree/legacy. It supported many versions of Unix, and had to find and extract many different pieces of data to generate its output. The 00PORTING file at https://github.com/lsof-org/lsof/blob/legacy/00PORTING mentions briefly how it actually did that, and even takes a dig at “some down-sides to the Linux /proc-based lsof.”