Hi,
Does any one know how big is a size of IOV? I got an error (Memory fault (core dumped)) when I tried to return compressed video data buffer (about 150,000 bytes) in io_ctrl() program to a client API program. resource manager was stopped and pop error message. the code as following.
int io_devctl (resmgr_context_t *ctp, io_devctl_t *msg, RESMGR_OCB_T *ocb)
{
int sts;
int32_t nbytes;
int dcmd;
void *data;
dcmd_video_data_t *video_arg;
data = _DEVCTL_DATA(msg->i);
dcmd = msg → i.dcmd;
len = msg → i.nbytes;
memset (&msg → o, 0, sizeof (msg → o));
// preset the number of bytes that we’ll return to zero
nbytes = 0;
sts = EIO;
ret = -1;
switch (dcmd) {
case DCMD_INIT_CTR1472 :
…
case DCMD_GET_VIDEO_DATA :
{
video_arg = (dcmd_video_data_t *) data;
vret = ctr1472_obj->ReadVideoBytes(&channels, (uint8_t ) video_arg- >buffer); /// the video_arg->buffer size is 200000
if (vret > 0) {
video_arg->length = vret;
video_arg->channel = channels;
nbytes = sizeof (dcmd_video_data_t);
sts = EOK;
}
else {
if (optv) printf(“DCMD_GET_AUDIO_DATA aret invalid\n”);
nbytes = sizeof (int);
}
break;
default:
return(ENOSYS);
}
/
If you wanted to pass something different to the return
field of the devctl() you could do it through this member.
/
msg->o.ret_val = sts;
/ Indicate the number of bytes and return the message */
msg->o.nbytes = nbytes;
SETIOV (ctp->iov, &msg->o, sizeof (msg->o) + nbytes);
return (_RESMGR_NPARTS (1));
}