Ioctl failing with invalid argumet

hi all,

i am doing a test which detects my ethernet interfaces status whether it is active or no carrier

my environment is qnx 7.1.0 and usb ethernet(LAN9514) and io-sock running with smsc driver

i am attaching my code snippet and my ifconfig output images.

i also tried

ioctl(sock,SIOCGIFMEDIA,(struct ifmediareq *)&ifmr

but same error coming (errno - 22,invalid argument)

please let me know if anyone solved this

Hi Charan,

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.

Tim

Hi Tim ,

Thanks for your reply , i tried with binding the interface but same problem persists.

for your question (how it would be able to return information on a specific interface)

i am copying interface name to ifmr.ifm_name

Hi Charan,

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.

Tim

Hi Tim,

yes,you are correct about first argument.

but i tried binding with ip address and port but no use.

i don’t have ioctl_socket (i have ioctl,vioctl)

i think something is needed to be corrected in ioctl call of my program

Thanks

I just looked in the 7.1 docs and apparently they removed that function in 7.1

It’s possible the driver doesn’t support that ioctl call. Have you tried using the default interface name of ‘lo0’ just to see if that works?

Tim