aboutsummaryrefslogtreecommitdiff
path: root/linux-user/ioctls.h
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2011-03-30 01:35:23 +0200
committerRiku Voipio <riku.voipio@iki.fi>2011-04-26 10:15:41 +0300
commit86fcd9463240c256f00963440fbd084196eeb964 (patch)
treeeaa431373a15da939d068634eaf2a899c8a864ed /linux-user/ioctls.h
parent059c2f2cd773e0f3d7284a6eab662fd26f9cbad2 (diff)
linux-user: add ioctl(SIOCGIWNAME, ...) support.
Allow to run properly following program from linux-user: /* cc -o wifi wifi.c */ #include <stdio.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <linux/wireless.h> #include <netinet/in.h> #include <arpa/inet.h> #include <string.h> 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 <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'linux-user/ioctls.h')
-rw-r--r--linux-user/ioctls.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index ab15b867ec..42b3ae3725 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -122,6 +122,7 @@
IOCTL(SIOCDRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
IOCTL(SIOCSRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
+ IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
IOCTL(CDROMPAUSE, 0, TYPE_NULL)
IOCTL(CDROMSTART, 0, TYPE_NULL)