Re: Payload limitation on kern_ctl_reg
Re: Payload limitation on kern_ctl_reg
- Subject: Re: Payload limitation on kern_ctl_reg
- From: Peter Moody <email@hidden>
- Date: Thu, 16 Apr 2015 11:13:35 -0700
can't you loop over your data until you've sent it all?
something like (not tested):
for (int i = 0; i < sizeof(msg);) {
size_t space;
if (ctl_getenqueuespace(ctl_ref, unit, &space) != KERN_SUCCESS)
goto bail;
// Send the smaller of what's left of msg and how much space is available
// in the queue.
space = (sizeof(msg) - i) < space ? sizeof(msg) - i : space;
if (ctl_enqueuedata(ctl_ref, unit, (void*)(&msg) + i, space, CTL_DATA_NOWAKEUP) !=
KERN_SUCCESS)
goto bail;
i += space;
}
bail:
ctl_enqueuedata(ctl_ref, unit, NULL, 1, CTL_DATA_EOR);
When I was playing with this, I seem to recall seeing a queue size of
something like 480 bytes .. ? I might be mis-remembering that.
On Wed, Apr 15 2015 at 15:01, Prokash Sinha wrote:
> Folks,
>
> Is there a a limit to the data payload for this type control/socket interface ?
>
> The kext does provide the ctl, app connects to the ctl using socket interface from the user space.
>
> Kext is the data provider. I’ve a choice of tacking a pointer inside the event structure, but that is a kernel vm address without proper mapping. So I
> can stick data in a way, that the event structure will have it….
>
> So when the event is posted using lev_msg_post(&msg), where msg is struct lev_msg, the msg.dv[0].data_length is where the data length is filled out,
> and msg.dv[0].data is the address of data.
>
> It seems like the maximum amount of data that can be placed here is 160 bytes or little more.
>
> Is there any restriction for this?
>
> My requirement is between 2K to 3K max, less than a page, so may be I should be able to shovel a page at the most in any event.
>
> Otherwise I will have resort to kernel to use memory mapping.
>
> Any suggestion ?
>
> Thanks,
> Prokash
> _______________________________________________
> 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
--
peter moody
_______________________________________________
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