From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 25 22:42:53 2015 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 755B2DED for ; Wed, 25 Mar 2015 22:42:53 +0000 (UTC) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 37A5DE2C for ; Wed, 25 Mar 2015 22:42:53 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 7C0E43592EF; Wed, 25 Mar 2015 23:42:51 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 5319C28494; Wed, 25 Mar 2015 23:42:51 +0100 (CET) Date: Wed, 25 Mar 2015 23:42:51 +0100 From: Jilles Tjoelker To: Ivan Radovanovic Subject: Re: kevent behavior Message-ID: <20150325224251.GB79065@stack.nl> References: <550A6DA2.1070004@gmail.com> <20150324221541.GA67584@stack.nl> <5512C835.7040207@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5512C835.7040207@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@FreeBSD.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2015 22:42:53 -0000 On Wed, Mar 25, 2015 at 03:37:41PM +0100, Ivan Radovanovic wrote: > I saw this EVFILT_USER thing, and it looked to me like it could be used > to do much smarter unblocking of kevent but I believe manual page is > relatively unclear there - what I do not understand is: > * how you trigger this user event (I would say with kevent if > corresponding structure's NOTE_TRIGGER flag is set, but that doesn't > sound logical since in my understanding kevent is basically like > select(2) (ie call which checks if something happened without triggering > things = call which reports about status change in system without > causing change itself)? The changelist passed to kevent(2) causes changes to the kqueue. One kevent(2) call can both change what is monitored and check whether something has happened. An example of EVFILT_USER is in tools/regression/kqueue/user.c. > * how does this work process-wise - is one ident restricted to process > which created corresponding kqueue, or it is system wise (other process > could trigger my kevent if same ident value is used)? The ident is per kqueue. -- Jilles Tjoelker