[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: vn_fullpath question.
From:       Matthew Dillon <dillon () apollo ! backplane ! com>
Date:       2006-11-28 19:46:51
Message-ID: 200611281946.kASJkpqF036474 () apollo ! backplane ! com
[Download RAW message or body]


: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

    I'm afraid we did.  All file pointers now also store a fully referenced
    namecache pointer along with the vnode pointer.  In fact, it is now
    a triplet: Vnode, mount pointer, namecache pointer.

    In DragonFly the mount pointer is now mandatory for all access through
    a file descriptor.  The namecache pointer is mandatory for all 
    directory descriptors (all directory traversals are namecache-centric
    in DragonFly, not vnode-centric, so the ncp is needed in case a program
    does a fchdir() call).   Also, in DragonFly, the namecache is synchronized
    with file operations such as rename and delete, rather then globally
    invalidated.  The ncp is actually moved and renamed on rename.

    This had the happy side effect of making it possible for the fstat 
    utility to list the actual file path used to open the file or directory.

    I don't think any of it can be applied to FreeBSD, unless you want
    to spend two man-months (or more) redoing your namecache.  It was a
    horrendous amount of work.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic