Re: kern_control KPI and socket reads
Re: kern_control KPI and socket reads
- Subject: Re: kern_control KPI and socket reads
- From: "Bhavesh Davda" <email@hidden>
- Date: Thu, 15 Mar 2007 10:14:21 -0700
On 3/15/07, Michael Smith <email@hidden> wrote:
On Mar 14, 2007, at 4:22 PM, Bhavesh Davda wrote:
> I know that the kern_control API doesn't provide a callback for reads
> on the sockets that it internally uses, after a call to
> ctl_enqueuembuf().
>
> But how would I go about implementing something that gets called on a
> read/recv from my kern_control socket?
You wouldn't, as this entirely defeats the point of having a
decoupled reader/writer model.
There are plenty of synchronous user/kernel interfaces (socket ioctl
in your case, perhaps).
Or, since the control socket protocol is entirely under your control,
you could require the reader to write an 'ack' packet.
= Mike
Yeah, I was trying to avoid having 2 system calls for every read(2): a
read(2) and an ioctl(2)/setsockopt(2), to get this functionality.
Alternatively, I was wondering how many people would throw up at the
idea of using a getsockopt(2) to read(2) data out of the kern_control
socket :-). I'm not even sure I can do that, because the kern_control
KPI doesn't expose a way to "dequeue" from the underlying socket, or
even to get to the underlying socket for that matter.
Thanks
--
Bhavesh P. Davda
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden