Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-compat]: src/sys Initial pass at a COMPAT_50 module. More to c...
details: https://anonhg.NetBSD.org/src/rev/f52682973051
branches: pgoyette-compat
changeset: 321070:f52682973051
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Mon Mar 19 21:54:43 2018 +0000
description:
Initial pass at a COMPAT_50 module. More to come.
diffstat:
sys/compat/common/compat_50_mod.c | 151 ++++++++++++++++++++++++++++++++++++
sys/compat/common/compat_60_mod.c | 13 +-
sys/compat/common/compat_mod.c | 128 ++++++++++++------------------
sys/compat/common/compat_mod.h | 20 ++++-
sys/compat/common/files.common | 3 +-
sys/compat/common/kern_50.c | 30 ++++++-
sys/compat/common/kern_select_50.c | 29 ++++++-
sys/compat/common/kern_time_50.c | 75 +++++++++++++++++-
sys/compat/common/vfs_syscalls_50.c | 38 ++++++++-
sys/modules/Makefile | 4 +-
sys/modules/compat_50/Makefile | 16 +++
11 files changed, 412 insertions(+), 95 deletions(-)
diffs (truncated from 829 to 300 lines):
diff -r cbb6b9a482eb -r f52682973051 sys/compat/common/compat_50_mod.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_50_mod.c Mon Mar 19 21:54:43 2018 +0000
@@ -0,0 +1,151 @@
+/* $NetBSD: compat_50_mod.c,v 1.1.2.1 2018/03/19 21:54:43 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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.
+ */
+
+/*
+ * Linkage for the compat module: spaghetti.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.1 2018/03/19 21:54:43 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_compat_43.h"
+#endif
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/sysctl.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+int
+compat_50_init(void)
+{
+ int error = 0;
+
+ error = kern_50_init();
+ if (error != 0)
+ return error;
+
+ error = kern_time_50_init();
+ if (error != 0)
+ goto err1;
+
+ error = kern_select_50_init();
+ if (error != 0)
+ goto err2;
+
+ error = vfs_syscalls_50_init();
+ if (error != 0)
+ goto err3;
+
+ uvm_50_init();
+ if_50_init();
+
+ return error;
+
+/* If an error occured, undo all previous set-up before returning */
+
+ err3:
+ kern_select_50_fini();
+ err2:
+ kern_time_50_fini();
+ err1:
+ kern_50_fini();
+
+ return error;
+}
+
+int
+compat_50_fini(void)
+{
+ int error = 0;
+
+ if_50_fini();
+ uvm_50_fini();
+
+ error = vfs_syscalls_50_fini();
+ if (error != 0)
+ goto err1;
+
+ error = kern_select_50_fini();
+ if (error != 0)
+ goto err2;
+
+ error = kern_time_50_fini();
+ if (error != 0)
+ goto err3;
+
+ error = kern_50_fini();
+ if (error != 0)
+ goto err4;
+
+ return error;
+
+/* If an error occurred while removing something, restore everything! */
+ err4:
+ kern_time_50_init();
+ err3:
+ kern_select_50_init();
+ err2:
+ vfs_syscalls_50_init();
+ err1:
+ uvm_50_init();
+ if_50_init();
+
+ return error;
+}
+
+#ifdef _MODULE
+
+#define REQUIRED_50 "compat_70,compat_60" /* XXX No compat_80 yet */
+
+MODULE(MODULE_CLASS_EXEC, compat_50, REQUIRED_50);
+
+static int
+compat_50_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_50_init();
+ case MODULE_CMD_FINI:
+ return compat_50_init();
+ default:
+ return ENOTTY;
+ }
+}
+#endif
diff -r cbb6b9a482eb -r f52682973051 sys/compat/common/compat_60_mod.c
--- a/sys/compat/common/compat_60_mod.c Mon Mar 19 21:53:04 2018 +0000
+++ b/sys/compat/common/compat_60_mod.c Mon Mar 19 21:54:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_60_mod.c,v 1.1.2.10 2018/03/18 23:34:25 pgoyette Exp $ */
+/* $NetBSD: compat_60_mod.c,v 1.1.2.11 2018/03/19 21:54:43 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.10 2018/03/18 23:34:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.11 2018/03/19 21:54:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -54,9 +54,6 @@
#include <compat/sys/ccdvar.h>
#include <compat/sys/cpuio.h>
-#define REQUIRED_60 "compat_70" /* XXX No compat_80 yet */
-MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
-
int
compat_60_init(void)
{
@@ -117,6 +114,11 @@
return error;
}
+#ifdef _MODULE
+
+#define REQUIRED_60 "compat_70" /* XXX No compat_80 yet */
+MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
+
static int
compat_60_modcmd(modcmd_t cmd, void *arg)
{
@@ -130,3 +132,4 @@
return ENOTTY;
}
}
+#endif
diff -r cbb6b9a482eb -r f52682973051 sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c Mon Mar 19 21:53:04 2018 +0000
+++ b/sys/compat/common/compat_mod.c Mon Mar 19 21:54:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.c,v 1.24.14.16 2018/03/18 12:06:59 pgoyette Exp $ */
+/* $NetBSD: compat_mod.c,v 1.24.14.17 2018/03/19 21:54:43 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.24.14.16 2018/03/18 12:06:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.17 2018/03/19 21:54:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -66,7 +66,7 @@
#include <compat/sys/uvm.h>
#include <compat/sys/cpuio.h>
-#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
+#if defined(COMPAT_09) || defined(COMPAT_43)
static struct sysctllog *compat_clog = NULL;
#endif
@@ -74,11 +74,6 @@
#include <compat/common/if_40.h>
#endif
-#ifdef COMPAT_50
-void if_50_init(void);
-void if_50_fini(void);
-#endif
-
#ifdef COMPAT_70
#include <net/route.h>
#include <compat/net/route.h>
@@ -86,7 +81,7 @@
#endif
static const char * const compat_includes[] = {
- "compat_70", "compat_60",
+ "compat_70", "compat_60", "compat_50",
NULL
};
@@ -198,46 +193,22 @@
#if defined(COMPAT_40)
{ SYS_compat_40_mount, 0, (sy_call_t *)compat_40_sys_mount },
#endif
-#if defined(COMPAT_50)
- { SYS_compat_50_wait4, 0, (sy_call_t *)compat_50_sys_wait4 },
- { SYS_compat_50_mknod, 0, (sy_call_t *)compat_50_sys_mknod },
- { SYS_compat_50_setitimer, 0, (sy_call_t *)compat_50_sys_setitimer },
- { SYS_compat_50_getitimer, 0, (sy_call_t *)compat_50_sys_getitimer },
- { SYS_compat_50_select, 0, (sy_call_t *)compat_50_sys_select },
- { SYS_compat_50_gettimeofday, 0, (sy_call_t *)compat_50_sys_gettimeofday },
- { SYS_compat_50_getrusage, 0, (sy_call_t *)compat_50_sys_getrusage },
- { SYS_compat_50_settimeofday, 0, (sy_call_t *)compat_50_sys_settimeofday },
- { SYS_compat_50_utimes, 0, (sy_call_t *)compat_50_sys_utimes },
- { SYS_compat_50_adjtime, 0, (sy_call_t *)compat_50_sys_adjtime },
-#ifdef LFS
- { SYS_compat_50_lfs_segwait, 0, (sy_call_t *)compat_50_sys_lfs_segwait },
+ { 0, 0, NULL },
+};
+
+struct compat_init_fini {
+ int (*init)(void);
+ int (*fini)(void);
+} init_fini_list[] = {
+#ifdef COMPAT_70
+ { compat_70_init, compat_70_fini },
#endif
- { SYS_compat_50_futimes, 0, (sy_call_t *)compat_50_sys_futimes },
- { SYS_compat_50_clock_gettime, 0, (sy_call_t *)compat_50_sys_clock_gettime },
- { SYS_compat_50_clock_settime, 0, (sy_call_t *)compat_50_sys_clock_settime },
- { SYS_compat_50_clock_getres, 0, (sy_call_t *)compat_50_sys_clock_getres },
- { SYS_compat_50_timer_settime, 0, (sy_call_t *)compat_50_sys_timer_settime },
- { SYS_compat_50_timer_gettime, 0, (sy_call_t *)compat_50_sys_timer_gettime },
- { SYS_compat_50_nanosleep, 0, (sy_call_t *)compat_50_sys_nanosleep },
- { SYS_compat_50___sigtimedwait, 0, (sy_call_t *)compat_50_sys___sigtimedwait },
- { SYS_compat_50_mq_timedsend, 0, (sy_call_t *)compat_50_sys_mq_timedsend },
- { SYS_compat_50_mq_timedreceive, 0, (sy_call_t *)compat_50_sys_mq_timedreceive },
- { SYS_compat_50_lutimes, 0, (sy_call_t *)compat_50_sys_lutimes },
- { SYS_compat_50__lwp_park, 0, (sy_call_t *)compat_50_sys__lwp_park },
- { SYS_compat_50_kevent, 0, (sy_call_t *)compat_50_sys_kevent },
- { SYS_compat_50_pselect, 0, (sy_call_t *)compat_50_sys_pselect },
- { SYS_compat_50_pollts, 0, (sy_call_t *)compat_50_sys_pollts },
- { SYS_compat_50___stat30, 0, (sy_call_t *)compat_50_sys___stat30 },
- { SYS_compat_50___fstat30, 0, (sy_call_t *)compat_50_sys___fstat30 },
- { SYS_compat_50___lstat30, 0, (sy_call_t *)compat_50_sys___lstat30 },
-# if defined(NTP)
- { SYS_compat_50___ntp_gettime30, 0, (sy_call_t *)compat_50_sys___ntp_gettime30 },
-# endif
- { SYS_compat_50___fhstat40, 0, (sy_call_t *)compat_50_sys___fhstat40 },
- { SYS_compat_50_aio_suspend, 0, (sy_call_t *)compat_50_sys_aio_suspend },
- { SYS_compat_50_quotactl, 0, (sy_call_t *)compat_50_sys_quotactl },
+#ifdef COMPAT_60
Home |
Main Index |
Thread Index |
Old Index