Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Feb 2005 12:27:16 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Igor Shmukler <shmukler@mail.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: vn_fullpath()
Message-ID:  <Pine.NEB.3.96L.1050221122330.30083F-100000@fledge.watson.org>
In-Reply-To: <E1D2tqX-0003GO-00.shmukler-mail-ru@f21.mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 20 Feb 2005, Igor Shmukler wrote:

> I was wondering if anyone has figured a way to make vn_fullpath()
> reliable? 

It depends a lot on the requirements.  There are some nasty edge cases
where the process of determining a name for an object can be quite
expensive.  Here's one of them:

  ln /usr/local/etc/apache/httpd.conf /usr/local/etc/apache.old/httpd.conf
  reboot
  apachectl start
  rm /usr/local/etc/apache/httpd.conf

Now generate the name of the file that Apache has open.  Note that you
can't just look in the name cache, because the object has a name but the
name used to open the object has been invalidated.  And UFS even knows it
has a name, because the link count remains non-zero when the unlink of one
of the names occurs -- but the only way it can find the other name is to
search the file system. 

So the first thing to do is to decied what your requirements are: are you
willing to fail in the edge cases like the above?  If so, life is a lot
easier :-). 

Robert N M Watson




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1050221122330.30083F-100000>