Hi On Fri, Sep 20, 2013 at 9:44 AM, Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote: > On Fri, Sep 20, 2013 at 09:39:48AM -0700, Anatol Pomozov wrote: >> Hi, >> >> I have a following requirement: I start a process that performs a lot >> of filesystem operations. And I need to know what files my process was >> using - I need a breakdown by read operations and write operations. >> >> A real-world example where such requirement needed is build-systems - >> I run "gcc foo.c" and I want to know what files are dependencies of >> this operation. I want to record the information and if any of >> dependencies is modified - I rerun "gcc" again. >> >> There are build systems that track dependencies by mounting by-pass >> fuse filesystem and chrooting() there. e.g. tup >> https://github.com/gittup/tup But fuse is relatively slow and it >> introduces additional buffer copy. I do not want to copy data to >> user-space and back, all I need is to record what files were >> stat()/open(). >> >> Is there a light-weight mechanism that allows to perform it? > > What's wrong with strace? In altlinux it was used for ages to find > build dependencies. > > See: > > git://git.altlinux.org/people/ldv/packages/rpm-utils.git > > in particular, buildreq and strace_files. Tup tool tried LD_PRELOAD and ptrace approaches for tracking file usages and both have different kind of issues. At this point they use fuse by-pass filesystem that seems the best solution except performance. As of ptrace I believe it has high run-time overhead and it gets tricky to use it in multi-thread environment. Mike Shal from https://groups.google.com/forum/#!forum/tup-users is better source of information about it though. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html