Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - ioctl_socket copyout not working: Page 1 of 4 (4 Items)
   
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