From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Subject: Re: File and Directory Change Notification Date: Wed, 26 Nov 2003 04:15:48 +0000 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20031126041548.GA10853@mail.shareable.org> References: <200311252053.47193.theman@josephdwagner.info> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from mail.jlokier.co.uk ([81.29.64.88]:52096 "EHLO mail.shareable.org") by vger.kernel.org with ESMTP id S263203AbTKZEPx (ORCPT ); Tue, 25 Nov 2003 23:15:53 -0500 To: "Joseph D. Wagner" Content-Disposition: inline In-Reply-To: <200311252053.47193.theman@josephdwagner.info> List-Id: linux-fsdevel.vger.kernel.org Joseph D. Wagner wrote: > The docs are a little sketchy on this one. > > Using fcntl(), can you get change notifications on specific files, or just > directories? You can use F_NOTIFY to get notifications of all files in a directory (the whole directory, and only for operations via this path in case of hard links), and F_SETLEASE to get notifications of other processes opening a file. There's no way to be notified of every individual write to a single file, but that isn't typically useful anyway. What's missing from leases is the ability to block until the final close of a file (and block further opens in the meantime), and for F_RDLCK leases to fail/block when the file is open for writing (there's a FIXME in the kernel lease code for that, but nobody has fixed it). I'm not sure why exclusive leases are always allowed but mandatory locking isn't by default. They seem to offer similar DOS possibilities. -- Jamie