Module Name: src
Committed By: pgoyette
Date: Tue Mar 27 07:29:44 UTC 2018
Modified Files:
src/distrib/sets/lists/modules [pgoyette-compat]: mi
src/sys/compat/common [pgoyette-compat]: compat_mod.c compat_mod.h
files.common vfs_syscalls_40.c
src/sys/dev/sysmon [pgoyette-compat]: sysmon_power.c
src/sys/kern [pgoyette-compat]: compat_stub.c
src/sys/modules [pgoyette-compat]: Makefile
src/sys/sys [pgoyette-compat]: compat_stub.h
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_40_mod.c
sysmon_power_40.c
src/sys/modules/compat_40 [pgoyette-compat]: Makefile
Log Message:
Create a compat_40 module
To generate a diff of this commit:
cvs rdiff -u -r1.114.2.6 -r1.114.2.7 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_40_mod.c \
src/sys/compat/common/sysmon_power_40.c
cvs rdiff -u -r1.24.14.20 -r1.24.14.21 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.42.8 -r1.1.42.9 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/compat/common/files.common
cvs rdiff -u -r1.4 -r1.4.16.1 src/sys/compat/common/vfs_syscalls_40.c
cvs rdiff -u -r1.58 -r1.58.2.1 src/sys/dev/sysmon/sysmon_power.c
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.202.2.10 -r1.202.2.11 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_40/Makefile
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/sys/compat_stub.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.114.2.6 src/distrib/sets/lists/modules/mi:1.114.2.7
--- src/distrib/sets/lists/modules/mi:1.114.2.6 Sat Mar 24 01:59:15 2018
+++ src/distrib/sets/lists/modules/mi Tue Mar 27 07:29:43 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.6 2018/03/24 01:59:15 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.7 2018/03/27 07:29:43 pgoyette Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -68,6 +68,8 @@
./@MODULEDIR@/coda5/coda5.kmod base-kernel-modules kmod
./@MODULEDIR@/compat base-kernel-modules kmod
./@MODULEDIR@/compat/compat.kmod base-kernel-modules kmod
+./@MODULEDIR@/compat_40 base-kernel-modules kmod
+./@MODULEDIR@/compat_40/compat_40.kmod base-kernel-modules kmod
./@MODULEDIR@/compat_50 base-kernel-modules kmod
./@MODULEDIR@/compat_50/compat_50.kmod base-kernel-modules kmod
./@MODULEDIR@/compat_60 base-kernel-modules kmod
Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.20 src/sys/compat/common/compat_mod.c:1.24.14.21
--- src/sys/compat/common/compat_mod.c:1.24.14.20 Sun Mar 25 08:03:26 2018
+++ src/sys/compat/common/compat_mod.c Tue Mar 27 07:29:43 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.c,v 1.24.14.20 2018/03/25 08:03:26 pgoyette Exp $ */
+/* $NetBSD: compat_mod.c,v 1.24.14.21 2018/03/27 07:29: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.20 2018/03/25 08:03:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.21 2018/03/27 07:29:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -70,10 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c
static struct sysctllog *compat_clog = NULL;
#endif
-#ifdef COMPAT_40
-#include <compat/common/if_40.h>
-#endif
-
#ifdef COMPAT_70
#include <net/route.h>
#include <compat/net/route.h>
@@ -189,10 +185,6 @@ static const struct syscall_package comp
{ SYS_compat_30_getfh, 0, (sy_call_t *)compat_30_sys_getfh },
{ SYS_compat_30_socket, 0, (sy_call_t *)compat_30_sys_socket },
#endif
-
-#if defined(COMPAT_40)
- { SYS_compat_40_mount, 0, (sy_call_t *)compat_40_sys_mount },
-#endif
{ 0, 0, NULL },
};
@@ -209,10 +201,10 @@ struct compat_init_fini {
#ifdef COMPAT_50
{ compat_50_init, compat_50_fini },
#endif
-#if 0 /* NOT YET */
#ifdef COMPAT_40
{ compat_40_init, compat_40_fini },
#endif
+#if 0 /* NOT YET */
#ifdef COMPAT_30
{ compat_30_init, compat_30_fini },
#endif
@@ -289,9 +281,6 @@ compat_modcmd(modcmd_t cmd, void *arg)
* XXX */
#endif
#endif /* XXX NOTYET */
-#ifdef COMPAT_40
- if_40_init();
-#endif
#ifdef COMPAT_13
uvm_13_init();
#endif
@@ -375,9 +364,6 @@ compat_modcmd(modcmd_t cmd, void *arg)
rw_exit(&exec_lock);
#endif
#endif /* COMPAT_16 */
-#ifdef COMPAT_40
- if_40_fini();
-#endif
/*
* Disable included components in reverse order;
* if any component fails to fini(), re-init those
Index: src/sys/compat/common/compat_mod.h
diff -u src/sys/compat/common/compat_mod.h:1.1.42.8 src/sys/compat/common/compat_mod.h:1.1.42.9
--- src/sys/compat/common/compat_mod.h:1.1.42.8 Fri Mar 23 09:38:48 2018
+++ src/sys/compat/common/compat_mod.h Tue Mar 27 07:29:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.h,v 1.1.42.8 2018/03/23 09:38:48 pgoyette Exp $ */
+/* $NetBSD: compat_mod.h,v 1.1.42.9 2018/03/27 07:29:44 pgoyette Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -77,4 +77,15 @@ void if_50_init(void);
void if_50_fini(void);
#endif
+#ifdef COMPAT_40
+int compat_40_init(void);
+int compat_40_fini(void);
+void if_40_init(void);
+void if_40_fini(void);
+int vfs_syscalls_40_init(void);
+int vfs_syscalls_40_fini(void);
+void sysmon_power_40_init(void);
+void sysmon_power_40_fini(void);
+#endif
+
#endif /* !_COMPAT_MOD_H_ */
Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.18 src/sys/compat/common/files.common:1.1.2.19
--- src/sys/compat/common/files.common:1.1.2.18 Sat Mar 24 01:59:15 2018
+++ src/sys/compat/common/files.common Tue Mar 27 07:29:44 2018
@@ -1,4 +1,4 @@
-# $NetBSD: files.common,v 1.1.2.18 2018/03/24 01:59:15 pgoyette Exp $
+# $NetBSD: files.common,v 1.1.2.19 2018/03/27 07:29:44 pgoyette Exp $
#
# Generic files, used by all compat options.
@@ -52,8 +52,10 @@ file compat/common/vfs_syscalls_30.c co
file compat/common/uipc_syscalls_30.c compat_30
# Compatibility code for NetBSD 4.0
+file compat/common/compat_40_mod.c compat_40
file compat/common/vfs_syscalls_40.c compat_40
file compat/common/uipc_syscalls_40.c compat_40
+file compat/common/sysmon_power_40.c compat_40
# Compatibility code for NetBSD 5.0
file compat/common/compat_50_mod.c compat_50
Index: src/sys/compat/common/vfs_syscalls_40.c
diff -u src/sys/compat/common/vfs_syscalls_40.c:1.4 src/sys/compat/common/vfs_syscalls_40.c:1.4.16.1
--- src/sys/compat/common/vfs_syscalls_40.c:1.4 Fri Oct 23 19:40:10 2015
+++ src/sys/compat/common/vfs_syscalls_40.c Tue Mar 27 07:29:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_40.c,v 1.4 2015/10/23 19:40:10 maxv Exp $ */
+/* $NetBSD: vfs_syscalls_40.c,v 1.4.16.1 2018/03/27 07:29:44 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,13 +63,22 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_40.c,v 1.4 2015/10/23 19:40:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_40.c,v 1.4.16.1 2018/03/27 07:29:44 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package vfs_syscalls_40_syscalls[] = {
+ { SYS_compat_40_mount, 0, (sy_call_t *)compat_40_sys_mount },
+ { 0, 0, NULL },
+};
+
int
compat_40_sys_mount(struct lwp *l, const struct compat_40_sys_mount_args *uap, register_t *retval)
{
@@ -84,3 +93,17 @@ compat_40_sys_mount(struct lwp *l, const
return do_sys_mount(l, SCARG(uap, type), UIO_USERSPACE, SCARG(uap, path),
SCARG(uap, flags), SCARG(uap, data), UIO_USERSPACE, 0, &dummy);
}
+
+int
+vfs_syscalls_40_init(void)
+{
+
+ return syscall_establish(NULL, vfs_syscalls_40_syscalls);
+}
+
+int
+vfs_syscalls_40_fini(void)
+{
+
+ return syscall_disestablish(NULL, vfs_syscalls_40_syscalls);
+}
Index: src/sys/dev/sysmon/sysmon_power.c
diff -u src/sys/dev/sysmon/sysmon_power.c:1.58 src/sys/dev/sysmon/sysmon_power.c:1.58.2.1
--- src/sys/dev/sysmon/sysmon_power.c:1.58 Wed Oct 25 08:12:39 2017
+++ src/sys/dev/sysmon/sysmon_power.c Tue Mar 27 07:29:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_power.c,v 1.58 2017/10/25 08:12:39 maya Exp $ */
+/* $NetBSD: sysmon_power.c,v 1.58.2.1 2018/03/27 07:29:44 pgoyette Exp $ */
/*-
* Copyright (c) 2007 Juan Romero Pardines.
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.58 2017/10/25 08:12:39 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.58.2.1 2018/03/27 07:29:44 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: sysmon_power
#include <sys/rndsource.h>
#include <sys/module.h>
#include <sys/once.h>
+#include <sys/compat_stub.h>
#include <dev/sysmon/sysmonvar.h>
#include <prop/proplib.h>
@@ -344,16 +345,9 @@ sysmon_power_daemon_task(struct power_ev
(struct sysmon_pswitch *)pev_data;
pev.pev_type = POWER_EVENT_SWITCH_STATE_CHANGE;
-#ifdef COMPAT_40
- pev.pev_switch.psws_state = event;
- pev.pev_switch.psws_type = pswitch->smpsw_type;
-
- if (pswitch->smpsw_name) {
- (void)strlcpy(pev.pev_switch.psws_name,
- pswitch->smpsw_name,
- sizeof(pev.pev_switch.psws_name));
- }
-#endif
+
+ (*compat_sysmon_power_40)(&pev, pswitch, event);
+
error = sysmon_power_make_dictionary(ped->dict,
pswitch,
event,
Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.7 src/sys/kern/compat_stub.c:1.1.2.8
--- src/sys/kern/compat_stub.c:1.1.2.7 Sat Mar 24 23:52:19 2018
+++ src/sys/kern/compat_stub.c Tue Mar 27 07:29:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.7 2018/03/24 23:52:19 pgoyette Exp $ */
+/* $NetBSD: compat_stub.c,v 1.1.2.8 2018/03/27 07:29:44 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -93,3 +93,9 @@ void (*puffs50_compat_incoming)(struct p
*/
int (*wsevent_50_copyout_events)(const struct wscons_event *, int,
struct uio *) = (void *)enosys;
+
+/*
+ * sysmon_power compatability
+ */
+void (*compat_sysmon_power_40)(struct power_event *, struct sysmon_pswitch *,
+ int) = (void *)voidop;
Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.202.2.10 src/sys/modules/Makefile:1.202.2.11
--- src/sys/modules/Makefile:1.202.2.10 Sat Mar 24 01:59:15 2018
+++ src/sys/modules/Makefile Tue Mar 27 07:29:44 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.202.2.10 2018/03/24 01:59:15 pgoyette Exp $
+# $NetBSD: Makefile,v 1.202.2.11 2018/03/27 07:29:44 pgoyette Exp $
.include <bsd.own.mk>
@@ -7,7 +7,7 @@
# Modules for compatability with earlier versions of NetBSD
SUBDIR+= compat compat_80 compat_70 compat_60 compat_50
-#SUBDIR+= compat_40 compat_30 compat_20 compat_16 compat_14
+SUBDIR+= compat_40 #compat_30 compat_20 compat_16 compat_14
#SUBDIR+= compat_13 compat_12 compat_10 compat_09
SUBDIR+= compat_ossaudio
SUBDIR+= compat_sysv
Index: src/sys/sys/compat_stub.h
diff -u src/sys/sys/compat_stub.h:1.1.2.7 src/sys/sys/compat_stub.h:1.1.2.8
--- src/sys/sys/compat_stub.h:1.1.2.7 Sat Mar 24 23:52:19 2018
+++ src/sys/sys/compat_stub.h Tue Mar 27 07:29:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.7 2018/03/24 23:52:19 pgoyette Exp $ */
+/* $NetBSD: compat_stub.h,v 1.1.2.8 2018/03/27 07:29:44 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -100,4 +100,14 @@ struct uio;
extern int (*wsevent_50_copyout_events)(const struct wscons_event *, int,
struct uio *);
+/*
+ * sysmon_power compatability
+ */
+
+struct power_event;
+struct sysmon_pswitch;
+
+extern void (*compat_sysmon_power_40)(struct power_event
+ *, struct sysmon_pswitch *, int);
+
#endif /* _SYS_COMPAT_STUB_H */
Added files:
Index: src/sys/compat/common/compat_40_mod.c
diff -u /dev/null src/sys/compat/common/compat_40_mod.c:1.1.2.1
--- /dev/null Tue Mar 27 07:29:44 2018
+++ src/sys/compat/common/compat_40_mod.c Tue Mar 27 07:29:43 2018
@@ -0,0 +1,100 @@
+/* $NetBSD: compat_40_mod.c,v 1.1.2.1 2018/03/27 07:29:43 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * 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_40_mod.c,v 1.1.2.1 2018/03/27 07:29:43 pgoyette Exp $");
+
+#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>
+
+#include <compat/common/if_40.h>
+
+int
+compat_40_init(void)
+{
+ int error = 0;
+
+ error = vfs_syscalls_40_init();
+ if (error != 0)
+ return error;
+ if_40_init();
+ sysmon_power_40_init();
+
+ return error;
+}
+
+int
+compat_40_fini(void)
+{
+ int error = 0;
+
+ sysmon_power_40_fini();
+ if_40_fini();
+ error = vfs_syscalls_40_fini();
+ if (error != 0) {
+ if_40_init();
+ sysmon_power_40_init();
+ }
+
+ return error;
+}
+
+#ifdef _MODULE
+
+#define REQD_40 "compat_80,compat_70,compat_60,compat_50"
+
+MODULE(MODULE_CLASS_EXEC, compat_40, REQD_40);
+
+static int
+compat_40_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_40_init();
+ case MODULE_CMD_FINI:
+ return compat_40_init();
+ default:
+ return ENOTTY;
+ }
+}
+#endif
Index: src/sys/compat/common/sysmon_power_40.c
diff -u /dev/null src/sys/compat/common/sysmon_power_40.c:1.1.2.1
--- /dev/null Tue Mar 27 07:29:44 2018
+++ src/sys/compat/common/sysmon_power_40.c Tue Mar 27 07:29:44 2018
@@ -0,0 +1,103 @@
+/* $NetBSD: sysmon_power_40.c,v 1.1.2.1 2018/03/27 07:29:44 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2007 Juan Romero Pardines.
+ * All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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.
+ */
+
+/*
+ * Copyright (c) 2003 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: sysmon_power_40.c,v 1.1.2.1 2018/03/27 07:29:44 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/power.h>
+#include <sys/compat_stub.h>
+
+#include <dev/sysmon/sysmonvar.h>
+
+#include <compat/common/compat_mod.h>
+
+static void
+compat_40_sysmon_power(power_event_t *pev, struct sysmon_pswitch *pswitch,
+ int event)
+{
+
+ pev->pev_switch.psws_state = event;
+ pev->pev_switch.psws_type = pswitch->smpsw_type;
+
+ if (pswitch->smpsw_name) {
+ (void)strlcpy(pev->pev_switch.psws_name,
+ pswitch->smpsw_name,
+ sizeof(pev->pev_switch.psws_name));
+ }
+}
+
+void
+sysmon_power_40_init(void)
+{
+
+ compat_sysmon_power_40 = compat_40_sysmon_power;
+}
+
+void
+sysmon_power_40_fini(void)
+{
+
+ compat_sysmon_power_40 = (void *)voidop;
+}
Index: src/sys/modules/compat_40/Makefile
diff -u /dev/null src/sys/modules/compat_40/Makefile:1.1.2.1
--- /dev/null Tue Mar 27 07:29:44 2018
+++ src/sys/modules/compat_40/Makefile Tue Mar 27 07:29:44 2018
@@ -0,0 +1,18 @@
+# $NetBSD: Makefile,v 1.1.2.1 2018/03/27 07:29:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_40
+
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_40_mod.c
+SRCS+= vfs_syscalls_40.c uipc_syscalls_40.c
+
+.PATH: ${S}/dev/sysmon
+
+SRCS+= sysmon_power_40.c
+
+.include <bsd.kmodule.mk>