Subject: Re: wsevent cleanup
To: Iain Hibbert <plunky@rya-online.net>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 02/06/2006 16:34:48
El 06/02/2006, a las 16:25, Iain Hibbert escribi=F3:
> On Mon, 6 Feb 2006, Julio M. Merino Vidal wrote:
>
>> This is a good idea too, and it may be better for what I have in mind
>> because I'd locally construct all the events and then simply call
>> the function to add them at once. Something like:
>>
>> struct wscons_event evt[N];
>> ... fill evt with up to N events ... (see below)
>> error =3D wsevent_inject(evar, evt, N);
>> if (error !=3D 0)
>> queue is full
>
> what will happen if there are X spaces but N > X ?
Sorry, the N in the call to wsevent_inject should be the number of
events generated, not the maximum size of the vector.
> Which errors can occur with wsevent_inject(), would it be easier to =20=
> return
> the number of items actually queued and leave the caller to supply an
> errno? (or simply pass '&num' ?)
The only error that can occur is when the queue does not have enough
free space.
Returning the number of injected events (without inserting them all)
is dangerous because the caller can easily end up in a corrupt state.
It'd need to inject them one by one (as it currently does), so gaining
nothing from the changes.
> Incidentally, will ioctl(WSMUXIO_INJECTEVENT) be affected by this? =20=
> I ask
> because Bluetooth HID devices are on my list (should be getting some
> hardware soon) and was intending to use this method to inject =20
> events from
> a userland daemon - combining events could be a big win in such a =20
> case.
I'm not touching any userland interface.
Cheers
--=20
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/