Hacker News new | ask | show | jobs
by Erwin 2427 days 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/

which uses kvm library: https://www.freebsd.org/cgi/man.cgi?query=kvm&sektion=3&apro...

1 comments

FWIW, in FreeBSD libkvm also uses the sysctl interface, it doesn’t read kernel memory directly.