Root Directory of a Process

0 views
Skip to first unread message

Jishan Alam

unread,
Jan 29, 2026, 10:55:29 AM (2 days ago) Jan 29
to freebsd-...@freebsd.org, ques...@freebsd.org
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

Pete Wright

unread,
Jan 29, 2026, 3:15:57 PM (2 days ago) Jan 29
to ques...@freebsd.org
i think libprocstat(3) would be the way to go here. i use procstat(1)
for shell scripting to get surface info similar to linux's procfs, so
that might have what you are looking for.

-pete

--
Pete Wright
pe...@nomadlogic.org


Reply all
Reply to author
Forward
0 new messages