General
cancel
Showing results for 
Search instead for 
Did you mean: 

how to get current directory's full pathname in the kernel space?

 
Highlighted
Frequent Advisor

how to get current directory's full pathname in the kernel space?

The struct proc has struct vnode *p_cdir ,but i want to get the proc's current directory's full pathname.


Is there have any ways to do it?
2 REPLIES 2
Highlighted
Honored Contributor

Re: how to get current directory's full pathname in the kernel space?

Hi Kajile,

same as previous, in the same way you get the file name with pstats

Highlighted
Acclaimed Contributor

Re: how to get current directory's full pathname in the kernel space?

I would imagine since users can't do this directly, neither can the kernel.
getcwd(3) must walk the path using opendir .. and searching for the inode of the subdirectory.