Re: [patch] turning devctl into a "multiple openable" device

看板FB_current作者時間14年前 (2011/12/01 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串8/12 (看更多)
--jwac3nLilAlTsrBW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 30, 2011 at 10:05:11AM -0500, John Baldwin wrote: > On Wednesday, November 30, 2011 7:43:20 am Baptiste Daroussin wrote: > > Hi all, > >=20 > > With the help of cognet, I wrote a patch to turn devctl into a multiple= openable > > device, that mean that it will allow to open /dev/devctl in multiple pr= ograms, > > for example hald and everythings that want to receive notification from= the > > device won't need to depend on haveing devd running. > >=20 > > here is the patch:=20 > > http://people.freebsd.org/~bapt/devctl_multi_open.diff >=20 > Shouldn't devctl_queue_data_f() use the requested malloc() flags instead = of > hardcoding M_NOWAIT? This is an obvious fallback of holding mutex around the call to per_devctl_queue_data_f(), which caused the author a trouble to use M_WAITOK. Having n readers causes the patch to queue each message n times, that looks like a waste. I wonder why the waiting_threads stuff is needed at all. The cv could be woken up unconditionally everytime. What is the reason for the cv_wait call in cdevpriv data destructor ? You cannot have a thread doing e.g. read on the file descriptor while destructor is run. >=20 > Also, I know that it was an intentional design decisison by Warner to have > the multiplexing of devctl data done in userland via devd rather than in = the > kernel. (I think he envisioned devd providing a UNIX domain socket or so= me > such for other daemons to use to listen to events.) Have you asked him a= bout > this change? And I fully agree that doing multiplexing in user mode is the right approac= h. Not least because you could apply some advanced access control and provide filtering for the consumers. --jwac3nLilAlTsrBW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7WT9wACgkQC3+MBN1Mb4g5zwCg3MjdQJIZB4pmbmruWX2OEZnc tHcAmQH6vh5NvQ3TGOTDZASNPdkDq73l =TCaE -----END PGP SIGNATURE----- --jwac3nLilAlTsrBW--
文章代碼(AID): #1ErczWe1 (FB_current)
討論串 (同標題文章)
完整討論串 (本文為第 8 之 12 篇):
文章代碼(AID): #1ErczWe1 (FB_current)