[osol-discuss] How to get current working directory of the current process in the kernel

2008-05-20 Thread NiuLin
Hello everyone:
When I am programming a kernel module for Solaris, I encountered one
problem: I cannot get the the absolute path for the current working
directory of the current process.

In user space, we can do this by calling getcwd(), but this function does
not take kernel address as parameter so I can not call it in the kernel.

Then how can I getcwd in the kernel?

I can get the vnode pointer of the current dir, If there are any some easy
ways to convert the vnode pointer to the absolute path name, it's ok too.

Thanks a lot!
Niu Lin.
___
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Re: [osol-discuss] How to get current working directory of the current process in the kernel

2008-05-20 Thread Frank . Hofmann
On Tue, 20 May 2008, NiuLin wrote:

 Hello everyone:
 When I am programming a kernel module for Solaris, I encountered one
 problem: I cannot get the the absolute path for the current working
 directory of the current process.

 In user space, we can do this by calling getcwd(), but this function does
 not take kernel address as parameter so I can not call it in the kernel.

 Then how can I getcwd in the kernel?

 I can get the vnode pointer of the current dir, If there are any some easy
 ways to convert the vnode pointer to the absolute path name, it's ok too.

Use this one:

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/lookup.c#vnodetopath

FrankH.
___
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org


Re: [osol-discuss] How to get current working directory of the current process in the kernel

2008-05-20 Thread NiuLin
Thanks a lot for your quick reply! Actually, I have found this code already,
but as I know, dogetcwd is not exported by the kernel (not found in the
include files). How can I call this function?

2008/5/20 [EMAIL PROTECTED]:

 On Tue, 20 May 2008, NiuLin wrote:

  Hello everyone:
 When I am programming a kernel module for Solaris, I encountered one
 problem: I cannot get the the absolute path for the current working
 directory of the current process.

 In user space, we can do this by calling getcwd(), but this function does
 not take kernel address as parameter so I can not call it in the kernel.

 Then how can I getcwd in the kernel?

 I can get the vnode pointer of the current dir, If there are any some easy
 ways to convert the vnode pointer to the absolute path name, it's ok too.


 Use this one:


 http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/lookup.c#vnodetopath

 FrankH.




-- 
Thanks and Regards,
Niu Lin
___
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Re: [osol-discuss] How to get current working directory of the current process in the kernel

2008-05-20 Thread Frank . Hofmann
On Tue, 20 May 2008, NiuLin wrote:

 Thanks a lot for your quick reply! Actually, I have found this code already,
 but as I know, dogetcwd is not exported by the kernel (not found in the
 include files). How can I call this function?

#include /sys/pathname.h

for vnodetopath().

FrankH.


 2008/5/20 [EMAIL PROTECTED]:

 On Tue, 20 May 2008, NiuLin wrote:

  Hello everyone:
 When I am programming a kernel module for Solaris, I encountered one
 problem: I cannot get the the absolute path for the current working
 directory of the current process.

 In user space, we can do this by calling getcwd(), but this function does
 not take kernel address as parameter so I can not call it in the kernel.

 Then how can I getcwd in the kernel?

 I can get the vnode pointer of the current dir, If there are any some easy
 ways to convert the vnode pointer to the absolute path name, it's ok too.


 Use this one:


 http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/lookup.c#vnodetopath

 FrankH.




 -- 
 Thanks and Regards,
 Niu Lin


--
No good can come from selling your freedom, not for all the gold in the world,
for the value of this heavenly gift far exceeds that of any fortune on earth.
--
___
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org


Re: [osol-discuss] How to get current working directory of the current process in the kernel

2008-05-20 Thread NiuLin
Thanks!
I'm sorry I have missed some information in my original post, I'm writing
the module for Solaris 8,  I checked the header files of Solaris 8 but
cannot find vnodetopath. Which function can I use on Solaris 8?


2008/5/20 [EMAIL PROTECTED]:

 On Tue, 20 May 2008, NiuLin wrote:

  Thanks a lot for your quick reply! Actually, I have found this code
 already,
 but as I know, dogetcwd is not exported by the kernel (not found in the
 include files). How can I call this function?


 #include /sys/pathname.h

 for vnodetopath().

 FrankH.


 2008/5/20 [EMAIL PROTECTED]:

  On Tue, 20 May 2008, NiuLin wrote:

  Hello everyone:

 When I am programming a kernel module for Solaris, I encountered one
 problem: I cannot get the the absolute path for the current working
 directory of the current process.

 In user space, we can do this by calling getcwd(), but this function
 does
 not take kernel address as parameter so I can not call it in the kernel.

 Then how can I getcwd in the kernel?

 I can get the vnode pointer of the current dir, If there are any some
 easy
 ways to convert the vnode pointer to the absolute path name, it's ok
 too.


 Use this one:



 http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/lookup.c#vnodetopath

 FrankH.




 --
 Thanks and Regards,
 Niu Lin



 --
 No good can come from selling your freedom, not for all the gold in the
 world,
 for the value of this heavenly gift far exceeds that of any fortune on
 earth.

 --




-- 
Thanks and Regards,
Niu Lin
___
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Re: [osol-discuss] How to get current working directory of the current process in the kernel

2008-05-20 Thread Frank . Hofmann
On Tue, 20 May 2008, NiuLin wrote:

 Thanks!
 I'm sorry I have missed some information in my original post, I'm writing
 the module for Solaris 8,  I checked the header files of Solaris 8 but
 cannot find vnodetopath. Which function can I use on Solaris 8?

Please ask Sun Developer support for S8, this forum is about OpenSolaris 
...

FrankH.



 2008/5/20 [EMAIL PROTECTED]:

 On Tue, 20 May 2008, NiuLin wrote:

  Thanks a lot for your quick reply! Actually, I have found this code
 already,
 but as I know, dogetcwd is not exported by the kernel (not found in the
 include files). How can I call this function?


 #include /sys/pathname.h

 for vnodetopath().

 FrankH.


 2008/5/20 [EMAIL PROTECTED]:

  On Tue, 20 May 2008, NiuLin wrote:

  Hello everyone:

 When I am programming a kernel module for Solaris, I encountered one
 problem: I cannot get the the absolute path for the current working
 directory of the current process.

 In user space, we can do this by calling getcwd(), but this function
 does
 not take kernel address as parameter so I can not call it in the kernel.

 Then how can I getcwd in the kernel?

 I can get the vnode pointer of the current dir, If there are any some
 easy
 ways to convert the vnode pointer to the absolute path name, it's ok
 too.


 Use this one:



 http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/lookup.c#vnodetopath

 FrankH.




 --
 Thanks and Regards,
 Niu Lin



 --
 No good can come from selling your freedom, not for all the gold in the
 world,
 for the value of this heavenly gift far exceeds that of any fortune on
 earth.

 --




 -- 
 Thanks and Regards,
 Niu Lin


--
No good can come from selling your freedom, not for all the gold in the world,
for the value of this heavenly gift far exceeds that of any fortune on earth.
--
___
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org


Re: [osol-discuss] How to get current working directory of the current process in the kernel

2008-05-20 Thread Joerg Schilling
NiuLin [EMAIL PROTECTED] wrote:

 Thanks!
 I'm sorry I have missed some information in my original post, I'm writing
 the module for Solaris 8,  I checked the header files of Solaris 8 but
 cannot find vnodetopath. Which function can I use on Solaris 8?

In kernel getcwd() has been added in Solaris 11 for BrandZ (linux) support.
getcwd() was traditionally a user space function in UNIX.

Jörg

-- 
 EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
   [EMAIL PROTECTED](uni)  
   [EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
___
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org