From owner-freebsd-current@FreeBSD.ORG Fri Feb 28 17:46:54 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60E04CDB for ; Fri, 28 Feb 2014 17:46:54 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 239C4143E for ; Fri, 28 Feb 2014 17:46:53 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s1SHkq55077334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Feb 2014 09:46:53 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s1SHkqsn077333; Fri, 28 Feb 2014 09:46:52 -0800 (PST) (envelope-from jmg) Date: Fri, 28 Feb 2014 09:46:52 -0800 From: John-Mark Gurney To: Kohji Okuno Subject: Re: About kevent Message-ID: <20140228174651.GP47921@funkthat.com> Mail-Followup-To: Kohji Okuno , freebsd-current@freebsd.org References: <20140228.111358.1991189164034042401.okuno.kohji@jp.panasonic.com> <20140228071619.GO47921@funkthat.com> <20140228.212908.344599447475200780.okuno.kohji@jp.panasonic.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140228.212908.344599447475200780.okuno.kohji@jp.panasonic.com> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Fri, 28 Feb 2014 09:46:53 -0800 (PST) Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Feb 2014 17:46:54 -0000 Kohji Okuno wrote this message on Fri, Feb 28, 2014 at 21:29 +0900: > > Kohji Okuno wrote this message on Fri, Feb 28, 2014 at 11:13 +0900: > >> I have a question about kevent. > >> > >> How should the userland judge knote which is cleared from knlist by > >> knlist_clear() or knlist_delete()? > > > > It looks like I need to read the code better... knlist_clear (killkn=0) > > and knlist_delete (killkn=1) are wrappers around knlist_cleardel... > > > > Looking at the code of knlist_cleardel, if killkn is set > > (knlist_delete) the knote will be dropped (free'd)... if it is not set, > > the flags _EOF and _ONESHOT will be set such that it'll be returned > > soon.. > > > > Now that I look at the code, KNOTE_ACTIVATE is never called to be put > > on the list to be delivered, so now I'm not sure if it works the way > > it's suppose to... I have a feeling that the notes might hang around > > forever until the kq fd is closed... > > > > I'm also puzzled as to why _DETACHED isn't set, which would seem to > > mean that we'll call f_detach when we close the kq, which I assume > > could cause a panic... > > > > This needs to be investigated/tested... > > Thank you for your comment. > > I tried test by usb_dev. When a USB device is lost suddenly, I can > receive EV_EOF|EV_ONESHOT on kevent->flags. Ok, good, that means the documentation in knlist_clear(9) is correct... Thanks for verifing this for me... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."