Root Directory of a Process

From: Jishan Alam <jishanalam9128_at_gmail.com>
Date: Thu, 29 Jan 2026 15:54:45 UTC
Hello, I wanted to know how to get the root dir of a process using
sysctl or other libs, sysctl leads me to kinfo_proc where ki_pd
contains pwddesc-> pd_pwd which only works in kernel? if not how to
get it safely is there any way.
Context: Im porting an app from Linux where the app reads from
/proc/<pid>/root using readlink but since freebsd doesnt have it, how
to emulated if it can be emulated.
Thank You.
-- 
Best Regards,
Jishan Alam