From 48f401a8e0d6f5a25d0a628ce12db11011c5ec38 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 10 May 2007 21:30:14 +0000 Subject: [PATCH] - linux uname -m on x86 returns i{3,4,5,6}86 make it so. - delete the machine sysctl that never worked, and gc linux_machine. --- sys/compat/linux/arch/i386/linux_machdep.c | 14 ++++++++++++-- sys/compat/linux/arch/i386/linux_machdep.h | 7 +++++-- sys/compat/linux/common/linux_machdep.h | 6 +++++- sys/compat/linux/common/linux_misc.c | 6 +++--- sys/compat/linux/common/linux_oldolduname.c | 7 ++++--- sys/compat/linux/common/linux_olduname.c | 7 ++++--- sys/compat/linux/common/linux_sysctl.c | 17 ++--------------- 7 files changed, 35 insertions(+), 29 deletions(-) diff --git a/sys/compat/linux/arch/i386/linux_machdep.c b/sys/compat/linux/arch/i386/linux_machdep.c index 9a9043f49ca7..99aa819f590c 100644 --- a/sys/compat/linux/arch/i386/linux_machdep.c +++ b/sys/compat/linux/arch/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.124 2007/04/16 19:12:20 ad Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.125 2007/05/10 21:30:14 christos Exp $ */ /*- * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.124 2007/04/16 19:12:20 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.125 2007/05/10 21:30:14 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -1183,3 +1183,13 @@ linux_usertrap(struct lwp *l, vaddr_t trapaddr, { return 0; } + +const char * +linux_get_uname_arch(void) +{ + static char uname_arch[5] = "i386"; + + if (uname_arch[1] == '3') + uname_arch[1] += cpu_class; + return uname_arch; +} diff --git a/sys/compat/linux/arch/i386/linux_machdep.h b/sys/compat/linux/arch/i386/linux_machdep.h index 1658a1155ace..002cd44f92c2 100644 --- a/sys/compat/linux/arch/i386/linux_machdep.h +++ b/sys/compat/linux/arch/i386/linux_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.h,v 1.29 2005/12/11 12:20:14 christos Exp $ */ +/* $NetBSD: linux_machdep.h,v 1.30 2007/05/10 21:30:15 christos Exp $ */ /*- * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc. @@ -209,9 +209,12 @@ struct linux_sigframe { #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8) +#define LINUX_UNAME_ARCH linux_get_uname_arch() + #ifdef _KERNEL __BEGIN_DECLS -void linux_syscall_intern __P((struct proc *)); +void linux_syscall_intern(struct proc *); +const char *linux_get_uname_arch(void); __END_DECLS #endif /* !_KERNEL */ diff --git a/sys/compat/linux/common/linux_machdep.h b/sys/compat/linux/common/linux_machdep.h index 7a24e143bfb6..e2dc35c4cc15 100644 --- a/sys/compat/linux/common/linux_machdep.h +++ b/sys/compat/linux/common/linux_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.h,v 1.15 2006/08/23 19:49:09 manu Exp $ */ +/* $NetBSD: linux_machdep.h,v 1.16 2007/05/10 21:30:15 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -57,6 +57,10 @@ #error Undefined linux_machdep.h machine type. #endif +#ifndef LINUX_UNAME_ARCH +#define LINUX_UNAME_ARCH machine +#endif + #ifdef _KERNEL __BEGIN_DECLS void linux_sendsig __P((const ksiginfo_t *, const sigset_t *)); diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c index c09b35cec2f2..7ab86e4efae1 100644 --- a/sys/compat/linux/common/linux_misc.c +++ b/sys/compat/linux/common/linux_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.174 2007/05/08 20:54:15 dsl Exp $ */ +/* $NetBSD: linux_misc.c,v 1.175 2007/05/10 21:30:15 christos Exp $ */ /*- * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.174 2007/05/08 20:54:15 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.175 2007/05/10 21:30:15 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_ptrace.h" @@ -373,7 +373,7 @@ linux_sys_uname(struct lwp *l, void *v, register_t *retval) strncpy(luts.l_nodename, hostname, sizeof(luts.l_nodename)); strncpy(luts.l_release, linux_release, sizeof(luts.l_release)); strncpy(luts.l_version, linux_version, sizeof(luts.l_version)); - strncpy(luts.l_machine, linux_machine, sizeof(luts.l_machine)); + strncpy(luts.l_machine, LINUX_UNAME_ARCH, sizeof(luts.l_machine)); strncpy(luts.l_domainname, domainname, sizeof(luts.l_domainname)); return copyout(&luts, SCARG(uap, up), sizeof(luts)); diff --git a/sys/compat/linux/common/linux_oldolduname.c b/sys/compat/linux/common/linux_oldolduname.c index 414cf8928421..f46ca1c8e2d6 100644 --- a/sys/compat/linux/common/linux_oldolduname.c +++ b/sys/compat/linux/common/linux_oldolduname.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldolduname.c,v 1.62 2007/03/23 04:16:13 mrg Exp $ */ +/* $NetBSD: linux_oldolduname.c,v 1.63 2007/05/10 21:30:15 christos Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.62 2007/03/23 04:16:13 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.63 2007/05/10 21:30:15 christos Exp $"); #include #include @@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.62 2007/03/23 04:16:13 mrg E #include #include #include +#include #include @@ -69,7 +70,7 @@ linux_sys_oldolduname(struct lwp *l, void *v, strncpy(luts.l_nodename, hostname, sizeof(luts.l_nodename)); strncpy(luts.l_release, linux_release, sizeof(luts.l_release)); strncpy(luts.l_version, linux_version, sizeof(luts.l_version)); - strncpy(luts.l_machine, linux_machine, sizeof(luts.l_machine)); + strncpy(luts.l_machine, LINUX_UNAME_ARCH, sizeof(luts.l_machine)); return copyout(&luts, SCARG(uap, up), sizeof(luts)); } diff --git a/sys/compat/linux/common/linux_olduname.c b/sys/compat/linux/common/linux_olduname.c index b5626675bae0..8e7b3d0aec4e 100644 --- a/sys/compat/linux/common/linux_olduname.c +++ b/sys/compat/linux/common/linux_olduname.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_olduname.c,v 1.62 2007/03/23 04:16:13 mrg Exp $ */ +/* $NetBSD: linux_olduname.c,v 1.63 2007/05/10 21:30:15 christos Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.62 2007/03/23 04:16:13 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.63 2007/05/10 21:30:15 christos Exp $"); #include #include @@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.62 2007/03/23 04:16:13 mrg Exp #include #include #include +#include #include @@ -71,7 +72,7 @@ linux_sys_olduname(struct lwp *l, void *v, register_t *retval) strncpy(luts.l_nodename, hostname, sizeof(luts.l_nodename)); strncpy(luts.l_release, linux_release, sizeof(luts.l_release)); strncpy(luts.l_version, linux_version, sizeof(luts.l_version)); - strncpy(luts.l_machine, linux_machine, sizeof(luts.l_machine)); + strncpy(luts.l_machine, LINUX_UNAME_ARCH, sizeof(luts.l_machine)); return copyout(&luts, SCARG(uap, up), sizeof(luts)); } diff --git a/sys/compat/linux/common/linux_sysctl.c b/sys/compat/linux/common/linux_sysctl.c index f59dfab90f35..505ef67f7f78 100644 --- a/sys/compat/linux/common/linux_sysctl.c +++ b/sys/compat/linux/common/linux_sysctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysctl.c,v 1.29 2007/05/10 17:12:32 christos Exp $ */ +/* $NetBSD: linux_sysctl.c,v 1.30 2007/05/10 21:30:15 christos Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.29 2007/05/10 17:12:32 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.30 2007/05/10 21:30:15 christos Exp $"); #if defined (_KERNEL_OPT) #include "opt_ktrace.h" @@ -74,7 +74,6 @@ char linux_version[128] = "#0 Wed Feb 20 20:00:02 CET 2002"; char linux_release[128] = "2.0.38"; char linux_version[128] = "#0 Sun Nov 11 11:11:11 MET 2000"; #endif -char linux_machine[128] = ""; #ifndef _LKM static @@ -116,18 +115,6 @@ SYSCTL_SETUP(linux_sysctl_setup, "linux emulated sysctl subtree setup") NULL, 0, linux_version, sizeof(linux_version), LINUX_KERN_VERSION, CTL_EOL); -#ifndef LINUX_UNAME_ARCH -#define LINUX_UNAME_ARCH machine -#endif - strlcpy(linux_machine, LINUX_UNAME_ARCH, sizeof(linux_machine)); -#if 0 - sysctl_createv(clog, 0, &node, NULL, - CTLFLAG_PERMANENT, - CTLTYPE_STRING, "machine", NULL, - NULL, 0, linux_machine, sizeof(linux_machine), - LINUX_KERN_VERSION, CTL_EOL); -#endif - linux_sysctl_root.sysctl_flags &= ~CTLFLAG_READWRITE; }