2 ms·
Some version of *BSDs probably fixed that with some sysctl interface, but on older Unixes you would read the kernel memory to get that system information. You
by Erwin 7y ago
Some version of *BSDs probably fixed that with some sysctl interface, but on older Unixes you would read the kernel memory to get that system information.
You can see a ps.c implementation here: https://searchcode.com/codesearch/view/29853364/ https://searchcode.com/codesearch/view/29853364/
which uses kvm library: https://www.freebsd.org/cgi/man.cgi?query=kvm&sektion=3&apropos=0&manpath=FreeBSD+12.0-RELEASE+and+Ports https://www.freebsd.org/cgi/man.cgi?query=kvm&sektion=3&apro...
- trasz 7y agoFWIW, in FreeBSD libkvm also uses the sysctl interface, it doesn’t read kernel memory directly.