Module Name: src Committed By: riz Date: Thu Mar 14 16:33:10 UTC 2013
Modified Files: src/sys/compat/common [netbsd-6]: compat_mod.c compat_util.h kern_time_50.c vfs_syscalls_43.c src/sys/kern [netbsd-6]: init_main.c init_sysctl.c Added Files: src/sys/compat/common [netbsd-6]: compat_mod.h Log Message: Pull up following revision(s) (requested by pgoyette in ticket #837): sys/compat/common/kern_time_50.c: revision 1.25 sys/kern/init_sysctl.c: revision 1.195 sys/kern/init_main.c: revision 1.447 sys/compat/common/compat_util.h: revision 1.23 sys/compat/common/compat_mod.h: revision 1.1 sys/compat/common/compat_mod.c: revision 1.16 sys/compat/common/compat_mod.c: revision 1.17 sys/compat/common/compat_mod.c: revision 1.18 sys/compat/common/vfs_syscalls_43.c: revision 1.55 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. Wrap sysctl_teardown(&compat_clog) with the appropriate #if defined()s remove empty #if To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.14.8.1 src/sys/compat/common/compat_mod.c cvs rdiff -u -r0 -r1.1.6.2 src/sys/compat/common/compat_mod.h cvs rdiff -u -r1.22 -r1.22.18.1 src/sys/compat/common/compat_util.h cvs rdiff -u -r1.22 -r1.22.2.1 src/sys/compat/common/kern_time_50.c cvs rdiff -u -r1.54 -r1.54.14.1 src/sys/compat/common/vfs_syscalls_43.c cvs rdiff -u -r1.441.2.2 -r1.441.2.3 src/sys/kern/init_main.c cvs rdiff -u -r1.186 -r1.186.2.1 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.14 src/sys/compat/common/compat_mod.c:1.14.8.1 --- src/sys/compat/common/compat_mod.c:1.14 Mon Aug 8 23:44:06 2011 +++ src/sys/compat/common/compat_mod.c Thu Mar 14 16:33:09 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_mod.c,v 1.14 2011/08/08 23:44:06 jakllsch Exp $ */ +/* $NetBSD: compat_mod.c,v 1.14.8.1 2013/03/14 16:33:09 riz 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.14 2011/08/08 23:44:06 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.14.8.1 2013/03/14 16:33:09 riz 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 *); @@ -269,9 +275,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: @@ -328,12 +332,31 @@ 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) +{ + +#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50) + sysctl_teardown(&compat_clog); +#endif +} 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.22.18.1 --- src/sys/compat/common/compat_util.h:1.22 Mon Dec 14 04:09:38 2009 +++ src/sys/compat/common/compat_util.h Thu Mar 14 16:33:09 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.22.18.1 2013/03/14 16:33:09 riz 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.22 src/sys/compat/common/kern_time_50.c:1.22.2.1 --- src/sys/compat/common/kern_time_50.c:1.22 Wed Jan 4 14:31:17 2012 +++ src/sys/compat/common/kern_time_50.c Thu Mar 14 16:33:09 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $ */ +/* $NetBSD: kern_time_50.c,v 1.22.2.1 2013/03/14 16:33:09 riz 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.22 2012/01/04 14:31:17 apb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.22.2.1 2013/03/14 16:33:09 riz 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) @@ -717,3 +721,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.54.14.1 --- 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 Mar 14 16:33:09 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.54.14.1 2013/03/14 16:33:09 riz 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.54.14.1 2013/03/14 16:33:09 riz 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.441.2.2 src/sys/kern/init_main.c:1.441.2.3 --- src/sys/kern/init_main.c:1.441.2.2 Wed Aug 8 15:51:06 2012 +++ src/sys/kern/init_main.c Thu Mar 14 16:33:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.441.2.2 2012/08/08 15:51:06 martin Exp $ */ +/* $NetBSD: init_main.c,v 1.441.2.3 2013/03/14 16:33:10 riz 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.441.2.2 2012/08/08 15:51:06 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.441.2.3 2013/03/14 16:33:10 riz Exp $"); #include "opt_ddb.h" #include "opt_ipsec.h" @@ -239,11 +239,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; @@ -671,13 +666,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.186 src/sys/kern/init_sysctl.c:1.186.2.1 --- src/sys/kern/init_sysctl.c:1.186 Sat Dec 17 20:05:39 2011 +++ src/sys/kern/init_sysctl.c Thu Mar 14 16:33:09 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: init_sysctl.c,v 1.186 2011/12/17 20:05:39 tls Exp $ */ +/* $NetBSD: init_sysctl.c,v 1.186.2.1 2013/03/14 16:33:09 riz 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.186 2011/12/17 20:05:39 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.186.2.1 2013/03/14 16:33:09 riz 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 - #ifdef KERN_SA #include <sys/sa.h> #endif @@ -339,17 +335,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.6.2 --- /dev/null Thu Mar 14 16:33:10 2013 +++ src/sys/compat/common/compat_mod.h Thu Mar 14 16:33:09 2013 @@ -0,0 +1,41 @@ +/* $NetBSD: compat_mod.h,v 1.1.6.2 2013/03/14 16:33:09 riz 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_ */