Module Name: src Committed By: pgoyette Date: Thu Feb 21 01:39:55 UTC 2013
Modified Files: src/sys/compat/common: compat_mod.c compat_util.h kern_time_50.c vfs_syscalls_43.c src/sys/kern: init_main.c init_sysctl.c Added Files: src/sys/compat/common: compat_mod.h Log Message: Move boottime50 and its associated sysctl into the compat module. As noted on tech-kern. Should fix PR/47579. OK christos@ Will request pull-up to 6.0 in a few days. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/compat/common/compat_mod.c cvs rdiff -u -r0 -r1.1 src/sys/compat/common/compat_mod.h cvs rdiff -u -r1.22 -r1.23 src/sys/compat/common/compat_util.h cvs rdiff -u -r1.24 -r1.25 src/sys/compat/common/kern_time_50.c cvs rdiff -u -r1.54 -r1.55 src/sys/compat/common/vfs_syscalls_43.c cvs rdiff -u -r1.446 -r1.447 src/sys/kern/init_main.c cvs rdiff -u -r1.194 -r1.195 src/sys/kern/init_sysctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/common/compat_mod.c diff -u src/sys/compat/common/compat_mod.c:1.15 src/sys/compat/common/compat_mod.c:1.16 --- src/sys/compat/common/compat_mod.c:1.15 Tue Jan 22 01:47:20 2013 +++ src/sys/compat/common/compat_mod.c Thu Feb 21 01:39:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_mod.c,v 1.15 2013/01/22 01:47:20 christos Exp $ */ +/* $NetBSD: compat_mod.c,v 1.16 2013/02/21 01:39:54 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.15 2013/01/22 01:47:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.16 2013/02/21 01:39:54 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -52,12 +52,18 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c #include <sys/syscall.h> #include <sys/syscallargs.h> #include <sys/syscallvar.h> +#include <sys/sysctl.h> #include <uvm/uvm_extern.h> #include <uvm/uvm_object.h> #include <compat/common/compat_util.h> +#include <compat/common/compat_mod.h> +#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50) +static struct sysctllog *compat_clog = NULL; +#endif + MODULE(MODULE_CLASS_MISC, compat, NULL); int ttcompat(struct tty *, u_long, void *, int, struct lwp *); @@ -240,6 +246,9 @@ static const struct syscall_package comp { 0, 0, NULL }, }; +#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50) +#endif + static int compat_modcmd(modcmd_t cmd, void *arg) { @@ -270,9 +279,7 @@ compat_modcmd(modcmd_t cmd, void *arg) sendsig_sigcontext_vec = sendsig_sigcontext; #endif #endif -#if defined(COMPAT_09) || defined(COMPAT_43) compat_sysctl_init(); -#endif return 0; case MODULE_CMD_FINI: @@ -329,12 +336,29 @@ compat_modcmd(modcmd_t cmd, void *arg) rw_exit(&exec_lock); #endif #endif /* COMPAT_16 */ -#if defined(COMPAT_09) || defined(COMPAT_43) compat_sysctl_fini(); -#endif return 0; default: return ENOTTY; } } + +void +compat_sysctl_init(void) +{ + +#if defined(COMPAT_09) || defined(COMPAT_43) + compat_sysctl_vfs(&compat_clog); +#endif +#if defined(COMPAT_50) + compat_sysctl_time(&compat_clog); +#endif +} + +void +compat_sysctl_fini(void) +{ + + sysctl_teardown(&compat_clog); +} Index: src/sys/compat/common/compat_util.h diff -u src/sys/compat/common/compat_util.h:1.22 src/sys/compat/common/compat_util.h:1.23 --- src/sys/compat/common/compat_util.h:1.22 Mon Dec 14 04:09:38 2009 +++ src/sys/compat/common/compat_util.h Thu Feb 21 01:39:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_util.h,v 1.22 2009/12/14 04:09:38 mrg Exp $ */ +/* $NetBSD: compat_util.h,v 1.23 2013/02/21 01:39:54 pgoyette Exp $ */ /*- * Copyright (c) 1994 The NetBSD Foundation, Inc. @@ -82,7 +82,4 @@ void compat_offseterr(struct vnode *, co int compat_elf_check_interp(struct exec_package *, char *, const char *); -void compat_sysctl_init(void); -void compat_sysctl_fini(void); - #endif /* !_COMPAT_UTIL_H_ */ Index: src/sys/compat/common/kern_time_50.c diff -u src/sys/compat/common/kern_time_50.c:1.24 src/sys/compat/common/kern_time_50.c:1.25 --- src/sys/compat/common/kern_time_50.c:1.24 Sat Nov 3 23:22:21 2012 +++ src/sys/compat/common/kern_time_50.c Thu Feb 21 01:39:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time_50.c,v 1.24 2012/11/03 23:22:21 njoly Exp $ */ +/* $NetBSD: kern_time_50.c,v 1.25 2013/02/21 01:39:54 pgoyette Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.24 2012/11/03 23:22:21 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.25 2013/02/21 01:39:54 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_aio.h" @@ -58,14 +58,18 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time_50 #include <sys/aio.h> #include <sys/poll.h> #include <sys/syscallargs.h> +#include <sys/sysctl.h> #include <sys/resource.h> #include <compat/common/compat_util.h> +#include <compat/common/compat_mod.h> #include <compat/sys/time.h> #include <compat/sys/timex.h> #include <compat/sys/resource.h> #include <compat/sys/clockctl.h> +struct timeval50 boottime50; + int compat_50_sys_clock_gettime(struct lwp *l, const struct compat_50_sys_clock_gettime_args *uap, register_t *retval) @@ -706,3 +710,19 @@ compat_50_sys_wait4(struct lwp *l, const return error; } + +void +compat_sysctl_time(struct sysctllog **clog) +{ + struct timeval tv; + + TIMESPEC_TO_TIMEVAL(&tv, &boottime); + timeval_to_timeval50(&tv, &boottime50); + + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT, + CTLTYPE_STRUCT, "oboottime", + SYSCTL_DESCR("System boot time"), + NULL, 0, &boottime50, sizeof(boottime50), + CTL_KERN, KERN_OBOOTTIME, CTL_EOL); +} Index: src/sys/compat/common/vfs_syscalls_43.c diff -u src/sys/compat/common/vfs_syscalls_43.c:1.54 src/sys/compat/common/vfs_syscalls_43.c:1.55 --- src/sys/compat/common/vfs_syscalls_43.c:1.54 Fri Nov 19 06:44:36 2010 +++ src/sys/compat/common/vfs_syscalls_43.c Thu Feb 21 01:39:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_43.c,v 1.54 2010/11/19 06:44:36 dholland Exp $ */ +/* $NetBSD: vfs_syscalls_43.c,v 1.55 2013/02/21 01:39:54 pgoyette Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.54 2010/11/19 06:44:36 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.55 2013/02/21 01:39:54 pgoyette Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -58,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls #include <sys/malloc.h> #include <sys/ioctl.h> #include <sys/fcntl.h> +#include <sys/sysctl.h> #include <sys/syslog.h> #include <sys/unistd.h> #include <sys/resourcevar.h> @@ -71,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls #include <compat/sys/mount.h> #include <compat/common/compat_util.h> +#include <compat/common/compat_mod.h> static void cvtstat(struct stat *, struct stat43 *); @@ -458,7 +460,6 @@ unionread: * sysctl helper routine for vfs.generic.conf lookups. */ #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44) -static struct sysctllog *compat_clog; static int sysctl_vfs_generic_conf(SYSCTLFN_ARGS) @@ -498,17 +499,17 @@ sysctl_vfs_generic_conf(SYSCTLFN_ARGS) * Top level filesystem related information gathering. */ void -compat_sysctl_init(void) +compat_sysctl_vfs(struct sysctllog **clog) { extern int nmountcompatnames; - sysctl_createv(&compat_clog, 0, NULL, NULL, + sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, CTLTYPE_INT, "maxtypenum", SYSCTL_DESCR("Highest valid filesystem type number"), NULL, nmountcompatnames, NULL, 0, CTL_VFS, VFS_GENERIC, VFS_MAXTYPENUM, CTL_EOL); - sysctl_createv(&compat_clog, 0, NULL, NULL, + sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_STRUCT, "conf", SYSCTL_DESCR("Filesystem configuration information"), @@ -516,11 +517,4 @@ compat_sysctl_init(void) sizeof(struct vfsconf), CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL); } - -void -compat_sysctl_fini(void) -{ - - sysctl_teardown(&compat_clog); -} #endif Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.446 src/sys/kern/init_main.c:1.447 --- src/sys/kern/init_main.c:1.446 Sat Feb 9 00:31:21 2013 +++ src/sys/kern/init_main.c Thu Feb 21 01:39:55 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.446 2013/02/09 00:31:21 christos Exp $ */ +/* $NetBSD: init_main.c,v 1.447 2013/02/21 01:39:55 pgoyette Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.446 2013/02/09 00:31:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.447 2013/02/21 01:39:55 pgoyette Exp $"); #include "opt_ddb.h" #include "opt_ipsec.h" @@ -235,11 +235,6 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c, #include <prop/proplib.h> -#ifdef COMPAT_50 -#include <compat/sys/time.h> -struct timeval50 boottime50; -#endif - #include <sys/userconf.h> extern struct lwp lwp0; @@ -664,13 +659,7 @@ main(void) */ getnanotime(&time); boottime = time; -#ifdef COMPAT_50 - { - struct timeval tv; - TIMESPEC_TO_TIMEVAL(&tv, &time); - timeval_to_timeval50(&tv, &boottime50); - } -#endif + mutex_enter(proc_lock); LIST_FOREACH(p, &allproc, p_list) { KASSERT((p->p_flag & PK_MARKER) == 0); Index: src/sys/kern/init_sysctl.c diff -u src/sys/kern/init_sysctl.c:1.194 src/sys/kern/init_sysctl.c:1.195 --- src/sys/kern/init_sysctl.c:1.194 Sat Feb 2 14:02:09 2013 +++ src/sys/kern/init_sysctl.c Thu Feb 21 01:39:55 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: init_sysctl.c,v 1.194 2013/02/02 14:02:09 matt Exp $ */ +/* $NetBSD: init_sysctl.c,v 1.195 2013/02/21 01:39:55 pgoyette Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.194 2013/02/02 14:02:09 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.195 2013/02/21 01:39:55 pgoyette Exp $"); #include "opt_sysv.h" #include "opt_compat_netbsd.h" @@ -69,10 +69,6 @@ __KERNEL_RCSID(0, "$NetBSD: init_sysctl. #include <sys/ktrace.h> #include <sys/ksem.h> -#ifdef COMPAT_50 -#include <compat/sys/time.h> -#endif - #include <sys/cpu.h> int security_setidcore_dump; @@ -328,17 +324,6 @@ SYSCTL_SETUP(sysctl_kern_setup, "sysctl SYSCTL_DESCR("System boot time"), NULL, 0, &boottime, sizeof(boottime), CTL_KERN, KERN_BOOTTIME, CTL_EOL); -#ifdef COMPAT_50 - { - extern struct timeval50 boottime50; - sysctl_createv(clog, 0, NULL, NULL, - CTLFLAG_PERMANENT, - CTLTYPE_STRUCT, "oboottime", - SYSCTL_DESCR("System boot time"), - NULL, 0, &boottime50, sizeof(boottime50), - CTL_KERN, KERN_OBOOTTIME, CTL_EOL); - } -#endif sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_STRING, "domainname", Added files: Index: src/sys/compat/common/compat_mod.h diff -u /dev/null src/sys/compat/common/compat_mod.h:1.1 --- /dev/null Thu Feb 21 01:39:56 2013 +++ src/sys/compat/common/compat_mod.h Thu Feb 21 01:39:54 2013 @@ -0,0 +1,41 @@ +/* $NetBSD: compat_mod.h,v 1.1 2013/02/21 01:39:54 pgoyette Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _COMPAT_MOD_H +#define _COMPAT_MOD_H + +void compat_sysctl_init(void); +void compat_sysctl_fini(void); + +void compat_sysctl_time(struct sysctllog **); +void compat_sysctl_vfs(struct sysctllog **); + +#endif /* !_COMPAT_MOD_H_ */