3 ms·
There are a couple of options. A good number of other UNIXes do in fact have a procfs. Some others, like macOS, have a system call that gives you the informatio
by geofft 10y ago
There are a couple of options. A good number of other UNIXes do in fact have a procfs. Some others, like macOS, have a system call that gives you the information you want (on macOS this is a sysctl, CTL_KERN / KERN_PROC / KERN_PROC_ALL, which returns a set of structs). And finally, especially on older UNIXes, the ps command is setuid root, and goes and opens /dev/kmem or similar and looks around in kernel memory and parses the live kernel's process table directly.