From owner-freebsd-questions@FreeBSD.ORG Mon Oct 25 01:27:18 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A87E106564A for ; Mon, 25 Oct 2010 01:27:18 +0000 (UTC) (envelope-from temporal@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 909558FC1A for ; Mon, 25 Oct 2010 01:27:17 +0000 (UTC) Received: by ewy28 with SMTP id 28so1262933ewy.13 for ; Sun, 24 Oct 2010 18:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=vz26MBs/5xU0hVuyyOakshLfxOS1YcD2i6V7JfR1V/Q=; b=s2t2scBJg8QcQcv1bNsHRwk98BuhaEEQtHRXH52lOqZDOTKdLC7eE5tE6Ms13fxouq ONnMfGvq8qjorhvpUbqe1UUdVRy5W2nLp/2XeRFfzEQ1u/If9MysqmnY/+yatD2ABtTI 1QsmFRojr4cbgFmw2MG9vrF7iJsU7cBYANOcQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Eyj/rXmbrPNuKg0YHToBt/283Uf7lxT/ycTrES9w2VOy2b8o4yTbd/ttxZKmAFfIDD IdJbcNtAj4P/ltO36E1xelCQ4eAoqIubb3idGuMMPFe3B+WzpwMFvwB3JunxOes0IEyP 6cO0J4DLiHZqN1iaIC9oAF6rxg5mrvKMfn2zE= MIME-Version: 1.0 Received: by 10.213.114.83 with SMTP id d19mr5229840ebq.46.1287968734100; Sun, 24 Oct 2010 18:05:34 -0700 (PDT) Received: by 10.14.119.141 with HTTP; Sun, 24 Oct 2010 18:05:34 -0700 (PDT) Date: Sun, 24 Oct 2010 18:05:34 -0700 Message-ID: From: Kenton Varda To: freebsd-questions@freebsd.org X-Mailman-Approved-At: Mon, 25 Oct 2010 03:19:31 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: EVFILT_VNODE doesn't scale to large directory trees? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 01:27:18 -0000 Hi all, I am trying to write some code which monitors a possibly-large directory tree for changes. Specifically, it's a build system, and I want it to automatically start rebuilding whenever I modify a source file. So far the approach I've taken is to use EVFILT_VNODE to watch every file and directory in the tree. This seems to work OK so far, but it worries me that I have to open() every single file. When I ran the same code on Darwin, it promptly hit the open file descriptor limit, and I'm worried that FreeBSD will do the same on larger code trees. Is there any better way to accomplish this? Hate to say it, but Linux's inotify() seems more scalable here. From what I can tell from the docs, it doesn't require opening the watched files and it will even watch all files in a directory with one call. -Kenton