Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2013 13:29:59 +0100
From:      Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
To:        Julian Elischer <julian@freebsd.org>
Cc:        freebsd-hackers@freebsd.org, Adrian Chadd <adrian@freebsd.org>, Eugen-Andrei Gavriloaie <shiretu@gmail.com>
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:  <CCE4FFC4-F846-4F81-85EE-776B753C63C6@gmail.com> <20130513185357.1c552be5@shy.leonerd.org.uk> <CAJ-VmomQmPjtUhUo2%2BK=0Ychw-=qgawrZt3hnYeCPNNhA9T50A@mail.gmail.com> <CAJ-VmonKC_7J=aNgRntub9DN%2BEfQxrhMjstXHSJ634%2BaFemcLg@mail.gmail.com> <20130513191513.786f4f02@shy.leonerd.org.uk> <8A02C28F-89CB-4AE3-A91A-89565F041FDE@gmail.com> <CAJ-VmonjOS7Axq18VxL6B53T4DVgAYdY3LaT8nd7afFj2dq3cA@mail.gmail.com> <20130513194411.5a2dfa2e@shy.leonerd.org.uk> <519327DF.6060002@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--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 <julian@freebsd.org> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130515132959.7f113255>