Just a guess here but I think the problem is your socket isn’t bound to any interface and you have multiple interfaces. So I am not sure how it would be able to return information on a specific interface.
Try binding your socket to an IP Address that will be on the interface you want to query and see if that works.
If all you need is the media interface name when why do you need a socket parameter at all? It should just accept a 0 as the first argument.
Have you tried switching to using ioctl_socket instead of ioctl? In theory you shouldn’t need to do that (I think QNX 7 handles the pointers but older versions didn’t) but it’s worth a try.