Files
mcde/include
lotherkandClaude Sonnet 5.5 b0bff21e62 MCDE McdeSys: mcde_sys_processes, the list of processes (t0091, first part)
pid, parent, owner, command name, state, threads, real and virtual memory in
bytes, CPU time in ms.  NetBSD: sysctl KERN_PROC2 the way libkvm's kvm_getproc2
asks (size, then the buffer by count, ENOMEM -> again), CPU time from p_rtime_*
as ps(1) does (print.c:1059), state from p_realstat and the LWP's p_stat.
Linux: /proc/PID/stat read after the LAST ')', memory from statm.

Measured: test_processes (this process, init, a zombie until waited for, a
sleeping child named 'a b)c', SIGSTOP as T, SIGCONT back) and the three other
McdeSys tests PASS, mcde-linux exit=0.  Against ps -eo for every process in both
lists: 631 compared, parent, owner, threads, RSS, state and CPU time all agree.
First version used stat's rss: on this kernel it is larger than VmRSS/statm
(126 of 632 processes more than 10 % off), so statm is read.  The NetBSD code is
compiled against the NetBSD sysroot with x86_64--netbsd-gcc -Wall -Wextra
(all of netbsd.c, exit 0), not run there.  Also <ctype.h> in netbsd.c and
linux.c: isspace() was used undeclared (an error with GCC 14, masked in the
build by -Wno-error=implicit-function-declaration).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 23:45:47 +00:00
..