From owner-freebsd-hackers@FreeBSD.ORG Wed May 15 12:30:09 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3502ADB4; Wed, 15 May 2013 12:30:09 +0000 (UTC) (envelope-from leonerd@leonerd.org.uk) Received: from cel.leonerd.org.uk (cel.leonerd.org.uk [81.187.167.226]) by mx1.freebsd.org (Postfix) with ESMTP id B7FF191B; Wed, 15 May 2013 12:30:08 +0000 (UTC) Received: from shy.leonerd.org.uk (8.9.7.8.3.c.e.f.f.f.2.8.9.a.e.8.3.4.0.0.7.f.3.0.0.b.8.0.1.0.0.2.ip6.arpa [IPv6:2001:8b0:3f7:43:8ea9:82ff:fec3:8798]) by cel.leonerd.org.uk (Postfix) with ESMTPSA id E49DE1BDE0; Wed, 15 May 2013 13:29:59 +0100 (BST) Date: Wed, 15 May 2013 13:29:59 +0100 From: Paul "LeoNerd" Evans To: Julian Elischer Subject: Re: Managing userland data pointers in kqueue/kevent Message-ID: <20130515132959.7f113255@shy.leonerd.org.uk> In-Reply-To: <519327DF.6060002@freebsd.org> References: <20130513185357.1c552be5@shy.leonerd.org.uk> <20130513191513.786f4f02@shy.leonerd.org.uk> <8A02C28F-89CB-4AE3-A91A-89565F041FDE@gmail.com> <20130513194411.5a2dfa2e@shy.leonerd.org.uk> <519327DF.6060002@freebsd.org> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/CKQQMiQkN6/R.MPnz=gbgjQ"; protocol="application/pgp-signature" Cc: freebsd-hackers@freebsd.org, Adrian Chadd , Eugen-Andrei Gavriloaie X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2013 12:30:09 -0000 --Sig_/CKQQMiQkN6/R.MPnz=gbgjQ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 15 May 2013 02:14:55 -0400 Julian Elischer wrote: > I would suggest that one answer would be to create an extension to=20 > register a > kevent to catch these events.. >=20 > (the knote_drop()) >=20 > The returned event could have all the appropriate information for the > event being dropped.. Is that not the exact thing I suggested? The "extension to create register a kevent to catch these events" is that you put the EV_DROPWATCH bit flag in the event at the time you register it. The "returned event [that] could have all the appropriate informaiton for the event being dropped" is that you receive an event with EV_DROPPED set on it. It being a real event includes of course the udata pointer, so you can handle it. It's really simple to use: When you register, ev->flags |=3D EV_DROPWATCH When you receive an event, process it in the normal way, then if(ev->flags & EV_DROPPED) free(ev->udata); and that is all there is to it. --=20 Paul "LeoNerd" Evans leonerd@leonerd.org.uk ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/ --Sig_/CKQQMiQkN6/R.MPnz=gbgjQ Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlGTf8cACgkQvLS2TC8cBo26iACeO3k1s+4/mOJQYzRE+KMzWT/J g4wAn1+2c2EUPU58ULQ8IgnRwsgN1TIh =dAAY -----END PGP SIGNATURE----- --Sig_/CKQQMiQkN6/R.MPnz=gbgjQ--