Re: vn_fullpath question.
- From: Oliver Fromme <olli@xxxxxxxxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 16:46:20 +0100 (CET)
Robert Watson wrote:
Nikolay Pavlov wrote:
Hi. I am trying to extend fstat utility, so that it can use name cache to
recreate full path at least for text. I have found vn_fullpath function
usefull in this case. I am newbe in C, so it could be stupid question, but
could someone explaine what is "struct thread *td" in argument list of this
function. Is this the thread which opened the vnode initially or it is the
thread which searches for the vnode? i.e. fstat thread. In any case how i
can get this *td structure?
vn_fullpath(9) is a kernel API, not a user API, so can only be invoked from
kernel space. There are unimplemented, undocumented prototypes in the system
call table for __getpath_fromfd() and __getpath_fromaddr(), which are
presumably intended (with adequate permissions) to allow converting file
descriptor indexes into paths, etc. I think Peter dropped them in, but I'm
not sure if he's posted patches.
Nikolay, you might want to have a look at the source code
of the "lsof" utility (ports/sysutils/lsof). It is able
to display path names for file descriptors. Maybe you can
borrow an idea from it.
It might also be worth mentioning that our friends from the
DragonFly BSD project (derived from FreeBSD 4) have added
the ability to display path names to their version of the
fstat utility. You can look at their cvsweb here:
http://www.dragonflybsd.org/cvsweb/src/usr.bin/fstat/
However, I suspect that they have also made modifications
to the kernel interfaces in order to support the fstat
utility, so their improvements to that utility might not
be applicable to FreeBSD.
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
"That's what I love about GUIs: They make simple tasks easier,
and complex tasks impossible."
-- John William Chambless
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: vn_fullpath question.
- From: Matthew Dillon
- Re: vn_fullpath question.
- From: Nikolay Pavlov
- Re: vn_fullpath question.
- References:
- Re: vn_fullpath question.
- From: Robert Watson
- Re: vn_fullpath question.
- Prev by Date: Van Jacobson's network stack restructure
- Next by Date: Re: vn_fullpath question.
- Previous by thread: Re: vn_fullpath question.
- Next by thread: Re: vn_fullpath question.
- Index(es):
Relevant Pages
- FreeBSD Status report for Oct-Dec 2003
... Bluetooth stack for FreeBSD ... Not much to report. ... Bluetooth
kernel modules appear to be stable. ... concerns and some src committers are willing
to commit the patches. ... (freebsd-current) - FreeBSD Status Report for Oct-Dec 2003
... Bluetooth stack for FreeBSD ... Not much to report. ... Bluetooth
kernel modules appear to be stable. ... concerns and some src committers are willing
to commit the patches. ... (freebsd-hackers) - FreeBSD Status Report for Oct-Dec 2003
... Bluetooth stack for FreeBSD ... Not much to report. ... Bluetooth
kernel modules appear to be stable. ... concerns and some src committers are willing
to commit the patches. ... (freebsd-stable) - RE: FreeBSD 4.11 P13 Crash
... I do not want to jinx myself, but after back revving to FreeBSD 4.9 + ... think
it is related to IPFilter in conjunction with 4 Intel nics and/or ... page fault
while in kernel mode ... Okay this time my kernel was recompiled so there are no modules
to ... (freebsd-hackers) - Re: 5.3 interrupt storm (atapicam) and I/O error
... attached you will find a copy of my custom kernel ... config which did work
without any issue under FreeBSD ... The following hardware configuration *won't*
cause ... * harddrive attached to IDE channel #1 ... (freebsd-questions)