HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
General
cancel
Showing results for 
Search instead for 
Did you mean: 

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

 
kaijile
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
Laurent Menase
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

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.