From 86fcd9463240c256f00963440fbd084196eeb964 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 30 Mar 2011 01:35:23 +0200 Subject: linux-user: add ioctl(SIOCGIWNAME, ...) support. Allow to run properly following program from linux-user: /* cc -o wifi wifi.c */ #include #include #include #include #include #include #include #include int main(int argc, char **argv) { int ret; struct ifreq req; struct sockaddr_in *addr; int s; if (argc != 2) { fprintf(stderr, "Need an interface name (like wlan0)\n"); return 1; } s = socket( AF_INET, SOCK_DGRAM, 0 ); if (s < 0) { perror("Cannot open socket"); return 1; } strncpy(req.ifr_name, argv[1], sizeof(req.ifr_name)); ret = ioctl( s, SIOCGIWNAME, &req ); if (ret < 0) { fprintf(stderr, "No wireless extension\n"); return 1; } printf("%s\n", req.ifr_name); printf("%s\n", req.ifr_newname); return 0; } $ ./wifi eth0 No wireless extension $ ./wifi wlan0 wlan0 IEEE 802.11bg Signed-off-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/syscall_defs.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux-user/syscall_defs.h') diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index bde89213de..527f31d0c3 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -765,6 +765,9 @@ struct target_pollfd { #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ +/* From */ + +#define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ /* From */ -- cgit v1.2.3