From owner-freebsd-current@FreeBSD.ORG Thu Aug 22 00:30:06 2013 Return-Path: Delivered-To: current@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 ESMTP id 85119F34; Thu, 22 Aug 2013 00:30:06 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell0.rawbw.com (shell0.rawbw.com [198.144.192.45]) by mx1.freebsd.org (Postfix) with ESMTP id 6AE36297C; Thu, 22 Aug 2013 00:30:06 +0000 (UTC) Received: from eagle.yuri.org (stunnel@localhost [127.0.0.1]) (authenticated bits=0) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id r7M0U6VU088201; Wed, 21 Aug 2013 17:30:06 -0700 (PDT) (envelope-from yuri@rawbw.com) Message-ID: <52155B8D.1020807@rawbw.com> Date: Wed, 21 Aug 2013 17:30:05 -0700 From: Yuri User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130628 Thunderbird/17.0.7 MIME-Version: 1.0 To: Mateusz Guzik Subject: Re: How to best overload the fileops ? References: <521508F4.6030502@rawbw.com> <20130821232113.GD94127@funkthat.com> <521552E2.2000008@rawbw.com> <20130822001022.GA18115@dft-labs.eu> In-Reply-To: <20130822001022.GA18115@dft-labs.eu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: John-Mark Gurney , Roman Divacky , current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 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: Thu, 22 Aug 2013 00:30:06 -0000 On 08/21/2013 17:10, Mateusz Guzik wrote: > Short answer is provide epollops with your own fo_close and the rest as > it is currently in kqueueops. All function are static, but this is not a > real problem since you have to modify kern_event.c anyway. This is exactly what this code I am asking about is doing. kqueueops functions are all static. This modification allows to export fileops to child modules. Since there is nothing similar in the kernel code, I am asking does this way look ugly or not. > > I don't know how your code looks like in general, so in case its not > clear, simply wrapping sys_kqueue is inherently racy (some other thread > may close the fd or even reuse it for something else by the time you try > to do anything with it), thus modification of current code is > unavoidable. No, sys_kqueue calling code is all protected by the lock on this file object. So nobody can close or reuse it. Yuri