[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] help with socket programming
Hi,
I have added some new IOCTLs to a XIF driver and now would need to call
them from user app. I have no knowledge about socket programming but by
looking into ifconfig-like source code I put together the following
code:
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) return 1;
strcpy(ifr.ifr_name, "eth0");
if (ioctl(sockfd, SISIOCGIFADDRFH, &ifr) < 0) {
perror("ioctl failed");
return 1;
}
The ioctl always fails with "Function not implemented." error. It never
calls the ioctl in my XIF driver.
After adding a bunch of debugging statements to inet4.xdd I found out
that inet_ioctl() (in inet4/inet.c) calls the proto->soops.ioctl:
return (*data->proto->soops.ioctl)(data, cmd, buf);
I was unable to trace it further - I have no idea where the proto->soops
points to (tried tcp.c and rawip.c but it doesn't jump there). It
probably wants me to have this proto->soops set to point to my XIF
driver but I don't know how to do that.
Any help is greatly appreciated. I've lost several days on it already.
Thanks.
Petr