From patchwork Mon Apr 18 17:29:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 91815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 03709B6FE1 for ; Tue, 19 Apr 2011 03:29:56 +1000 (EST) Received: from localhost ([::1]:34360 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBsGn-0007k0-9e for incoming@patchwork.ozlabs.org; Mon, 18 Apr 2011 13:29:53 -0400 Received: from eggs.gnu.org ([140.186.70.92]:58539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBsGJ-0007hw-88 for qemu-devel@nongnu.org; Mon, 18 Apr 2011 13:29:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBsGI-0003FY-8G for qemu-devel@nongnu.org; Mon, 18 Apr 2011 13:29:23 -0400 Received: from afflict.kos.to ([92.243.29.197]:53982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBsGH-0003FO-Vq for qemu-devel@nongnu.org; Mon, 18 Apr 2011 13:29:22 -0400 Received: from kos.to (a88-115-166-167.elisa-laajakaista.fi [88.115.166.167]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 62DA62668B; Mon, 18 Apr 2011 17:29:18 +0000 (UTC) Received: by kos.to (sSMTP sendmail emulation); Mon, 18 Apr 2011 20:29:18 +0300 From: Riku Voipio To: qemu-devel@nongnu.org Date: Mon, 18 Apr 2011 20:29:01 +0300 Message-Id: <57d0461c4964f3b054f507d9eed92f7a7c4f3276.1303146624.git.riku.voipio@iki.fi> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 92.243.29.197 Cc: Riku Voipio , Laurent Vivier Subject: [Qemu-devel] [PATCH 4/6] linux-user: add ioctl(SIOCGIWNAME, ...) support. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laurent Vivier 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/ioctls.h | 1 + linux-user/syscall.c | 2 +- linux-user/syscall_defs.h | 3 +++ 3 files changed, 5 insertions(+), 1 deletions(-) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index ab15b86..42b3ae3 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) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 123909f..5f9061d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -59,7 +59,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base, //#include #include #include -#include +#include #include #ifdef TARGET_GPROF #include diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index bde8921..527f31d 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 */