From owner-freebsd-questions@FreeBSD.ORG Sun Nov 23 02:36:00 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 986A316A4CE for ; Sun, 23 Nov 2003 02:36:00 -0800 (PST) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id CB97B43FE0 for ; Sun, 23 Nov 2003 02:35:58 -0800 (PST) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [127.0.0.1]) hANAZiAS010629 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 23 Nov 2003 10:35:47 GMT (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)id hANAZiDN010628; Sun, 23 Nov 2003 10:35:44 GMT (envelope-from matthew) Date: Sun, 23 Nov 2003 10:35:44 +0000 From: Matthew Seaman To: "Cordula's Web" Message-ID: <20031123103544.GD9494@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , Cordula's Web , roberthuff@rcn.com, questions@freebsd.org References: <200311222258.hAMMwApd092388@fw.farid-hajji.net> <16320.5175.69241.145102@jerusalem.litteratus.org> <200311231017.hANAHvpd097677@fw.farid-hajji.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="P+33d92oIH25kiaB" Content-Disposition: inline In-Reply-To: <200311231017.hANAHvpd097677@fw.farid-hajji.net> User-Agent: Mutt/1.5.5.1i X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.60 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on happy-idiot-talk.infracaninophile.co.uk cc: roberthuff@rcn.com cc: questions@freebsd.org Subject: Re: Monitoring a file? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2003 10:36:00 -0000 --P+33d92oIH25kiaB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 23, 2003 at 11:17:57AM +0100, Cordula's Web wrote: > > > A file, let's say, /path/to/a/file, is being modified by > > > an unknown process P(u) at random times. Unfortunately, > > > the name of the program ran by P(u) is unknown. > >=20 > > Have you tried moving the file elsewhere and seeing if anyone > > complains about the absence? >=20 > No, P(u) obviously fails silently. There's nothing recorded > by syslog, no messages on the console, and no core dumps... >=20 > > Or writing a program that locks the file? >=20 > That was a good idea. However, P(u) didn't seem to take a lock. > Advisory locks are just that: if P(u) doesn't lock the file, > existing locks don't matter at all. Do we have mandatory locks > in FreeBSD? Not a lock as such, but: # chflags schg /path/to/a/file should achieve the effect you desire. Although this will cause any write on the file to just fail, rather than causing P(u) to block waiting for a lock. You could try replacing /path/to/a/file with a fifo (see mkfifo(1)), and maybe hang another process on the other end of the fifo which can run ps(1) or fstat(1) when a write is detected. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --P+33d92oIH25kiaB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/wI2AdtESqEQa7a0RAgtWAJ40lwDH9UydRUmtw8UGTwfsMoKpVACff9Nd OQJqWMhVSjyd9Ufsf3049sw= =m0x5 -----END PGP SIGNATURE----- --P+33d92oIH25kiaB--