From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 5 21:23:27 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D956106566C for ; Mon, 5 Mar 2012 21:23:27 +0000 (UTC) (envelope-from markiyan.kushnir@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9199F8FC1A for ; Mon, 5 Mar 2012 21:23:25 +0000 (UTC) Received: by eaaf13 with SMTP id f13so1654839eaa.13 for ; Mon, 05 Mar 2012 13:23:25 -0800 (PST) Received-SPF: pass (google.com: domain of markiyan.kushnir@gmail.com designates 10.14.95.12 as permitted sender) client-ip=10.14.95.12; Authentication-Results: mr.google.com; spf=pass (google.com: domain of markiyan.kushnir@gmail.com designates 10.14.95.12 as permitted sender) smtp.mail=markiyan.kushnir@gmail.com; dkim=pass header.i=markiyan.kushnir@gmail.com Received: from mr.google.com ([10.14.95.12]) by 10.14.95.12 with SMTP id o12mr11570661eef.80.1330982605282 (num_hops = 1); Mon, 05 Mar 2012 13:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=ZcASUq2Vmb0XA8c5bPcPLmhH96eVZncgtLRPMpFEa6Y=; b=SgYfXJQ67gYpHs8FD9j0vPA0Mx9Aa5kbbttbE5NvKh1rszZAlQOrAY+B/8Ha0H+ImT s0ipVV1WLCQRazW2xgwDk8d/HkCZlznfMlUQpd7hFoS70P1SoMnvRW77etM6euS6lHqR LkfMPNbrcpk5qKXkm7dAprofgQ2CvejrVJ8XFuhg2fWaAQOgKTYv/bGl+Y0mOG/4BGsJ YL7XCK/5mmHDkjWD+PgmoXnpwassYQQDREyt2A/8rmSRTkQRwTtqlq/2pQYJOkyEdrHD zrOXmLIUo2lJW5SwqSmIahNh5AQ3mhpF/pVSGTsfq/Wt+7KWrHsymQur/gH3rslgrNz6 AsEw== Received: by 10.14.95.12 with SMTP id o12mr8738475eef.80.1330981065157; Mon, 05 Mar 2012 12:57:45 -0800 (PST) Received: from mkushnir.zapto.org (105-8-124-91.pool.ukrtel.net. [91.124.8.105]) by mx.google.com with ESMTPS id v51sm65584872eef.2.2012.03.05.12.57.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Mar 2012 12:57:44 -0800 (PST) Message-ID: <4F5528BF.9030109@gmail.com> Date: Mon, 05 Mar 2012 22:57:35 +0200 From: Markiyan Kushnir User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120222 Thunderbird/10.0.2 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4F550227.2010006@FreeBSD.org> In-Reply-To: <4F550227.2010006@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: watching for a directory with kqueue 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: Mon, 05 Mar 2012 21:23:27 -0000 On 05.03.2012 20:12, Sergey Matveychuk wrote: > Hi. > > I've met a problem with the subj. Could you help? > > I'm watching for a directory: > EV_SET(kq_change_list, fd, EVFILT_VNODE, > EV_ADD | EV_ENABLE | EV_ONESHOT, > NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB, > 0, 0); > > When the directory changed, I read its contens with opendir, like that: > struct kq_event kq_event[1000]; > ... > while(1) { > n = kevent(kq, kq_change_list, chlist_used, kq_event, 1000, NULL); > for(i = 0; i < n; i++) { > if(kq_event[i].fflags & NOTE_EXTEND || kq_event[i].fflags & NOTE_WRITE) { > opendir(.....) > > It works when I create a few files (1-3), but when I create 10 files > with touch(1) I see only 3-6 files with opendir. I've got only one event > with kevent() (n=1). Looks like I should got a few events, but I did > not. Could you give an advice how to get all created files? Try to put some delay (~10ms) after your call to kevent(). Markiyan. > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"