Re: How to best overload the fileops ?

看板FB_current作者時間12年前 (2013/08/22 10:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串7/8 (看更多)
> I don't think there is a need to provide anything like this right now, > nor I have any good idea how to implement it. This kinda leave it hanging in the same state. To do this kqueue fileops need to be exposed. It is always possible to create something like "struct fileops* kqueue_fileops()" and that would do it. I just tried to make such exposure as nice as I could, using some accepted paradigms (overloading, etc) and macros that look like some IDE might create. Another approach is to read fileops from file after the first call to sys_kqueue, but I dislike this because this would require an additional lock, also this would make the first call to epoll_create different from the others, which it shouldn't be. Also this would look much more like a hack. What is wrong with the suggested approach anyway? >> > >> >No, sys_kqueue calling code is all protected by the lock on this >> >file object. So nobody can close or reuse it. >> > > I don't follow. > > sys_kqueue creates fp on its own, before that there is nothing to lock > in the first place. By the time it returns, created fp can be long gone > because some other thread closed it. I added the method kqueue_locked that leaves the the lock release to the calling routine (another kernel module). This way both epoll_create and sys_kqueue run under one atomic lock. Yuri _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
文章代碼(AID): #1I5NWZej (FB_current)
討論串 (同標題文章)
文章代碼(AID): #1I5NWZej (FB_current)