mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-12-05 00:50:52 +00:00
kern.proc.pathname, kern.proc.env and kern.proc.vmmap answered only the calling process's pid. FreeBSD 11.4's sysctl_kern_proc_pathname, sysctl_kern_proc_env and sysctl_kern_proc_vmmap look the id up with pget without PGET_NOTID, which maps an id above PID_MAX to the process of that thread, so they now accept the id of one of the calling process's live threads as kern.proc.pid does. Other pids still fail with ESRCH. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1.9 KiB
1.9 KiB
libkernel
change [kern.proc.pid]
- kern.proc.pid (libkernel) - what the console fills in a process's
kinfo_procis unverified;sysctl{CTL_KERN,KERN_PROC,KERN_PROC_PID, pid} for the calling process returns a 1,088-byte FreeBSD 11 amd64kinfo_proc(sys/sys/user.h) holding onlyki_structsize,ki_pid,ki_ppidandki_comm(eboot.bin, the base name of thekern.proc.pathnamevalue), with every other field 0, includingki_flag, soP_TRACED(0x800) is clear. Source Port (PPSA20040) asks for its own record with a 0x440-byte buffer and tests only bit 0x800 ofki_flagat offset 0x170, to see whether a debugger is attached. Other processes' pids and -1 fail withESRCH, a write withEPERMand a short buffer withENOMEM.
change [kern.proc.pid_td]
- kern.proc.pid_td (libkernel) - whether the console answers {
CTL_KERN,KERN_PROC,KERN_PROC_PID | KERN_PROC_INC_THREAD, pid} and what it fills in is unverified; here it returns onekern.proc.pidrecord per live guest thread, as FreeBSD 11.4'skern_proc_outdoes withoutKERN_PROC_NOTHREADS, withki_tid(thepthread_getthreadid_npvalue),ki_numthreads, and the thread name split asfill_kinfo_threadsplits it: up to 16 bytes inki_tdname, the next 3 inki_moretdname. Run time, CPU, state, priority and the other per-thread fields stay 0. As forkern.proc.pid, only the calling process is answered, by its pid or the id of one of its live threads: any other pid, -1 included, fails withESRCH, where FreeBSD'spgetalso answers for other visible processes.