From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C6Cmn-0005nu-BR for qemu-devel@nongnu.org; Sat, 11 Sep 2004 14:39:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C6Cml-0005n7-GE for qemu-devel@nongnu.org; Sat, 11 Sep 2004 14:39:44 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6Cml-0005mf-9o for qemu-devel@nongnu.org; Sat, 11 Sep 2004 14:39:43 -0400 Received: from [62.241.160.9] (helo=shockwave.systems.pipex.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C6Cgb-0006hl-Bd for qemu-devel@nongnu.org; Sat, 11 Sep 2004 14:33:21 -0400 Received: from nowt.org (81-178-249-118.dsl.pipex.com [81.178.249.118]) by shockwave.systems.pipex.net (Postfix) with ESMTP id 4EFA11C002B0 for ; Sat, 11 Sep 2004 19:33:13 +0100 (BST) Received: from wren.home (wren.home [192.168.1.7]) by nowt.org (Postfix) with ESMTP id A9F8DAC92 for ; Sat, 11 Sep 2004 19:33:10 +0100 (BST) From: Paul Brook Date: Sat, 11 Sep 2004 19:33:10 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200409111933.10136.paul@codesourcery.com> Subject: [Qemu-devel] [patch] Fix uname syscall Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The patch below changes the uname syscall to return the emulated machine type, rather than the host machine type. Without this things get awfully confused when trying to compile in a chroot. Paul Index: syscall.c =================================================================== RCS file: /cvsroot/qemu/qemu/linux-user/syscall.c,v retrieving revision 1.50 diff -u -p -r1.50 syscall.c --- syscall.c 19 Jun 2004 16:59:03 -0000 1.50 +++ syscall.c 11 Sep 2004 18:28:19 -0000 @@ -72,6 +72,17 @@ /* 16 bit uid wrappers emulation */ #define USE_UID16 #endif +#if defined(TARGET_ARM) +#define UNAME_MACHINE "armv4" +#elif defined(TARGET_I386) +#define UNAME_MACHINE "i686" +#elif defined(TARGET_PPC) +#define UNAME_MACHINE "ppc" +#elif defined(TARGET_SPARC) +#define UNAME_MACHINE "sun4" +#else +#error unsupported CPU +#endif //#include #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) @@ -2391,8 +2406,17 @@ long do_syscall(void *cpu_env, int num, ret = get_errno(setdomainname((const char *)arg1, arg2)); break; case TARGET_NR_uname: - /* no need to transcode because we use the linux syscall */ - ret = get_errno(sys_uname((struct new_utsname *)arg1)); + { + struct new_utsname * buf; + + buf = (struct new_utsname *)arg1; + ret = get_errno(sys_uname(buf)); + if (!is_error(ret)) { + /* Overwrite the native machine name with whatever is being + emulated. */ + strcpy (buf->machine, UNAME_MACHINE); + } + } break; #ifdef TARGET_I386 case TARGET_NR_modify_ldt: