Re: How to best overload the fileops ?

From: Mateusz Guzik <mjguzik_at_gmail.com>
Date: Thu, 22 Aug 2013 02:10:23 +0200
On Wed, Aug 21, 2013 at 04:53:06PM -0700, Yuri wrote:
> On 08/21/2013 16:21, John-Mark Gurney wrote:
> >How did this memory get allocated in the first place?  Why does it need
> >to be free'd in fo_close and not another location?
> 
> It is allocated by the epoll module right after kqueue object is
> created and is attached to the opaque field in the file object.
> And it should be deallocated when this fd is closed, hence fo_close.
> 

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.

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.

-- 
Mateusz Guzik <mjguzik gmail.com>
Received on Wed Aug 21 2013 - 22:10:30 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:40 UTC