From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Kirill A. Shutemov" Subject: Re: How to implement "filesystem operations tracker"? Date: Fri, 20 Sep 2013 19:44:16 +0300 Message-ID: <20130920164416.GA23421@shutemov.name> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Anatol Pomozov Return-path: Received: from [204.155.152.216] ([204.155.152.216]:45450 "EHLO shutemov.name" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752950Ab3ITRlq (ORCPT ); Fri, 20 Sep 2013 13:41:46 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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. -- Kirill A. Shutemov