Marcin Górski(deleted)
|
ioctl_socket copyout not working
|
Marcin Górski(deleted)
07/10/2014 7:28 AM
post111014
|
ioctl_socket copyout not working
Hi All,
I'd like to use ioctl operation to read data from the network driver. ioctl_socket() function returns success, but no
data is copied back from the driver - looks like copyout() function doesn't work as expected. I use network driver 'as
is' - I haven't modified its source code.
Here's sample code from the application:
memcpy(ifd.ifd_name, "dm0", 4);
ifd.ifd_len = sizeof(time);
ifd.ifd_data = &time;
ifd.ifd_cmd = PTP_GET_TIME;
ret = ioctl_socket(sk, SIOCGDRVSPEC, &ifd);
printf("sec=%d, nsec=%d\n", time.sec, time.nsec);
And driver code:
case PTP_GET_TIME:
if (ifd->ifd_len != sizeof(time)) {
return EINVAL;
}
ti814x_get_time(ti814x,&time);
if (ISSTACK) {
return (copyout(&time, (((uint8_t *)ifd) + sizeof(*ifd)),
sizeof(time)));
} else {
memcpy((((uint8_t *)ifd) + sizeof(*ifd)), &time, sizeof(time));
return EOK;
}
break;
copyout() function copies data 'just after' ifd struct. I believe it's some kind of QNX magic to make embedded pointers
work across virtual address spaces. However, from the application side, no data is actually copied to the time structure
. Any ideas why copyout might not work?
regards,
Marcin
|
|
|