From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 17 16:30:20 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 69F8516A41F for ; Thu, 17 Nov 2005 16:30:20 +0000 (GMT) (envelope-from gpt@tirloni.org) Received: from srv-03.bs2.com.br (srv-03.bs2.com.br [200.203.183.32]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D8B943D96 for ; Thu, 17 Nov 2005 16:30:08 +0000 (GMT) (envelope-from gpt@tirloni.org) Received: from localhost (localhost.bs2.com.br [127.0.0.1]) by srv-03.bs2.com.br (Postfix) with ESMTP id A217C4AEC5; Thu, 17 Nov 2005 14:32:02 -0200 (BRST) Received: from [172.16.12.101] (unknown [201.15.215.182]) by srv-03.bs2.com.br (Postfix) with ESMTP id 097A14B1DC; Thu, 17 Nov 2005 14:31:49 -0200 (BRST) Message-ID: <437CB004.2000401@tirloni.org> Date: Thu, 17 Nov 2005 14:29:56 -0200 From: "Giovanni P. Tirloni" User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Cornelis Swanepoel References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Filesystem monitoring question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2005 16:30:20 -0000 Cornelis Swanepoel wrote: > I have a FreeBSD 6.0 box with a partition that is accessible to a number of > clients via SMB and NFS. > > I would like to monitor activity on this partition so that every time a > write to it is completed, my C program is run (which stats the file and > stores some info about it in a database amongst other things) > > My question is: What do I need to learn in order to construct a trigger for > my code? > > If anyone can point me in the right direction I would greatly appreciate it. Using kqueue you can monitor a file/directory for changes and have it trigger something when that event happens. But you want to monitor you whole partition.. perhaps intercept some syscalls ? -- Giovanni P. Tirloni http://blog.tirloni.org