Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Feb 2005 16:31:37 +0100
From:      Marco Molteni <molter@tin.it>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Question: tracking filesystem changes?
Message-ID:  <4200F259.3050500@tin.it>
In-Reply-To: <4200DCF6.1010002@rojer.pp.ru>
References:  <41FF6869.5060709@rojer.pp.ru> <41FF8B00.2010208@fer.hr> <41FFA801.8070307@rojer.pp.ru> <200502011746.52908.milan@dino.sk> <4200DCF6.1010002@rojer.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Deomid Ryabkov wrote:

[..]

> E.g., if an unlink call is issued and an inode is within a particular 
> filesystem (luckily, most of our data
> already lives on or can be easily moved to a separate filesystem), a 
> notice is sent to some userland daemon:
> "file /www/xxx/yyy.shtml is unlinked". Or opened for writing, or 
> renamed... etc.
> The file is then scheduled for distribution to mirrors.
> The idea seems simple and straightforward, yet I don't know if it is 
> achievable.
> 
> The essential part is obtaining the full pathname of the file (won't 
> bother with hardlinks at first, they aren't used here).
> Could that be done with the FreeBSD's filesystem (vnode/vfs?) code? 
> (which I'm not familiar with)

yet another suggestion: ;-)

what about a shared library shim? That is, you use LD_PRELOAD and
intercept calls to the system calls you are interested in. This trick
is also called interposing.

say your executable calls open(). The shim intercepts open(), does its
logging/triggering/whatever, calls the real syscall and returns. It is
just a wrapper.

This is user-level, but works also with executables for which you don't
have source code, they just have to be dynamically linked against libc.

marco



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4200F259.3050500>