From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 5 18:38:07 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 611CD106566B for ; Mon, 5 Mar 2012 18:38:07 +0000 (UTC) (envelope-from sem@freebsd.org) Received: from mail.ciam.ru (mail.ciam.ru [91.209.218.18]) by mx1.freebsd.org (Postfix) with ESMTP id 14F828FC19 for ; Mon, 5 Mar 2012 18:38:06 +0000 (UTC) Received: from root by mail.ciam.ru with drweb-scanned (Exim 4.x) id 1S4cP1-0004re-Rr for freebsd-hackers@freebsd.org; Mon, 05 Mar 2012 22:12:55 +0400 Received: from dhcp170-40-red.yandex.net ([95.108.170.40] helo=dhcp170-205-red.yandex.net) by mail.ciam.ru with esmtpa (Exim 4.x) id 1S4cP1-0004ra-Mg for freebsd-hackers@freebsd.org; Mon, 05 Mar 2012 22:12:55 +0400 Message-ID: <4F550227.2010006@FreeBSD.org> Date: Mon, 05 Mar 2012 22:12:55 +0400 From: Sergey Matveychuk User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Maild-Checked: DrWEB for Exim X-Antivirus: Dr.Web (R) for Unix mail servers drweb plugin ver.6.0.2.0 X-Antivirus-Code: 0x100000 Subject: 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 18:38:07 -0000 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?