From owner-freebsd-arch@FreeBSD.ORG Mon Apr 7 18:13:38 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B5DFA16; Mon, 7 Apr 2014 18:13:38 +0000 (UTC) Received: from mail-qg0-x229.google.com (mail-qg0-x229.google.com [IPv6:2607:f8b0:400d:c04::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF4F5FDF; Mon, 7 Apr 2014 18:13:37 +0000 (UTC) Received: by mail-qg0-f41.google.com with SMTP id z60so6683619qgd.28 for ; Mon, 07 Apr 2014 11:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Mhx0hnO2BuLb0m/xzWKsIL95DNg3sm6xUA2BZKiplHo=; b=F+4K/kosqbBqutx0OJojLF7ccrTCekY/TD8YMlr9P/Ys/+AbVwDv9+IIIRcJuQ3edf 2XiApPIrqXDJlt4ZISdlXR2Tgb+vbDtfuQ5VfZs8Zsc8F+vwhb4+DXxURnvHSBqnm/bJ C5qA5QCU8FY+SSU+UWP6BZkjRJquhqZ4kUvTIxqeRChPBfO0kXONRHdG4asl5hkdVuk9 5nZ7e5P89rQnzdruCD11LWw/e/13Uif0biu5S4A8G6Ht5zLhJO4X30pZgIFAynr5OC+T fjFxcxYIF79u/OEApFR+tGxg1dL3ZcXfVhxCks2Q/wInkgabC5a2AA31TwONB7G7HDlM 3f6g== MIME-Version: 1.0 X-Received: by 10.224.16.69 with SMTP id n5mr35570888qaa.7.1396894417171; Mon, 07 Apr 2014 11:13:37 -0700 (PDT) Sender: edschouten@gmail.com Received: by 10.140.96.203 with HTTP; Mon, 7 Apr 2014 11:13:37 -0700 (PDT) In-Reply-To: References: <20140405153621.GH21331@kib.kiev.ua> Date: Mon, 7 Apr 2014 20:13:37 +0200 X-Google-Sender-Auth: BNjOoqilOLMjQuz26W9CrcmBksc Message-ID: Subject: Re: [Patch] kqueue(2) <-> procdesc(4): EVFILT_PROCDESC From: Ed Schouten To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Cc: Robert Watson , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2014 18:13:38 -0000 Hi, On 6 April 2014 17:16, Ed Schouten wrote: > My plan was initially to mimick filt_proc() almost entirely and just > use KNOTE_LOCKED(..., NOTE_EXIT) just like EVFILT_PROC does, but > unfortunately this doesn't seem possible, because if we went down this > path, there would be no way for us to activate the knote in > procdesc_kqfilter() immediately, as KNOTE_ACTIVATE() is not available > outside of kern_event.c. > > This is why I just changed the code, so that procdesc_kqops_event() is > almost literally a copy of filt_proc(), which the difference that it > tests against PDF_EXITED instead of using the hint. While there, I > made some style fixes to filt_proc(). Thoughts? After looking at the kqueue code in a bit more detail, I think I have now found a nice middle way. kevent(2) itself will only call into the kqfilter with hint == 0. I have decided to let procdesc_kqops_event() be a literal copy of filt_proc(), with the difference that if hint == 0, it tests against PDF_EXITED. As it seems to work quite well, I've decided to push this in (r264231). Thanks for the review! -- Ed Schouten