summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorpgoyette <pgoyette@NetBSD.org>2019-01-27 02:08:33 +0000
committerpgoyette <pgoyette@NetBSD.org>2019-01-27 02:08:33 +0000
commitcc17ee2ece085d7d746bcd8fa9be19170855aaac (patch)
tree5be40613f405cb081b2c44410b1506781927f8e3 /sys/compat
parent10dd4cc92542aa04b0e59469a484a48e4c3cdd24 (diff)
Merge the [pgoyette-compat] branch
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/aoutm68k/aoutm68k_syscall.h16
-rw-r--r--sys/compat/aoutm68k/aoutm68k_syscallargs.h22
-rw-r--r--sys/compat/aoutm68k/aoutm68k_syscalls.c30
-rw-r--r--sys/compat/aoutm68k/aoutm68k_sysent.c24
-rw-r--r--sys/compat/aoutm68k/files.aoutm68k4
-rw-r--r--sys/compat/aoutm68k/syscalls.master14
-rw-r--r--sys/compat/common/Makefile8
-rw-r--r--sys/compat/common/Makefile.inc4
-rw-r--r--sys/compat/common/Makefile.sysio35
-rw-r--r--sys/compat/common/bio_30.c107
-rw-r--r--sys/compat/common/ccd_60.c11
-rw-r--r--sys/compat/common/clockctl_50.c142
-rw-r--r--sys/compat/common/compat_09_mod.c91
-rw-r--r--sys/compat/common/compat_10_mod.c83
-rw-r--r--sys/compat/common/compat_12_mod.c117
-rw-r--r--sys/compat/common/compat_13_mod.c95
-rw-r--r--sys/compat/common/compat_14_mod.c83
-rw-r--r--sys/compat/common/compat_16_mod.c92
-rw-r--r--sys/compat/common/compat_20_mod.c99
-rw-r--r--sys/compat/common/compat_30_mod.c119
-rw-r--r--sys/compat/common/compat_40_mod.c97
-rw-r--r--sys/compat/common/compat_43_mod.c194
-rw-r--r--sys/compat/common/compat_50_mod.c173
-rw-r--r--sys/compat/common/compat_60_mod.c130
-rw-r--r--sys/compat/common/compat_70_mod.c93
-rw-r--r--sys/compat/common/compat_80_mod.c81
-rw-r--r--sys/compat/common/compat_exec.c5
-rw-r--r--sys/compat/common/compat_mod.c343
-rw-r--r--sys/compat/common/compat_mod.h165
-rw-r--r--sys/compat/common/compat_sysctl_09_43.c163
-rw-r--r--sys/compat/common/compat_sysv_10_mod.c93
-rw-r--r--sys/compat/common/compat_sysv_14_mod.c90
-rw-r--r--sys/compat/common/compat_sysv_50_mod.c95
-rw-r--r--sys/compat/common/compat_sysv_mod.h39
-rw-r--r--sys/compat/common/compat_util.c98
-rw-r--r--sys/compat/common/compat_util.h6
-rw-r--r--sys/compat/common/files.common133
-rw-r--r--sys/compat/common/ieee80211_20.c109
-rw-r--r--sys/compat/common/if43_20.c94
-rw-r--r--sys/compat/common/if_43.c53
-rw-r--r--sys/compat/common/if_spppsubr50.c169
-rw-r--r--sys/compat/common/if_spppsubr50.h38
-rw-r--r--sys/compat/common/kern_50.c34
-rw-r--r--sys/compat/common/kern_cpu_60.c21
-rw-r--r--sys/compat/common/kern_exit_43.c30
-rw-r--r--sys/compat/common/kern_info_09.c44
-rw-r--r--sys/compat/common/kern_info_43.c40
-rw-r--r--sys/compat/common/kern_ipc_10.c5
-rw-r--r--sys/compat/common/kern_mod_80.c167
-rw-r--r--sys/compat/common/kern_resource_43.c32
-rw-r--r--sys/compat/common/kern_sa_60.c35
-rw-r--r--sys/compat/common/kern_select_50.c33
-rw-r--r--sys/compat/common/kern_sig_13.c40
-rw-r--r--sys/compat/common/kern_sig_16.c105
-rw-r--r--sys/compat/common/kern_sig_43.c35
-rw-r--r--sys/compat/common/kern_time_30.c41
-rw-r--r--sys/compat/common/kern_time_50.c80
-rw-r--r--sys/compat/common/kern_time_60.c30
-rw-r--r--sys/compat/common/kern_xxx_12.c35
-rw-r--r--sys/compat/common/rndpseudo_50.c86
-rw-r--r--sys/compat/common/rtsock_14.c27
-rw-r--r--sys/compat/common/rtsock_50.c54
-rw-r--r--sys/compat/common/rtsock_70.c24
-rw-r--r--sys/compat/common/sysmon_power_40.c108
-rw-r--r--sys/compat/common/sysv_ipc_50.c8
-rw-r--r--sys/compat/common/sysv_msg_14.c8
-rw-r--r--sys/compat/common/sysv_msg_50.c8
-rw-r--r--sys/compat/common/sysv_sem_14.c8
-rw-r--r--sys/compat/common/sysv_sem_50.c8
-rw-r--r--sys/compat/common/sysv_shm_14.c8
-rw-r--r--sys/compat/common/sysv_shm_50.c8
-rw-r--r--sys/compat/common/tty_43.c24
-rw-r--r--sys/compat/common/tty_60.c28
-rw-r--r--sys/compat/common/uipc_syscalls_30.c34
-rw-r--r--sys/compat/common/uipc_syscalls_40.c23
-rw-r--r--sys/compat/common/uipc_syscalls_43.c39
-rw-r--r--sys/compat/common/uipc_syscalls_50.c16
-rw-r--r--sys/compat/common/uipc_usrreq_70.c29
-rw-r--r--sys/compat/common/usb_subr_30.c246
-rw-r--r--sys/compat/common/uvm_13.c8
-rw-r--r--sys/compat/common/uvm_50.c8
-rw-r--r--sys/compat/common/vfs_syscalls_10.c65
-rw-r--r--sys/compat/common/vfs_syscalls_12.c47
-rw-r--r--sys/compat/common/vfs_syscalls_20.c30
-rw-r--r--sys/compat/common/vfs_syscalls_30.c66
-rw-r--r--sys/compat/common/vfs_syscalls_40.c31
-rw-r--r--sys/compat/common/vfs_syscalls_43.c73
-rw-r--r--sys/compat/common/vfs_syscalls_50.c42
-rw-r--r--sys/compat/common/vm_12.c38
-rw-r--r--sys/compat/common/vm_43.c33
-rw-r--r--sys/compat/common/vnd_30.c134
-rw-r--r--sys/compat/common/vnd_50.c134
-rw-r--r--sys/compat/freebsd/files.freebsd4
-rw-r--r--sys/compat/linux/common/linux_exec_elf32.c12
-rw-r--r--sys/compat/linux/common/linux_mod.c10
-rw-r--r--sys/compat/linux/files.linux4
-rw-r--r--sys/compat/linux32/common/linux32_mod.c13
-rw-r--r--sys/compat/linux32/files.linux326
-rw-r--r--sys/compat/net/route_50.h (renamed from sys/compat/common/if_43.h)22
-rw-r--r--sys/compat/net/route_70.h44
-rw-r--r--sys/compat/netbsd32/files.netbsd3213
-rw-r--r--sys/compat/netbsd32/netbsd32.h38
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_09.c39
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_10_sysv.c (renamed from sys/compat/netbsd32/netbsd32_compat_10.c)52
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_12.c45
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_13.c39
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_14_sysv.c368
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_16.c80
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_20.c39
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_30.c94
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_43.c88
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_50.c139
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_50_sysv.c47
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_60.c36
-rw-r--r--sys/compat/netbsd32/netbsd32_compat_80.c198
-rw-r--r--sys/compat/netbsd32/netbsd32_exec.h4
-rw-r--r--sys/compat/netbsd32/netbsd32_exec_elf32.c11
-rw-r--r--sys/compat/netbsd32/netbsd32_ioctl.c10
-rw-r--r--sys/compat/netbsd32/netbsd32_ipc.c36
-rw-r--r--sys/compat/netbsd32/netbsd32_kern_proc.c156
-rw-r--r--sys/compat/netbsd32/netbsd32_kern_proc.h38
-rw-r--r--sys/compat/netbsd32/netbsd32_mod.c35
-rw-r--r--sys/compat/netbsd32/netbsd32_module.c126
-rw-r--r--sys/compat/netbsd32/netbsd32_mqueue.c6
-rw-r--r--sys/compat/netbsd32/netbsd32_netbsd.c30
-rw-r--r--sys/compat/netbsd32/netbsd32_nfssvc.c6
-rw-r--r--sys/compat/netbsd32/netbsd32_ptrace.c7
-rw-r--r--sys/compat/netbsd32/netbsd32_rndpseudo_50.c124
-rw-r--r--sys/compat/netbsd32/netbsd32_syscall.h11
-rw-r--r--sys/compat/netbsd32/netbsd32_syscallargs.h14
-rw-r--r--sys/compat/netbsd32/netbsd32_syscalls.c20
-rw-r--r--sys/compat/netbsd32/netbsd32_syscalls_autoload.c119
-rw-r--r--sys/compat/netbsd32/netbsd32_sysent.c241
-rw-r--r--sys/compat/netbsd32/netbsd32_systrace_args.c17
-rw-r--r--sys/compat/netbsd32/netbsd32_time.c80
-rw-r--r--sys/compat/netbsd32/syscalls.conf4
-rw-r--r--sys/compat/netbsd32/syscalls.master312
-rw-r--r--sys/compat/osf1/osf1_mod.c6
-rw-r--r--sys/compat/sunos/files.sunos4
-rw-r--r--sys/compat/sunos/sunos_mod.c18
-rw-r--r--sys/compat/sunos/sunos_syscall.h13
-rw-r--r--sys/compat/sunos/sunos_syscallargs.h22
-rw-r--r--sys/compat/sunos/sunos_syscalls.c28
-rw-r--r--sys/compat/sunos/sunos_sysent.c21
-rw-r--r--sys/compat/sunos/syscalls.master13
-rw-r--r--sys/compat/sunos32/files.sunos324
-rw-r--r--sys/compat/sunos32/sunos32_mod.c23
-rw-r--r--sys/compat/sys/clockctl.h5
-rw-r--r--sys/compat/sys/cpuio.h34
-rw-r--r--sys/compat/sys/rnd.h3
-rw-r--r--sys/compat/sys/socket.h5
-rw-r--r--sys/compat/sys/sockio.h14
-rw-r--r--sys/compat/sys/ttycom.h4
-rw-r--r--sys/compat/ultrix/files.ultrix4
-rw-r--r--sys/compat/ultrix/syscalls.master7
-rw-r--r--sys/compat/ultrix/ultrix_syscall.h7
-rw-r--r--sys/compat/ultrix/ultrix_syscallargs.h10
-rw-r--r--sys/compat/ultrix/ultrix_syscalls.c16
-rw-r--r--sys/compat/ultrix/ultrix_sysent.c15
159 files changed, 7780 insertions, 1300 deletions
diff --git a/sys/compat/aoutm68k/aoutm68k_syscall.h b/sys/compat/aoutm68k/aoutm68k_syscall.h
index eb18eb25953..b8e7f76472f 100644
--- a/sys/compat/aoutm68k/aoutm68k_syscall.h
+++ b/sys/compat/aoutm68k/aoutm68k_syscall.h
@@ -1,10 +1,10 @@
-/* $NetBSD: aoutm68k_syscall.h,v 1.53 2018/08/10 21:47:14 pgoyette Exp $ */
+/* $NetBSD: aoutm68k_syscall.h,v 1.54 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.41 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.41.2.1 2018/09/29 01:37:26 pgoyette Exp
*/
#ifndef _AOUTM68K_SYS_SYSCALL_H_
@@ -352,9 +352,13 @@
/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */
#define AOUTM68K_SYS_setpriority 96
+#if defined(COMPAT_30) || !defined(_KERNEL)
/* syscall: "socket" ret: "int" args: "int" "int" "int" */
#define AOUTM68K_SYS_socket 97
+#else
+ /* 97 is excluded compat_30_sys_socket */
+#endif
/* syscall: "connect" ret: "int" args: "int" "const struct sockaddr *" "int" */
#define AOUTM68K_SYS_connect 98
@@ -580,9 +584,13 @@
#else
/* 158 is excluded compat_20_sys_statfs */
#endif
+#if defined(COMPAT_30) || !defined(_KERNEL)
/* syscall: "getfh" ret: "int" args: "const char *" "struct compat_30_fhandle *" */
#define AOUTM68K_SYS_getfh 161
+#else
+ /* 161 is excluded compat_30_sys_getfh */
+#endif
#if defined(COMPAT_09) || !defined(_KERNEL)
/* syscall: "ogetdomainname" ret: "int" args: "char *" "int" */
#define AOUTM68K_SYS_ogetdomainname 162
@@ -908,9 +916,13 @@
/* syscall: "fchroot" ret: "int" args: "int" */
#define AOUTM68K_SYS_fchroot 297
+#if defined(COMPAT_30) || ! defined(_KERNEL)
/* syscall: "fhopen" ret: "int" args: "const struct compat_30_fhandle *" "int" */
#define AOUTM68K_SYS_fhopen 298
+#else
+ /* 298 is excluded compat_30_sys_fhopen */
+#endif
/* syscall: "fhstat" ret: "int" args: "const struct compat_30_fhandle *" "struct aoutm68k_stat *" */
#define AOUTM68K_SYS_fhstat 299
diff --git a/sys/compat/aoutm68k/aoutm68k_syscallargs.h b/sys/compat/aoutm68k/aoutm68k_syscallargs.h
index 20a92cd4559..667b21576e2 100644
--- a/sys/compat/aoutm68k/aoutm68k_syscallargs.h
+++ b/sys/compat/aoutm68k/aoutm68k_syscallargs.h
@@ -1,10 +1,10 @@
-/* $NetBSD: aoutm68k_syscallargs.h,v 1.51 2018/08/10 21:47:14 pgoyette Exp $ */
+/* $NetBSD: aoutm68k_syscallargs.h,v 1.52 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.41 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.41.2.1 2018/09/29 01:37:26 pgoyette Exp
*/
#ifndef _AOUTM68K_SYS_SYSCALLARGS_H_
@@ -239,8 +239,11 @@ struct compat_50_sys_select_args;
struct sys_fsync_args;
struct sys_setpriority_args;
+#if defined(COMPAT_30) || !defined(_KERNEL)
struct compat_30_sys_socket_args;
+#else
+#endif
struct sys_connect_args;
#if defined(COMPAT_43) || !defined(_KERNEL)
@@ -378,8 +381,11 @@ struct compat_20_sys_statfs_args;
struct compat_20_sys_fstatfs_args;
#else
#endif
+#if defined(COMPAT_30) || !defined(_KERNEL)
struct compat_30_sys_getfh_args;
+#else
+#endif
#if defined(COMPAT_09) || !defined(_KERNEL)
struct compat_09_sys_getdomainname_args;
@@ -611,8 +617,11 @@ struct compat_16_sys___sigreturn14_args;
struct sys___getcwd_args;
struct sys_fchroot_args;
+#if defined(COMPAT_30) || ! defined(_KERNEL)
struct compat_30_sys_fhopen_args;
+#else
+#endif
struct aoutm68k_sys_fhstat_args {
syscallarg(const struct compat_30_fhandle *) fhp;
@@ -874,8 +883,11 @@ int sys_fsync(struct lwp *, const struct sys_fsync_args *, register_t *);
int sys_setpriority(struct lwp *, const struct sys_setpriority_args *, register_t *);
+#if defined(COMPAT_30) || !defined(_KERNEL)
int compat_30_sys_socket(struct lwp *, const struct compat_30_sys_socket_args *, register_t *);
+#else
+#endif
int sys_connect(struct lwp *, const struct sys_connect_args *, register_t *);
#if defined(COMPAT_43) || !defined(_KERNEL)
@@ -1019,8 +1031,11 @@ int compat_20_sys_fstatfs(struct lwp *, const struct compat_20_sys_fstatfs_args
#else
#endif
+#if defined(COMPAT_30) || !defined(_KERNEL)
int compat_30_sys_getfh(struct lwp *, const struct compat_30_sys_getfh_args *, register_t *);
+#else
+#endif
#if defined(COMPAT_09) || !defined(_KERNEL)
int compat_09_sys_getdomainname(struct lwp *, const struct compat_09_sys_getdomainname_args *, register_t *);
@@ -1232,8 +1247,11 @@ int sys___getcwd(struct lwp *, const struct sys___getcwd_args *, register_t *);
int sys_fchroot(struct lwp *, const struct sys_fchroot_args *, register_t *);
+#if defined(COMPAT_30) || ! defined(_KERNEL)
int compat_30_sys_fhopen(struct lwp *, const struct compat_30_sys_fhopen_args *, register_t *);
+#else
+#endif
int aoutm68k_sys_fhstat(struct lwp *, const struct aoutm68k_sys_fhstat_args *, register_t *);
#if defined(COMPAT_20) || !defined(_KERNEL)
diff --git a/sys/compat/aoutm68k/aoutm68k_syscalls.c b/sys/compat/aoutm68k/aoutm68k_syscalls.c
index 703899ecfa6..8610f3b971a 100644
--- a/sys/compat/aoutm68k/aoutm68k_syscalls.c
+++ b/sys/compat/aoutm68k/aoutm68k_syscalls.c
@@ -1,14 +1,14 @@
-/* $NetBSD: aoutm68k_syscalls.c,v 1.50 2018/08/10 21:47:14 pgoyette Exp $ */
+/* $NetBSD: aoutm68k_syscalls.c,v 1.51 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.41 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.41.2.1 2018/09/29 01:37:26 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aoutm68k_syscalls.c,v 1.50 2018/08/10 21:47:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aoutm68k_syscalls.c,v 1.51 2019/01/27 02:08:39 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)
@@ -197,7 +197,11 @@ const char *const aoutm68k_syscallnames[] = {
/* 94 */ "#94 (unimplemented setdopt)",
/* 95 */ "fsync",
/* 96 */ "setpriority",
+#if defined(COMPAT_30) || !defined(_KERNEL)
/* 97 */ "socket",
+#else
+ /* 97 */ "#97 (excluded compat_30_sys_socket)",
+#endif
/* 98 */ "connect",
#if defined(COMPAT_43) || !defined(_KERNEL)
/* 99 */ "oaccept",
@@ -325,7 +329,11 @@ const char *const aoutm68k_syscallnames[] = {
#endif
/* 159 */ "#159 (unimplemented)",
/* 160 */ "#160 (unimplemented)",
+#if defined(COMPAT_30) || !defined(_KERNEL)
/* 161 */ "getfh",
+#else
+ /* 161 */ "#161 (excluded compat_30_sys_getfh)",
+#endif
#if defined(COMPAT_09) || !defined(_KERNEL)
/* 162 */ "ogetdomainname",
/* 163 */ "osetdomainname",
@@ -543,7 +551,11 @@ const char *const aoutm68k_syscallnames[] = {
#endif
/* 296 */ "__getcwd",
/* 297 */ "fchroot",
+#if defined(COMPAT_30) || ! defined(_KERNEL)
/* 298 */ "fhopen",
+#else
+ /* 298 */ "#298 (excluded compat_30_sys_fhopen)",
+#endif
/* 299 */ "fhstat",
#if defined(COMPAT_20) || !defined(_KERNEL)
/* 300 */ "fhstatfs",
@@ -944,7 +956,11 @@ const char *const altaoutm68k_syscallnames[] = {
/* 94 */ NULL, /* unimplemented setdopt */
/* 95 */ NULL, /* fsync */
/* 96 */ NULL, /* setpriority */
+#if defined(COMPAT_30) || !defined(_KERNEL)
/* 97 */ NULL, /* socket */
+#else
+ /* 97 */ NULL, /* excluded compat_30_sys_socket */
+#endif
/* 98 */ NULL, /* connect */
#if defined(COMPAT_43) || !defined(_KERNEL)
/* 99 */ "accept",
@@ -1072,7 +1088,11 @@ const char *const altaoutm68k_syscallnames[] = {
#endif
/* 159 */ NULL, /* unimplemented */
/* 160 */ NULL, /* unimplemented */
+#if defined(COMPAT_30) || !defined(_KERNEL)
/* 161 */ NULL, /* getfh */
+#else
+ /* 161 */ NULL, /* excluded compat_30_sys_getfh */
+#endif
#if defined(COMPAT_09) || !defined(_KERNEL)
/* 162 */ "getdomainname",
/* 163 */ "setdomainname",
@@ -1290,7 +1310,11 @@ const char *const altaoutm68k_syscallnames[] = {
#endif
/* 296 */ NULL, /* __getcwd */
/* 297 */ NULL, /* fchroot */
+#if defined(COMPAT_30) || ! defined(_KERNEL)
/* 298 */ NULL, /* fhopen */
+#else
+ /* 298 */ NULL, /* excluded compat_30_sys_fhopen */
+#endif
/* 299 */ NULL, /* fhstat */
#if defined(COMPAT_20) || !defined(_KERNEL)
/* 300 */ NULL, /* fhstatfs */
diff --git a/sys/compat/aoutm68k/aoutm68k_sysent.c b/sys/compat/aoutm68k/aoutm68k_sysent.c
index 8c5ff7f15cd..ae560092ff5 100644
--- a/sys/compat/aoutm68k/aoutm68k_sysent.c
+++ b/sys/compat/aoutm68k/aoutm68k_sysent.c
@@ -1,14 +1,14 @@
-/* $NetBSD: aoutm68k_sysent.c,v 1.55 2018/08/10 21:47:14 pgoyette Exp $ */
+/* $NetBSD: aoutm68k_sysent.c,v 1.56 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.41 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.41.2.1 2018/09/29 01:37:26 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aoutm68k_sysent.c,v 1.55 2018/08/10 21:47:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aoutm68k_sysent.c,v 1.56 2019/01/27 02:08:39 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ktrace.h"
@@ -563,10 +563,16 @@ struct sysent aoutm68k_sysent[] = {
ns(struct sys_setpriority_args),
.sy_call = (sy_call_t *)sys_setpriority
}, /* 96 = setpriority */
+#if defined(COMPAT_30) || !defined(_KERNEL)
{
ns(struct compat_30_sys_socket_args),
.sy_call = (sy_call_t *)compat_30_sys_socket
}, /* 97 = socket */
+#else
+ {
+ .sy_call = sys_nosys,
+ }, /* 97 = filler */
+#endif
{
ns(struct sys_connect_args),
.sy_flags = SYCALL_ARG_PTR,
@@ -954,11 +960,17 @@ struct sysent aoutm68k_sysent[] = {
{
.sy_call = sys_nosys,
}, /* 160 = filler */
+#if defined(COMPAT_30) || !defined(_KERNEL)
{
ns(struct compat_30_sys_getfh_args),
.sy_flags = SYCALL_ARG_PTR,
.sy_call = (sy_call_t *)compat_30_sys_getfh
}, /* 161 = getfh */
+#else
+ {
+ .sy_call = sys_nosys,
+ }, /* 161 = filler */
+#endif
#if defined(COMPAT_09) || !defined(_KERNEL)
{
ns(struct compat_09_sys_getdomainname_args),
@@ -1646,11 +1658,17 @@ struct sysent aoutm68k_sysent[] = {
ns(struct sys_fchroot_args),
.sy_call = (sy_call_t *)sys_fchroot
}, /* 297 = fchroot */
+#if defined(COMPAT_30) || ! defined(_KERNEL)
{
ns(struct compat_30_sys_fhopen_args),
.sy_flags = SYCALL_ARG_PTR,
.sy_call = (sy_call_t *)compat_30_sys_fhopen
}, /* 298 = fhopen */
+#else
+ {
+ .sy_call = sys_nosys,
+ }, /* 298 = filler */
+#endif
{
ns(struct aoutm68k_sys_fhstat_args),
.sy_flags = SYCALL_ARG_PTR,
diff --git a/sys/compat/aoutm68k/files.aoutm68k b/sys/compat/aoutm68k/files.aoutm68k
index f1781e5ae0b..640a0b983ab 100644
--- a/sys/compat/aoutm68k/files.aoutm68k
+++ b/sys/compat/aoutm68k/files.aoutm68k
@@ -1,11 +1,11 @@
-# $NetBSD: files.aoutm68k,v 1.7 2014/11/17 01:01:57 uebayasi Exp $
+# $NetBSD: files.aoutm68k,v 1.8 2019/01/27 02:08:39 pgoyette Exp $
#
# Config file description for m68k a.out compat code.
# ports should define any machine-specific files they need in their
# own file lists.
-define compat_aout_m68k
+define compat_aout_m68k : exec_aout
file compat/aoutm68k/aoutm68k_exec.c compat_aout_m68k
file compat/aoutm68k/aoutm68k_stat.c compat_aout_m68k
file compat/aoutm68k/aoutm68k_sysent.c compat_aout_m68k
diff --git a/sys/compat/aoutm68k/syscalls.master b/sys/compat/aoutm68k/syscalls.master
index 54f0b8432fd..9667875eb85 100644
--- a/sys/compat/aoutm68k/syscalls.master
+++ b/sys/compat/aoutm68k/syscalls.master
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.41 2018/01/06 16:41:23 kamil Exp $
+ $NetBSD: syscalls.master,v 1.42 2019/01/27 02:08:39 pgoyette Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -271,7 +271,11 @@
94 UNIMPL setdopt
95 NOARGS { int|sys||fsync(int fd); }
96 NOARGS { int|sys||setpriority(int which, int who, int prio); }
+#if defined(COMPAT_30) || !defined(_KERNEL)
97 NOARGS { int|compat_30_sys||socket(int domain, int type, int protocol); }
+#else
+97 EXCL compat_30_sys_socket
+#endif
98 NOARGS { int|sys||connect(int s, const struct sockaddr *name, \
int namelen); }
#if defined(COMPAT_43) || !defined(_KERNEL)
@@ -442,8 +446,12 @@
#endif
159 UNIMPL
160 UNIMPL
+#if defined(COMPAT_30) || !defined(_KERNEL)
161 NOARGS { int|compat_30_sys||getfh(const char *fname, \
struct compat_30_fhandle *fhp); }
+#else
+161 EXCL compat_30_sys_getfh
+#endif
#if defined(COMPAT_09) || !defined(_KERNEL)
162 NOARGS { int|compat_09_sys||getdomainname(char *domainname, \
int len); } ogetdomainname
@@ -726,8 +734,12 @@
#endif
296 NOARGS { int|sys||__getcwd(char *bufp, size_t length); }
297 NOARGS { int|sys||fchroot(int fd); }
+#if defined(COMPAT_30) || ! defined(_KERNEL)
298 NOARGS { int|compat_30_sys||fhopen(const \
struct compat_30_fhandle *fhp, int flags); }
+#else
+298 EXCL compat_30_sys_fhopen
+#endif
299 STD { int|aoutm68k_sys||fhstat(const struct \
compat_30_fhandle *fhp, \
struct aoutm68k_stat *sb); }
diff --git a/sys/compat/common/Makefile b/sys/compat/common/Makefile
index 6ffde9db913..d89e15e34d9 100644
--- a/sys/compat/common/Makefile
+++ b/sys/compat/common/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.64 2018/06/05 00:58:17 christos Exp $
+# $NetBSD: Makefile,v 1.65 2019/01/27 02:08:39 pgoyette Exp $
LIB= compat
NOPIC= # defined
@@ -27,5 +27,11 @@ lib${LIB}.o:: ${OBJS:O} __buildstdlib
lib${LIB}.po:: ${POBJS:O} __buildproflib
+.if NOTYET
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+= -DCPU_UCODE
+.endif
+.endif
+
showsources: ${SRCS}
@echo ${.ALLSRC}
diff --git a/sys/compat/common/Makefile.inc b/sys/compat/common/Makefile.inc
index 210b622779d..5dbda8a8cc8 100644
--- a/sys/compat/common/Makefile.inc
+++ b/sys/compat/common/Makefile.inc
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.25 2018/05/27 01:14:50 christos Exp $
+# $NetBSD: Makefile.inc,v 1.26 2019/01/27 02:08:39 pgoyette Exp $
#
# Configuration variables (default values are below):
#
@@ -25,7 +25,7 @@ COMPAT_AS?= obj
COMPATDOTDIR?= ../../.
COMPATDIR= ${S:S@^.@${COMPATDOTDIR}@:Q}/compat/common
-.if (${COMPAT_AS} == "obj")
+.if (${COMPAT_AS} == "library")
COMPATLIB= ${COMPATDST}/libcompat.o
COMPATLIB_PROF= ${COMPATDST}/libcompat.po
.else
diff --git a/sys/compat/common/Makefile.sysio b/sys/compat/common/Makefile.sysio
index a604caff00c..c3cf8b3466c 100644
--- a/sys/compat/common/Makefile.sysio
+++ b/sys/compat/common/Makefile.sysio
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.sysio,v 1.10 2018/03/18 20:33:52 christos Exp $
+# $NetBSD: Makefile.sysio,v 1.11 2019/01/27 02:08:39 pgoyette Exp $
# Sources for syscall and ioctl compatibility across the versions.
@@ -8,6 +8,10 @@ SRCS+= kern_exit_43.c kern_info_43.c kern_resource_43.c kern_sig_43.c \
# Compatibility code for NetBSD 0.9
SRCS+= kern_info_09.c
+SRCS+= compat_sysctl_09_43.c # for compat_43 or compat_09
+
+# Compatability code for NetBSD 1.0
+SRCS+= vfs_syscalls_10.c
# Compatibility code for NetBSD 1.2
SRCS+= kern_xxx_12.c vfs_syscalls_12.c vm_12.c
@@ -22,20 +26,43 @@ SRCS+= kern_sig_16.c
SRCS+= rtsock_14.c
# Compatibility code for NetBSD 2.0
-SRCS+= vfs_syscalls_20.c
+SRCS+= vfs_syscalls_20.c ieee80211_20.c if43_20.c
# Compatibility code for NetBSD 3.0
-SRCS+= kern_time_30.c vfs_syscalls_30.c uipc_syscalls_30.c
+SRCS+= kern_time_30.c vfs_syscalls_30.c uipc_syscalls_30.c bio_30.c vnd_30.c
+SRCS+= usb_subr_30.c
# Compatibility code for NetBSD 4.0
SRCS+= vfs_syscalls_40.c uipc_syscalls_40.c
# Compatibility code for NetBSD 5.0
SRCS+= kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
- vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c
+ vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c clockctl_50.c \
+ if_spppsubr50.c vnd_50.c
# Compatibility code for NetBSD 6.0
SRCS+= kern_sa_60.c tty_60.c kern_time_60.c kern_cpu_60.c ccd_60.c
# Compatibility code for NetBSD 7.0
SRCS+= rtsock_70.c uipc_usrreq_70.c
+
+# Compatability code for NetBSD 8.0
+SRCS+= kern_mod_80.c
+
+# More compatibility code for NetBSD 5.0
+.PATH: ${S}/opencrypto
+SRCS+= ocryptodev.c
+
+# Raidframe compatibility code for NetBSD 5.0 and 8.0
+.PATH: ${S}/dev/raidframe
+SRCS+= rf_compat50.c
+SRCS+= rf_compat80.c
+
+# Puffs compatability code for NetBSD 5.0
+.PATH: ${S}/fs/puffs
+SRCS+= puffs_compat.c
+
+# wsevent compatability code for NetBSD 5.0
+.PATH: ${S}/dev/wscons
+SRCS+= wsevent_50.c
+
diff --git a/sys/compat/common/bio_30.c b/sys/compat/common/bio_30.c
new file mode 100644
index 00000000000..26cbaf92ec7
--- /dev/null
+++ b/sys/compat/common/bio_30.c
@@ -0,0 +1,107 @@
+/* $NetBSD: bio_30.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+/* $OpenBSD: bio.c,v 1.9 2007/03/20 02:35:55 marco Exp $ */
+
+/*
+ * Copyright (c) 2002 Niklas Hallqvist. 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: bio_30.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/event.h>
+#include <sys/ioctl.h>
+#include <sys/malloc.h>
+#include <sys/queue.h>
+#include <sys/systm.h>
+#include <sys/mutex.h>
+#include <sys/proc.h>
+#include <sys/kauth.h>
+#include <sys/compat_stub.h>
+
+#include <dev/biovar.h>
+#include <dev/sysmon/sysmonvar.h>
+
+#include <compat/common/compat_mod.h>
+
+static int
+compat_30_bio(void *cookie, u_long cmd, void *addr,
+ int (*delegate)(void *, u_long, void *))
+{
+ int error;
+
+ switch (cmd) {
+ case OBIOCDISK: {
+ struct bioc_disk *bd =
+ malloc(sizeof(*bd), M_DEVBUF, M_WAITOK|M_ZERO);
+
+ (void)memcpy(bd, addr, sizeof(struct obioc_disk));
+ error = (*delegate)(cookie, BIOCDISK, bd);
+ if (error) {
+ free(bd, M_DEVBUF);
+ return error;
+ }
+
+ (void)memcpy(addr, bd, sizeof(struct obioc_disk));
+ free(bd, M_DEVBUF);
+ return 0;
+ }
+ case OBIOCVOL: {
+ struct bioc_vol *bv =
+ malloc(sizeof(*bv), M_DEVBUF, M_WAITOK|M_ZERO);
+
+ (void)memcpy(bv, addr, sizeof(struct obioc_vol));
+ error = (*delegate)(cookie, BIOCVOL, bv);
+ if (error) {
+ free(bv, M_DEVBUF);
+ return error;
+ }
+
+ (void)memcpy(addr, bv, sizeof(struct obioc_vol));
+ free(bv, M_DEVBUF);
+ return 0;
+ }
+ default:
+ return ENOSYS;
+ }
+}
+
+void
+bio_30_init(void)
+{
+
+ MODULE_SET_HOOK(compat_bio_30_hook, "bio_30", compat_30_bio);
+}
+
+void
+bio_30_fini(void)
+{
+
+ MODULE_UNSET_HOOK(compat_bio_30_hook);
+}
diff --git a/sys/compat/common/ccd_60.c b/sys/compat/common/ccd_60.c
index 366a9d41a8b..0413a76dd60 100644
--- a/sys/compat/common/ccd_60.c
+++ b/sys/compat/common/ccd_60.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd_60.c,v 1.7 2018/03/19 13:26:02 martin Exp $ */
+/* $NetBSD: ccd_60.c,v 1.8 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.7 2018/03/19 13:26:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.8 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.7 2018/03/19 13:26:02 martin Exp $");
#include <sys/systm.h>
#include <sys/disk.h>
#include <sys/lwp.h>
+#include <sys/compat_stub.h>
#include <dev/ccdvar.h>
#include <compat/sys/ccdvar.h>
@@ -95,11 +96,13 @@ compat_60_ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l,
void
ccd_60_init(void)
{
-// compat_ccd_ioctl_60 = compat_60_ccdioctl;
+
+ MODULE_SET_HOOK(ccd_ioctl_60_hook, "ccd_60", compat_60_ccdioctl);
}
void
ccd_60_fini(void)
{
-// compat_ccd_ioctl_60 = (void *)enosys;
+
+ MODULE_UNSET_HOOK(ccd_ioctl_60_hook);
}
diff --git a/sys/compat/common/clockctl_50.c b/sys/compat/common/clockctl_50.c
new file mode 100644
index 00000000000..15c93db3f67
--- /dev/null
+++ b/sys/compat/common/clockctl_50.c
@@ -0,0 +1,142 @@
+/* $NetBSD: clockctl_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus.
+ *
+ * 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. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: clockctl_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/errno.h>
+#include <sys/ioctl.h>
+#include <sys/device.h>
+#include <sys/time.h>
+#include <sys/conf.h>
+#include <sys/timex.h>
+#include <sys/kauth.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/compat_stub.h>
+
+#include <sys/clockctl.h>
+#include <compat/sys/clockctl.h>
+#include <compat/sys/time_types.h>
+
+int
+compat50_clockctlioctl(dev_t dev, u_long cmd, void *data, int flags,
+ struct lwp *l)
+{
+ int error = 0;
+ const struct cdevsw *cd = cdevsw_lookup(dev);
+
+ if (cd == NULL || cd->d_ioctl == NULL)
+ return ENXIO;
+
+ switch (cmd) {
+ case CLOCKCTL_OSETTIMEOFDAY: {
+ struct timeval50 tv50;
+ struct timeval tv;
+ struct clockctl50_settimeofday *args = data;
+
+ error = copyin(args->tv, &tv50, sizeof(tv50));
+ if (error)
+ return (error);
+ timeval50_to_timeval(&tv50, &tv);
+ error = settimeofday1(&tv, false, args->tzp, l, false);
+ break;
+ }
+ case CLOCKCTL_OADJTIME: {
+ struct timeval atv, oldatv;
+ struct timeval50 atv50;
+ struct clockctl50_adjtime *args = data;
+
+ if (args->delta) {
+ error = copyin(args->delta, &atv50, sizeof(atv50));
+ if (error)
+ return (error);
+ timeval50_to_timeval(&atv50, &atv);
+ }
+ adjtime1(args->delta ? &atv : NULL,
+ args->olddelta ? &oldatv : NULL, l->l_proc);
+ if (args->olddelta) {
+ timeval_to_timeval50(&oldatv, &atv50);
+ error = copyout(&atv50, args->olddelta, sizeof(atv50));
+ }
+ break;
+ }
+ case CLOCKCTL_OCLOCK_SETTIME: {
+ struct timespec50 tp50;
+ struct timespec tp;
+ struct clockctl50_clock_settime *args = data;
+
+ error = copyin(args->tp, &tp50, sizeof(tp50));
+ if (error)
+ return (error);
+ timespec50_to_timespec(&tp50, &tp);
+ error = clock_settime1(l->l_proc, args->clock_id, &tp, true);
+ break;
+ }
+ case CLOCKCTL_ONTP_ADJTIME: {
+ if (vec_ntp_timestatus == NULL) {
+ error = ENOTTY;
+ break;
+ }
+ /* The ioctl number changed but the data did not change. */
+ error = (cd->d_ioctl)(dev, CLOCKCTL_NTP_ADJTIME,
+ data, flags, l);
+ break;
+ }
+ default:
+ error = ENOTTY;
+ }
+
+ return (error);
+}
+
+void
+clockctl_50_init(void)
+{
+
+ MODULE_SET_HOOK(clockctl_ioctl_50_hook, "clk_50",
+ compat50_clockctlioctl);
+}
+
+void
+clockctl_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(clockctl_ioctl_50_hook);
+}
diff --git a/sys/compat/common/compat_09_mod.c b/sys/compat/common/compat_09_mod.c
new file mode 100644
index 00000000000..83b3e99f880
--- /dev/null
+++ b/sys/compat/common/compat_09_mod.c
@@ -0,0 +1,91 @@
+/* $NetBSD: compat_09_mod.c,v 1.2 2019/01/27 02:08:39 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_09_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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 <sys/compat_stub.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+
+static int saved_pgid_mask;
+
+int
+compat_09_init(void)
+{
+
+ kern_info_09_init();
+ saved_pgid_mask = kern_sig_43_pgid_mask;
+ kern_sig_43_pgid_mask = 0xffff;
+ return 0;
+}
+
+int
+compat_09_fini(void)
+{
+
+ kern_info_09_fini();
+ kern_sig_43_pgid_mask = saved_pgid_mask;
+ return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_09,
+ "compat_10,compat_util,compat_sysctl_09_43");
+
+static int
+compat_09_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_09_init();
+ case MODULE_CMD_FINI:
+ return compat_09_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_10_mod.c b/sys/compat/common/compat_10_mod.c
new file mode 100644
index 00000000000..851fbe3c327
--- /dev/null
+++ b/sys/compat/common/compat_10_mod.c
@@ -0,0 +1,83 @@
+/* $NetBSD: compat_10_mod.c,v 1.2 2019/01/27 02:08:39 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_10_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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_10_init(void)
+{
+
+ vfs_syscalls_10_init();
+ return 0;
+}
+
+int
+compat_10_fini(void)
+{
+
+ vfs_syscalls_10_fini();
+ return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_10, "compat_12,compat_util");
+
+static int
+compat_10_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_10_init();
+ case MODULE_CMD_FINI:
+ return compat_10_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_12_mod.c b/sys/compat/common/compat_12_mod.c
new file mode 100644
index 00000000000..a2a8cb0f2cd
--- /dev/null
+++ b/sys/compat/common/compat_12_mod.c
@@ -0,0 +1,117 @@
+/* $NetBSD: compat_12_mod.c,v 1.2 2019/01/27 02:08:39 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_12_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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_12_init(void)
+{
+ int error;
+
+ error = kern_xxx_12_init();
+ if (error != 0)
+ return error;
+
+ error = vm_12_init();
+ if (error != 0) {
+ kern_xxx_12_fini();
+ return error;
+ }
+
+ error = vfs_syscalls_12_init();
+ if (error != 0) {
+ vm_12_fini();
+ kern_xxx_12_fini();
+ return error;
+ }
+
+ return 0;
+}
+
+int
+compat_12_fini(void)
+{
+ int error;
+
+ error = vfs_syscalls_12_fini();
+ if (error != 0)
+ return error;
+
+ error = vm_12_fini();
+ if (error != 0) {
+ vfs_syscalls_12_init();
+ return error;
+ }
+
+ error = kern_xxx_12_fini();
+ if (error != 0) {
+ vm_12_init();
+ vfs_syscalls_12_init();
+ return error;
+ }
+
+ return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_12, "compat_13");
+
+static int
+compat_12_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_12_init();
+ case MODULE_CMD_FINI:
+ return compat_12_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_13_mod.c b/sys/compat/common/compat_13_mod.c
new file mode 100644
index 00000000000..f3b31031a13
--- /dev/null
+++ b/sys/compat/common/compat_13_mod.c
@@ -0,0 +1,95 @@
+/* $NetBSD: compat_13_mod.c,v 1.2 2019/01/27 02:08:39 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_13_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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_13_init(void)
+{
+ int error;
+
+ error = kern_sig_13_init();
+ if (error != 0)
+ return error;
+
+ uvm_13_init();
+ return 0;
+}
+
+int
+compat_13_fini(void)
+{
+ int error;
+
+ uvm_13_fini();
+ error = kern_sig_13_fini();
+ if (error != 0) {
+ uvm_13_init();
+ return error;
+ }
+
+ return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_13, "compat_14");
+
+static int
+compat_13_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_13_init();
+ case MODULE_CMD_FINI:
+ return compat_13_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_14_mod.c b/sys/compat/common/compat_14_mod.c
new file mode 100644
index 00000000000..e147a590a9d
--- /dev/null
+++ b/sys/compat/common/compat_14_mod.c
@@ -0,0 +1,83 @@
+/* $NetBSD: compat_14_mod.c,v 1.2 2019/01/27 02:08:39 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_14_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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_14_init(void)
+{
+
+ rtsock_14_init();
+ return 0;
+}
+
+int
+compat_14_fini(void)
+{
+
+ rtsock_14_fini();
+ return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_14, "compat_16");
+
+static int
+compat_14_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_14_init();
+ case MODULE_CMD_FINI:
+ return compat_14_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_16_mod.c b/sys/compat/common/compat_16_mod.c
new file mode 100644
index 00000000000..44c92094448
--- /dev/null
+++ b/sys/compat/common/compat_16_mod.c
@@ -0,0 +1,92 @@
+/* $NetBSD: compat_16_mod.c,v 1.2 2019/01/27 02:08:39 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_16_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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_16_init(void)
+{
+ int error = 0;
+
+ error = kern_sig_16_init();
+ if (error != 0)
+ return error;
+
+ return error;
+}
+
+int
+compat_16_fini(void)
+{
+ int error = 0;
+
+ error = kern_sig_16_fini();
+ if (error != 0) {
+ return error;
+ }
+
+ return error;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_16, "compat_20");
+
+static int
+compat_16_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_16_init();
+ case MODULE_CMD_FINI:
+ return compat_16_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_20_mod.c b/sys/compat/common/compat_20_mod.c
new file mode 100644
index 00000000000..036d38e0c93
--- /dev/null
+++ b/sys/compat/common/compat_20_mod.c
@@ -0,0 +1,99 @@
+/* $NetBSD: compat_20_mod.c,v 1.2 2019/01/27 02:08:39 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_20_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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_20_init(void)
+{
+ int error = 0;
+
+ error = vfs_syscalls_20_init();
+ if (error != 0)
+ return error;
+
+ if43_20_init();
+ ieee80211_20_init();
+
+ return error;
+}
+
+int
+compat_20_fini(void)
+{
+ int error = 0;
+
+ ieee80211_20_fini();
+ if43_20_fini();
+
+ error = vfs_syscalls_20_fini();
+ if (error != 0) {
+ if43_20_init();
+ ieee80211_20_init();
+ }
+
+ return error;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_20, "compat_30");
+
+static int
+compat_20_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_20_init();
+ case MODULE_CMD_FINI:
+ return compat_20_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_30_mod.c b/sys/compat/common/compat_30_mod.c
new file mode 100644
index 00000000000..72e4fb11534
--- /dev/null
+++ b/sys/compat/common/compat_30_mod.c
@@ -0,0 +1,119 @@
+/* $NetBSD: compat_30_mod.c,v 1.2 2019/01/27 02:08:39 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_30_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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 <dev/biovar.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+int
+compat_30_init(void)
+{
+ int error = 0;
+
+ error = vfs_syscalls_30_init();
+ if (error != 0)
+ return error;
+
+ error = kern_time_30_init();
+ if (error != 0) {
+ vfs_syscalls_30_fini();
+ return error;
+ }
+ bio_30_init();
+ vnd_30_init();
+ usb_30_init();
+
+ return error;
+}
+
+int
+compat_30_fini(void)
+{
+ int error = 0;
+
+ usb_30_fini();
+ vnd_30_fini();
+ bio_30_fini();
+
+ error = kern_time_30_fini();
+ if (error != 0)
+ goto err1;
+
+ error = vfs_syscalls_30_fini();
+ if (error != 0)
+ goto err2;
+
+ return 0;
+
+ err2:
+ kern_time_30_init();
+ err1:
+ bio_30_init();
+ vnd_30_init();
+ usb_30_init();
+
+ return error;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_30, "compat_util,compat_40");
+
+static int
+compat_30_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_30_init();
+ case MODULE_CMD_FINI:
+ return compat_30_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_40_mod.c b/sys/compat/common/compat_40_mod.c
new file mode 100644
index 00000000000..eb9ade409ce
--- /dev/null
+++ b/sys/compat/common/compat_40_mod.c
@@ -0,0 +1,97 @@
+/* $NetBSD: compat_40_mod.c,v 1.2 2019/01/27 02:08:39 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.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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_40_init(void)
+{
+ int error = 0;
+
+ error = vfs_syscalls_40_init();
+ if (error != 0)
+ return error;
+ uipc_syscalls_40_init();
+ sysmon_power_40_init();
+
+ return error;
+}
+
+int
+compat_40_fini(void)
+{
+ int error = 0;
+
+ sysmon_power_40_fini();
+ uipc_syscalls_40_fini();
+ error = vfs_syscalls_40_fini();
+ if (error != 0) {
+ uipc_syscalls_40_init();
+ sysmon_power_40_init();
+ }
+
+ return error;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_40, "compat_50");
+
+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_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_43_mod.c b/sys/compat/common/compat_43_mod.c
new file mode 100644
index 00000000000..a66819a182c
--- /dev/null
+++ b/sys/compat/common/compat_43_mod.c
@@ -0,0 +1,194 @@
+/* $NetBSD: compat_43_mod.c,v 1.2 2019/01/27 02:08:39 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_43_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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_43_init(void)
+{
+ int error;
+
+ error = kern_exit_43_init();
+ if (error != 0)
+ return error;
+
+ error = kern_info_43_init();
+ if (error != 0)
+ goto out8;
+
+ error = kern_resource_43_init();
+ if (error != 0)
+ goto out7;
+
+ error = kern_sig_43_init();
+ if (error != 0)
+ goto out6;
+
+ error = tty_43_init();
+ if (error != 0)
+ goto out5;
+
+ error = uipc_syscalls_43_init();
+ if (error != 0)
+ goto out4;
+
+ error = vfs_syscalls_43_init();
+ if (error != 0)
+ goto out3;
+
+ error = vm_43_init();
+ if (error != 0)
+ goto out2;
+
+ error = if_43_init();
+ if (error != 0)
+ goto out1;
+
+ return 0;
+
+ out1:
+ vm_43_fini();
+ out2:
+ vfs_syscalls_43_fini();
+ out3:
+ uipc_syscalls_43_fini();
+ out4:
+ tty_43_fini();
+ out5:
+ kern_sig_43_fini();
+ out6:
+ kern_resource_43_fini();
+ out7:
+ kern_info_43_fini();
+ out8:
+ kern_exit_43_fini();
+
+ return error;
+}
+
+int
+compat_43_fini(void)
+{
+ int error;
+
+ error = if_43_fini();
+ if (error != 0)
+ return error;
+
+ error = vm_43_fini();
+ if (error != 0)
+ goto out8;
+
+ error = vfs_syscalls_43_fini();
+ if (error != 0)
+ goto out7;
+
+ error = uipc_syscalls_43_fini();
+ if (error != 0)
+ goto out6;
+
+ error = tty_43_fini();
+ if (error != 0)
+ goto out5;
+
+ error = kern_sig_43_fini();
+ if (error != 0)
+ goto out4;
+
+ error = kern_resource_43_fini();
+ if (error != 0)
+ goto out3;
+
+ error = kern_info_43_fini();
+ if (error != 0)
+ goto out2;
+
+ error = kern_exit_43_fini();
+ if (error != 0)
+ goto out1;
+
+ return 0;
+
+ out1:
+ kern_info_43_init();
+ out2:
+ kern_resource_43_init();
+ out3:
+ kern_sig_43_init();
+ out4:
+ tty_43_init();
+ out5:
+ uipc_syscalls_43_init();
+ out6:
+ vfs_syscalls_43_init();
+ out7:
+ vm_43_init();
+ out8:
+ if_43_init();
+
+ return error;
+}
+
+/*
+ * XXX We "require" the compat_60 module to ensure proper ordering of
+ * XXX vectoring the ttcompatvec replacement routine!
+ */
+MODULE(MODULE_CLASS_EXEC, compat_43,
+ "compat_sysctl_09_43,compat_util,compat_60");
+
+static int
+compat_43_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_43_init();
+ case MODULE_CMD_FINI:
+ return compat_43_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_50_mod.c b/sys/compat/common/compat_50_mod.c
new file mode 100644
index 00000000000..bfa90f8b60b
--- /dev/null
+++ b/sys/compat/common/compat_50_mod.c
@@ -0,0 +1,173 @@
+/* $NetBSD: compat_50_mod.c,v 1.2 2019/01/27 02:08:39 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_50_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.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/sys/clockctl.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+#include <compat/common/if_spppsubr50.h>
+
+#include <dev/wscons/wsevent_50.h>
+
+#include <fs/puffs/puffs_sys.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();
+ uipc_syscalls_50_init();
+ clockctl_50_init();
+ if_spppsubr_50_init();
+ puffs_50_init();
+ wsevent_50_init();
+ vnd_50_init();
+ rndpseudo_50_init();
+ rtsock_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;
+
+ rtsock_50_fini();
+ rndpseudo_50_fini();
+ vnd_50_fini();
+ wsevent_50_fini();
+ puffs_50_fini();
+ if_spppsubr_50_fini();
+ clockctl_50_fini();
+ uipc_syscalls_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();
+ uipc_syscalls_50_init();
+ clockctl_50_init();
+ if_spppsubr_50_init();
+ puffs_50_init();
+ wsevent_50_init();
+ vnd_50_init();
+ rndpseudo_50_init();
+ rtsock_50_init();
+
+ return error;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_50, "compat_60");
+
+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_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_60_mod.c b/sys/compat/common/compat_60_mod.c
new file mode 100644
index 00000000000..5a76480532e
--- /dev/null
+++ b/sys/compat/common/compat_60_mod.c
@@ -0,0 +1,130 @@
+/* $NetBSD: compat_60_mod.c,v 1.2 2019/01/27 02:08:39 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.
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.2 2019/01/27 02:08:39 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/sys/ccdvar.h>
+#include <compat/sys/cpuio.h>
+
+int
+compat_60_init(void)
+{
+ int error = 0;
+
+ error = kern_time_60_init();
+ if (error != 0)
+ return error;
+
+ error = kern_sa_60_init();
+ if (error != 0) {
+ kern_time_60_fini();
+ return 0;
+ }
+
+ kern_tty_60_init();
+ ccd_60_init();
+#ifdef CPU_UCODE
+ kern_cpu_60_init();
+#endif
+
+ return error;
+}
+
+int
+compat_60_fini(void)
+{
+ int error = 0;
+
+#ifdef CPU_UCODE
+ kern_cpu_60_fini();
+#endif
+ ccd_60_fini();
+ kern_tty_60_fini();
+
+
+ error = kern_sa_60_fini();
+ if (error != 0) {
+ kern_tty_60_init();
+ ccd_60_init();
+#ifdef CPU_UCODE
+ kern_cpu_60_init();
+#endif
+ return error;
+ }
+
+ error = kern_time_60_fini();
+ if (error != 0) {
+ kern_sa_60_init();
+ kern_tty_60_init();
+ ccd_60_init();
+#ifdef CPU_UCODE
+ kern_cpu_60_init();
+#endif
+ return error;
+ }
+
+ return error;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_60, "compat_70");
+
+static int
+compat_60_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_60_init();
+ case MODULE_CMD_FINI:
+ return compat_60_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_70_mod.c b/sys/compat/common/compat_70_mod.c
new file mode 100644
index 00000000000..e21ea0144b4
--- /dev/null
+++ b/sys/compat/common/compat_70_mod.c
@@ -0,0 +1,93 @@
+/* $NetBSD: compat_70_mod.c,v 1.2 2019/01/27 02:08:39 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.
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_70_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#include <sys/systm.h>
+#include <sys/module.h>
+
+#include <net/if.h>
+#include <net/route.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+#include <compat/sys/sockio.h>
+#include <compat/sys/socket.h>
+
+#include <compat/net/route.h>
+#include <compat/net/route_70.h>
+
+int compat_70_init(void)
+{
+
+ compat70_ocreds_valid = true;
+ rtsock_70_init();
+ uipc_usrreq_70_init();
+
+ return 0;
+}
+
+int compat_70_fini(void)
+{
+
+ uipc_usrreq_70_fini();
+ rtsock_70_fini();
+ compat70_ocreds_valid = false;
+
+ return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_70, "compat_80");
+
+static int
+compat_70_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_70_init();
+
+ case MODULE_CMD_FINI:
+ return compat_70_fini();
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_80_mod.c b/sys/compat/common/compat_80_mod.c
new file mode 100644
index 00000000000..33564904504
--- /dev/null
+++ b/sys/compat/common/compat_80_mod.c
@@ -0,0 +1,81 @@
+/* $NetBSD: compat_80_mod.c,v 1.2 2019/01/27 02:08:39 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.
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#include <sys/systm.h>
+#include <sys/module.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+int compat_80_init(void)
+{
+
+ kern_mod_80_init();
+
+ return 0;
+}
+
+int compat_80_fini(void)
+{
+
+ kern_mod_80_fini();
+
+ return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_80, NULL);
+
+static int
+compat_80_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_80_init();
+
+ case MODULE_CMD_FINI:
+ return compat_80_fini();
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_exec.c b/sys/compat/common/compat_exec.c
index fec5daade02..865ceaa3bb2 100644
--- a/sys/compat/common/compat_exec.c
+++ b/sys/compat/common/compat_exec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_exec.c,v 1.17 2009/08/15 23:39:35 matt Exp $ */
+/* $NetBSD: compat_exec.c,v 1.18 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,9 +31,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_exec.c,v 1.17 2009/08/15 23:39:35 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_exec.c,v 1.18 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
#include "opt_execfmt.h"
#endif
diff --git a/sys/compat/common/compat_mod.c b/sys/compat/common/compat_mod.c
index 32656a2090a..f9bf8c42a96 100644
--- a/sys/compat/common/compat_mod.c
+++ b/sys/compat/common/compat_mod.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.c,v 1.29 2018/05/04 08:55:25 pgoyette Exp $ */
+/* $NetBSD: compat_mod.c,v 1.30 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,14 +34,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.29 2018/05/04 08:55:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.30 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
#include "opt_compat_43.h"
-#include "opt_ntp.h"
-#include "opt_sysv.h"
-#include "opt_lfs.h"
#endif
#include <sys/systm.h>
@@ -52,319 +49,111 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.29 2018/05/04 08:55:25 pgoyette Exp
#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>
-#include <compat/common/if_43.h>
-#include <compat/sys/uvm.h>
-#include <compat/sys/cpuio.h>
-#include <compat/sys/ccdvar.h>
-#include <compat/sys/sockio.h>
-
-#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
-static struct sysctllog *compat_clog = NULL;
#endif
MODULE(MODULE_CLASS_EXEC, compat, NULL);
-int ttcompat(struct tty *, u_long, void *, int, struct lwp *);
-
-#ifdef COMPAT_16
-#if !defined(__amd64__) || defined(COMPAT_NETBSD32)
-#define COMPAT_SIGCONTEXT
-extern char sigcode[], esigcode[];
-struct uvm_object *emul_netbsd_object;
-#endif /* !defined(__amd64__) || defined(COMPAT_NETBSD32) */
-#endif /* COMPAT_16 */
-
-extern krwlock_t exec_lock;
extern krwlock_t ttcompat_lock;
-static const struct syscall_package compat_syscalls[] = {
-#if defined(COMPAT_43)
- { SYS_compat_43_fstat43, 0, (sy_call_t *)compat_43_sys_fstat },
- { SYS_compat_43_lstat43, 0, (sy_call_t *)compat_43_sys_lstat },
- { SYS_compat_43_oaccept, 0, (sy_call_t *)compat_43_sys_accept },
- { SYS_compat_43_ocreat, 0, (sy_call_t *)compat_43_sys_creat },
- { SYS_compat_43_oftruncate, 0, (sy_call_t *)compat_43_sys_ftruncate },
- { SYS_compat_43_ogetdirentries, 0, (sy_call_t *)compat_43_sys_getdirentries },
- { SYS_compat_43_ogetdtablesize, 0, (sy_call_t *)compat_43_sys_getdtablesize },
- { SYS_compat_43_ogethostid, 0, (sy_call_t *)compat_43_sys_gethostid },
- { SYS_compat_43_ogethostname, 0, (sy_call_t *)compat_43_sys_gethostname },
- { SYS_compat_43_ogetkerninfo, 0, (sy_call_t *)compat_43_sys_getkerninfo },
- { SYS_compat_43_ogetpagesize, 0, (sy_call_t *)compat_43_sys_getpagesize },
- { SYS_compat_43_ogetpeername, 0, (sy_call_t *)compat_43_sys_getpeername },
- { SYS_compat_43_ogetrlimit, 0, (sy_call_t *)compat_43_sys_getrlimit },
- { SYS_compat_43_ogetsockname, 0, (sy_call_t *)compat_43_sys_getsockname },
- { SYS_compat_43_okillpg, 0, (sy_call_t *)compat_43_sys_killpg },
- { SYS_compat_43_olseek, 0, (sy_call_t *)compat_43_sys_lseek },
- { SYS_compat_43_ommap, 0, (sy_call_t *)compat_43_sys_mmap },
- { SYS_compat_43_oquota, 0, (sy_call_t *)compat_43_sys_quota },
- { SYS_compat_43_orecv, 0, (sy_call_t *)compat_43_sys_recv },
- { SYS_compat_43_orecvfrom, 0, (sy_call_t *)compat_43_sys_recvfrom },
- { SYS_compat_43_orecvmsg, 0, (sy_call_t *)compat_43_sys_recvmsg },
- { SYS_compat_43_osend, 0, (sy_call_t *)compat_43_sys_send },
- { SYS_compat_43_osendmsg, 0, (sy_call_t *)compat_43_sys_sendmsg },
- { SYS_compat_43_osethostid, 0, (sy_call_t *)compat_43_sys_sethostid },
- { SYS_compat_43_osethostname, 0, (sy_call_t *)compat_43_sys_sethostname },
- { SYS_compat_43_osetrlimit, 0, (sy_call_t *)compat_43_sys_setrlimit },
- { SYS_compat_43_osigblock, 0, (sy_call_t *)compat_43_sys_sigblock },
- { SYS_compat_43_osigsetmask, 0, (sy_call_t *)compat_43_sys_sigsetmask },
- { SYS_compat_43_osigstack, 0, (sy_call_t *)compat_43_sys_sigstack },
- { SYS_compat_43_osigvec, 0, (sy_call_t *)compat_43_sys_sigvec },
- { SYS_compat_43_otruncate, 0, (sy_call_t *)compat_43_sys_truncate },
- { SYS_compat_43_owait, 0, (sy_call_t *)compat_43_sys_wait },
- { SYS_compat_43_stat43, 0, (sy_call_t *)compat_43_sys_stat },
+struct compat_init_fini {
+ int (*init)(void);
+ int (*fini)(void);
+} init_fini_list[] = {
+#ifdef COMPAT_80
+ { compat_80_init, compat_80_fini },
#endif
-
-#if defined(COMPAT_09)
- { SYS_compat_09_ogetdomainname, 0, (sy_call_t *)compat_09_sys_getdomainname },
- { SYS_compat_09_osetdomainname, 0, (sy_call_t *)compat_09_sys_setdomainname },
- { SYS_compat_09_ouname, 0, (sy_call_t *)compat_09_sys_uname },
+#ifdef COMPAT_70
+ { compat_70_init, compat_70_fini },
#endif
-
-#if defined(COMPAT_12)
- { SYS_compat_12_fstat12, 0, (sy_call_t *)compat_12_sys_fstat },
- { SYS_compat_12_getdirentries, 0, (sy_call_t *)compat_12_sys_getdirentries },
- { SYS_compat_12_lstat12, 0, (sy_call_t *)compat_12_sys_lstat },
- { SYS_compat_12_msync, 0, (sy_call_t *)compat_12_sys_msync },
- { SYS_compat_12_oreboot, 0, (sy_call_t *)compat_12_sys_reboot },
- { SYS_compat_12_oswapon, 0, (sy_call_t *)compat_12_sys_swapon },
- { SYS_compat_12_stat12, 0, (sy_call_t *)compat_12_sys_stat },
+#ifdef COMPAT_60
+ { compat_60_init, compat_60_fini },
#endif
-
-#if defined(COMPAT_13)
- { SYS_compat_13_sigaction13, 0, (sy_call_t *)compat_13_sys_sigaction },
- { SYS_compat_13_sigaltstack13, 0, (sy_call_t *)compat_13_sys_sigaltstack },
- { SYS_compat_13_sigpending13, 0, (sy_call_t *)compat_13_sys_sigpending },
- { SYS_compat_13_sigprocmask13, 0, (sy_call_t *)compat_13_sys_sigprocmask },
- { SYS_compat_13_sigreturn13, 0, (sy_call_t *)compat_13_sys_sigreturn },
- { SYS_compat_13_sigsuspend13, 0, (sy_call_t *)compat_13_sys_sigsuspend },
+#ifdef COMPAT_50
+ { compat_50_init, compat_50_fini },
#endif
-
-#if defined(COMPAT_16)
-#if defined(COMPAT_SIGCONTEXT)
- { SYS_compat_16___sigaction14, 0, (sy_call_t *)compat_16_sys___sigaction14 },
- { SYS_compat_16___sigreturn14, 0, (sy_call_t *)compat_16_sys___sigreturn14 },
+#ifdef COMPAT_40
+ { compat_40_init, compat_40_fini },
#endif
+#ifdef COMPAT_30
+ { compat_30_init, compat_30_fini },
#endif
-
-#if defined(COMPAT_20)
- { SYS_compat_20_fhstatfs, 0, (sy_call_t *)compat_20_sys_fhstatfs },
- { SYS_compat_20_fstatfs, 0, (sy_call_t *)compat_20_sys_fstatfs },
- { SYS_compat_20_getfsstat, 0, (sy_call_t *)compat_20_sys_getfsstat },
- { SYS_compat_20_statfs, 0, (sy_call_t *)compat_20_sys_statfs },
+#ifdef COMPAT_20
+ { compat_20_init, compat_20_fini },
#endif
-
-#if defined(COMPAT_30)
- { SYS_compat_30___fhstat30, 0, (sy_call_t *)compat_30_sys___fhstat30 },
- { SYS_compat_30___fstat13, 0, (sy_call_t *)compat_30_sys___fstat13 },
- { SYS_compat_30___lstat13, 0, (sy_call_t *)compat_30_sys___lstat13 },
- { SYS_compat_30___stat13, 0, (sy_call_t *)compat_30_sys___stat13 },
- { SYS_compat_30_fhopen, 0, (sy_call_t *)compat_30_sys_fhopen },
- { SYS_compat_30_fhstat, 0, (sy_call_t *)compat_30_sys_fhstat },
- { SYS_compat_30_fhstatvfs1, 0, (sy_call_t *)compat_30_sys_fhstatvfs1 },
- { SYS_compat_30_getdents, 0, (sy_call_t *)compat_30_sys_getdents },
- { SYS_compat_30_getfh, 0, (sy_call_t *)compat_30_sys_getfh },
- { SYS_compat_30_socket, 0, (sy_call_t *)compat_30_sys_socket },
+#ifdef COMPAT_16
+ { compat_16_init, compat_16_fini },
#endif
-
-#if defined(COMPAT_40)
- { SYS_compat_40_mount, 0, (sy_call_t *)compat_40_sys_mount },
+#ifdef COMPAT_14
+ { compat_14_init, compat_14_fini },
#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 },
+#ifdef COMPAT_13
+ { compat_13_init, compat_13_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_12
+ { compat_12_init, compat_12_fini },
#endif
-#if defined(COMPAT_60)
- { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },
+#ifdef COMPAT_10
+ { compat_10_init, compat_10_fini },
+#endif
+#if defined(COMPAT_09) || defined(COMPAT_43)
+ { compat_sysctl_09_43_init, compat_sysctl_09_43_fini },
+#endif
+#ifdef COMPAT_09
+ { compat_09_init, compat_09_fini },
+# endif
+#ifdef COMPAT_43
+ { compat_43_init, compat_43_fini },
#endif
- { 0, 0, NULL },
};
static int
compat_modcmd(modcmd_t cmd, void *arg)
{
-#ifdef COMPAT_16
- proc_t *p;
-#endif
int error;
+ int i, j;
switch (cmd) {
case MODULE_CMD_INIT:
- error = syscall_establish(NULL, compat_syscalls);
- if (error != 0) {
- return error;
+ /*
+ * Call the init() routine for all components; if
+ * any component fails, disable (via fini() routine)
+ * those which had already been disabled before we
+ * return to prevent partial module initialization.
+ */
+ for (i = 0; i < __arraycount(init_fini_list); i++) {
+ error = (*init_fini_list[i].init)();
+ if (error != 0) {
+ for (j = i - 1; j >= 0; j--) {
+ (*init_fini_list[j].fini)();
+ }
+ return error;
+ }
}
-#ifdef COMPAT_43
- KASSERT(ttcompatvec == NULL);
- ttcompatvec = ttcompat;
- if_43_init();
-#endif
-#ifdef COMPAT_13
- uvm_13_init();
-#endif
-#ifdef COMPAT_16
-#if defined(COMPAT_SIGCONTEXT)
- KASSERT(emul_netbsd.e_sigobject == NULL);
- rw_enter(&exec_lock, RW_WRITER);
- emul_netbsd.e_sigcode = sigcode;
- emul_netbsd.e_esigcode = esigcode;
- emul_netbsd.e_sigobject = &emul_netbsd_object;
- rw_exit(&exec_lock);
- KASSERT(sendsig_sigcontext_vec == NULL);
- sendsig_sigcontext_vec = sendsig_sigcontext;
-#endif
-#endif
- compat_sysctl_init();
-#ifdef COMPAT_40
- uipc_syscalls_40_init();
-#endif
-#ifdef COMPAT_50
- uipc_syscalls_50_init();
- uvm_50_init();
-#endif
-#ifdef COMPAT_60
- kern_cpu_60_init();
- ccd_60_init();
-#endif
+
return 0;
case MODULE_CMD_FINI:
-#ifdef COMPAT_13
- uvm_13_fini();
-#endif
-#ifdef COMPAT_16
/*
- * Ensure sendsig_sigcontext() is not being used.
- * module_lock prevents the flag being set on any
- * further processes while we are here. See
- * sigaction1() for the opposing half.
+ * Disable included components in reverse order;
+ * if any component fails to fini(), re-init those
+ * components which had already been disabled
*/
- mutex_enter(proc_lock);
- PROCLIST_FOREACH(p, &allproc) {
- if ((p->p_lflag & PL_SIGCOMPAT) != 0) {
- break;
+ for (i = __arraycount(init_fini_list) - 1; i >= 0; i--) {
+ error = (*init_fini_list[i].fini)();
+ if (error != 0) {
+ for (j = i + 1;
+ j < __arraycount(init_fini_list); j++) {
+ (*init_fini_list[j].init)();
+ }
+ return error;
}
}
- mutex_exit(proc_lock);
- if (p != NULL) {
- return EBUSY;
- }
- sendsig_sigcontext_vec = NULL;
-#endif
- /* Unlink the system calls. */
- error = syscall_disestablish(NULL, compat_syscalls);
- if (error != 0) {
- return error;
- }
-#ifdef COMPAT_43
- /* Unlink ttcompatvec. */
- if (rw_tryenter(&ttcompat_lock, RW_WRITER)) {
- ttcompatvec = NULL;
- rw_exit(&ttcompat_lock);
- } else {
- error = syscall_establish(NULL, compat_syscalls);
- KASSERT(error == 0);
- return EBUSY;
- }
-#endif
-#ifdef COMPAT_16
-#if defined(COMPAT_SIGCONTEXT)
- /*
- * The sigobject may persist if still in use, but
- * is reference counted so will die eventually.
- */
- rw_enter(&exec_lock, RW_WRITER);
- if (emul_netbsd_object != NULL) {
- (*emul_netbsd_object->pgops->pgo_detach)
- (emul_netbsd_object);
- }
- emul_netbsd_object = NULL;
- emul_netbsd.e_sigcode = NULL;
- emul_netbsd.e_esigcode = NULL;
- emul_netbsd.e_sigobject = NULL;
- rw_exit(&exec_lock);
-#endif
-#endif /* COMPAT_16 */
- compat_sysctl_fini();
-#ifdef COMPAT_40
- uipc_syscalls_40_fini();
-#endif
-#ifdef COMPAT_50
- uipc_syscalls_50_fini();
- uvm_50_fini();
-#endif
-#ifdef COMPAT_60
- kern_cpu_60_fini();
- ccd_60_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
-#if defined(COMPAT_43)
- if_43_fini();
-#endif
-}
diff --git a/sys/compat/common/compat_mod.h b/sys/compat/common/compat_mod.h
index 1f8e668f46b..1cbf9f0e80f 100644
--- a/sys/compat/common/compat_mod.h
+++ b/sys/compat/common/compat_mod.h
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.h,v 1.1 2013/02/21 01:39:54 pgoyette Exp $ */
+/* $NetBSD: compat_mod.h,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,10 +32,165 @@
#ifndef _COMPAT_MOD_H
#define _COMPAT_MOD_H
-void compat_sysctl_init(void);
-void compat_sysctl_fini(void);
+#ifdef COMPAT_80
+int compat_80_init(void);
+int compat_80_fini(void);
+void kern_mod_80_init(void);
+void kern_mod_80_fini(void);
+#endif
-void compat_sysctl_time(struct sysctllog **);
-void compat_sysctl_vfs(struct sysctllog **);
+#ifdef COMPAT_70
+int compat_70_init(void);
+int compat_70_fini(void);
+#endif
+
+#ifdef COMPAT_60
+int compat_60_init(void);
+int compat_60_fini(void);
+int kern_time_60_init(void);
+int kern_time_60_fini(void);
+int kern_sa_60_init(void);
+int kern_sa_60_fini(void);
+void kern_tty_60_init(void);
+void kern_tty_60_fini(void);
+#endif
+
+#ifdef COMPAT_50
+int compat_50_init(void);
+int compat_50_fini(void);
+int kern_50_init(void);
+int kern_50_fini(void);
+int kern_time_50_init(void);
+int kern_time_50_fini(void);
+int kern_select_50_init(void);
+int kern_select_50_fini(void);
+void uvm_50_init(void);
+void uvm_50_fini(void);
+int vfs_syscalls_50_init(void);
+int vfs_syscalls_50_fini(void);
+void uipc_syscalls_50_init(void);
+void uipc_syscalls_50_fini(void);
+void vnd_50_init(void);
+void vnd_50_fini(void);
+void rndpseudo_50_init(void);
+void rndpseudo_50_fini(void);
+void rtsock_50_init(void);
+void rtsock_50_fini(void);
+#endif
+
+#ifdef COMPAT_40
+int compat_40_init(void);
+int compat_40_fini(void);
+void uipc_syscalls_40_init(void);
+void uipc_syscalls_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
+
+#ifdef COMPAT_30
+int compat_30_init(void);
+int compat_30_fini(void);
+int kern_time_30_init(void);
+int kern_time_30_fini(void);
+int vfs_syscalls_30_init(void);
+int vfs_syscalls_30_fini(void);
+int uipc_syscalls_30_init(void);
+int uipc_syscalls_30_fini(void);
+void bio_30_init(void);
+void bio_30_fini(void);
+void vnd_30_init(void);
+void vnd_30_fini(void);
+void usb_30_init(void);
+void usb_30_fini(void);
+#endif
+
+#ifdef COMPAT_20
+int compat_20_init(void);
+int compat_20_fini(void);
+int vfs_syscalls_20_init(void);
+int vfs_syscalls_20_fini(void);
+void ieee80211_20_init(void);
+void ieee80211_20_fini(void);
+void if43_20_init(void);
+void if43_20_fini(void);
+#endif
+
+#ifdef COMPAT_16
+int compat_16_init(void);
+int compat_16_fini(void);
+int kern_sig_16_init(void);
+int kern_sig_16_fini(void);
+#endif
+
+#ifdef COMPAT_14
+int compat_14_init(void);
+int compat_14_fini(void);
+void rtsock_14_init(void);
+void rtsock_14_fini(void);
+#endif
+
+#ifdef COMPAT_13
+int compat_13_init(void);
+int compat_13_fini(void);
+int kern_sig_13_init(void);
+int kern_sig_13_fini(void);
+void uvm_13_init(void);
+void uvm_13_fini(void);
+#endif
+
+#ifdef COMPAT_12
+int compat_12_init(void);
+int compat_12_fini(void);
+int kern_xxx_12_init(void);
+int kern_xxx_12_fini(void);
+int vm_12_init(void);
+int vm_12_fini(void);
+int vfs_syscalls_12_init(void);
+int vfs_syscalls_12_fini(void);
+#endif
+
+#ifdef COMPAT_10
+int compat_10_init(void);
+int compat_10_fini(void);
+void vfs_syscalls_10_init(void);
+void vfs_syscalls_10_fini(void);
+#endif
+
+#ifdef COMPAT_09
+int compat_09_init(void);
+int compat_09_fini(void);
+int kern_info_09_init(void);
+int kern_info_09_fini(void);
+#endif
+
+#ifdef COMPAT_43
+int compat_43_init(void);
+int compat_43_fini(void);
+int kern_exit_43_init(void);
+int kern_exit_43_fini(void);
+int kern_info_43_init(void);
+int kern_info_43_fini(void);
+int kern_resource_43_init(void);
+int kern_resource_43_fini(void);
+int kern_sig_43_init(void);
+int kern_sig_43_fini(void);
+int tty_43_init(void);
+int tty_43_fini(void);
+int uipc_syscalls_43_init(void);
+int uipc_syscalls_43_fini(void);
+int vfs_syscalls_43_init(void);
+int vfs_syscalls_43_fini(void);
+int vm_43_init(void);
+int vm_43_fini(void);
+int if_43_init(void);
+int if_43_fini(void);
+#endif
+
+#if defined(COMPAT_09) || defined(COMPAT_43)
+int compat_sysctl_09_43_init(void);
+int compat_sysctl_09_43_fini(void);
+#endif
#endif /* !_COMPAT_MOD_H_ */
diff --git a/sys/compat/common/compat_sysctl_09_43.c b/sys/compat/common/compat_sysctl_09_43.c
new file mode 100644
index 00000000000..3f608954126
--- /dev/null
+++ b/sys/compat/common/compat_sysctl_09_43.c
@@ -0,0 +1,163 @@
+/* $NetBSD: compat_sysctl_09_43.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, 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. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/filedesc.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/malloc.h>
+#include <sys/sysctl.h>
+#include <sys/module.h>
+
+#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+#include <sys/vfs_syscalls.h>
+
+#include <compat/sys/mount.h>
+#include <compat/common/compat_mod.h>
+
+/*
+ * sysctl helper routine for vfs.generic.conf lookups.
+ */
+#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44)
+
+static int
+sysctl_vfs_generic_conf(SYSCTLFN_ARGS)
+{
+ struct vfsconf vfc;
+ struct sysctlnode node;
+ struct vfsops *vfsp;
+ u_int vfsnum;
+
+ if (namelen != 1)
+ return (ENOTDIR);
+ vfsnum = name[0];
+ if (vfsnum >= nmountcompatnames ||
+ mountcompatnames[vfsnum] == NULL)
+ return (EOPNOTSUPP);
+ vfsp = vfs_getopsbyname(mountcompatnames[vfsnum]);
+ if (vfsp == NULL)
+ return (EOPNOTSUPP);
+
+ vfc.vfc_vfsops = vfsp;
+ strncpy(vfc.vfc_name, vfsp->vfs_name, sizeof(vfc.vfc_name));
+ vfc.vfc_typenum = vfsnum;
+ vfc.vfc_refcount = vfsp->vfs_refcount;
+ vfc.vfc_flags = 0;
+ vfc.vfc_mountroot = vfsp->vfs_mountroot;
+ vfc.vfc_next = NULL;
+ vfs_delref(vfsp);
+
+ node = *rnode;
+ node.sysctl_data = &vfc;
+ return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+}
+
+/*
+ * Top level filesystem related information gathering.
+ */
+static int
+compat_sysctl_vfs(struct sysctllog **clog)
+{
+ int error;
+
+ error = 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);
+ if (error == EEXIST)
+ error = 0;
+ if (error != 0)
+ return error;
+
+ error = sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_STRUCT, "conf",
+ SYSCTL_DESCR("Filesystem configuration information"),
+ sysctl_vfs_generic_conf, 0, NULL,
+ sizeof(struct vfsconf),
+ CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL);
+
+ return error;
+}
+#endif
+
+static struct sysctllog *clog = NULL;
+
+int
+compat_sysctl_09_43_init(void)
+{
+
+ return compat_sysctl_vfs(&clog);
+}
+
+int
+compat_sysctl_09_43_fini(void)
+{
+
+ sysctl_teardown(&clog);
+ return 0;
+}
+
+MODULE (MODULE_CLASS_EXEC, compat_sysctl_09_43, NULL);
+
+static int
+compat_sysctl_09_43_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_sysctl_09_43_init();
+ case MODULE_CMD_FINI:
+ return compat_sysctl_09_43_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_sysv_10_mod.c b/sys/compat/common/compat_sysv_10_mod.c
new file mode 100644
index 00000000000..c77a0340eb3
--- /dev/null
+++ b/sys/compat/common/compat_sysv_10_mod.c
@@ -0,0 +1,93 @@
+/* $NetBSD: compat_sysv_10_mod.c,v 1.2 2019/01/27 02:08:39 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_10_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_sysv.h"
+#endif
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/syscall.h>
+#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
+#include <sys/sysctl.h>
+
+MODULE(MODULE_CLASS_EXEC, compat_sysv_10,
+ "sysv_ipc,compat_sysv_50,compat_sysv_14");
+
+/* Build the syscall package based on options specified */
+
+static const struct syscall_package compat_sysv_10_syscalls[] = {
+#if !defined(_LP64)
+#ifdef SYSVSHM
+ { SYS_compat_10_oshmsys, 0, (sy_call_t *)compat_10_sys_shmsys },
+#endif
+#ifdef SYSVSEM
+ { SYS_compat_10_osemsys, 0, (sy_call_t *)compat_10_sys_semsys },
+#endif
+#ifdef SYSVMSG
+ { SYS_compat_10_omsgsys, 0, (sy_call_t *)compat_10_sys_msgsys },
+#endif
+#endif /* !defined(_LP64) */
+ { 0, 0, NULL }
+};
+
+static int
+compat_sysv_10_modcmd(modcmd_t cmd, void *arg)
+{
+
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = syscall_establish(NULL, compat_sysv_10_syscalls);
+ if (error != 0) {
+ break;
+ }
+ break;
+
+ case MODULE_CMD_FINI:
+ error = syscall_disestablish(NULL, compat_sysv_10_syscalls);
+ if (error != 0) {
+ break;
+ }
+ break;
+
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
diff --git a/sys/compat/common/compat_sysv_14_mod.c b/sys/compat/common/compat_sysv_14_mod.c
new file mode 100644
index 00000000000..fc3105765ba
--- /dev/null
+++ b/sys/compat/common/compat_sysv_14_mod.c
@@ -0,0 +1,90 @@
+/* $NetBSD: compat_sysv_14_mod.c,v 1.2 2019/01/27 02:08:39 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_14_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_sysv.h"
+#endif
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/syscall.h>
+#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
+#include <sys/sysctl.h>
+
+MODULE(MODULE_CLASS_EXEC, compat_sysv_14, "compat_sysv_50,sysv_ipc");
+
+/* Build the syscall package based on options specified */
+
+static const struct syscall_package compat_sysv_14_syscalls[] = {
+#ifdef SYSVSHM
+ { SYS_compat_14_shmctl, 0, (sy_call_t *)compat_14_sys_shmctl },
+#endif
+#ifdef SYSVSEM
+ { SYS_compat_14___semctl, 0, (sy_call_t *)compat_14_sys___semctl },
+#endif
+#ifdef SYSVMSG
+ { SYS_compat_14_msgctl, 0, (sy_call_t *)compat_14_sys_msgctl },
+#endif
+ { 0, 0, NULL }
+};
+
+static int
+compat_sysv_14_modcmd(modcmd_t cmd, void *arg)
+{
+
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = syscall_establish(NULL, compat_sysv_14_syscalls);
+ if (error != 0) {
+ break;
+ }
+ break;
+
+ case MODULE_CMD_FINI:
+ error = syscall_disestablish(NULL, compat_sysv_14_syscalls);
+ if (error != 0) {
+ break;
+ }
+ break;
+
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
diff --git a/sys/compat/common/compat_sysv_50_mod.c b/sys/compat/common/compat_sysv_50_mod.c
new file mode 100644
index 00000000000..e58803d495f
--- /dev/null
+++ b/sys/compat/common/compat_sysv_50_mod.c
@@ -0,0 +1,95 @@
+/* $NetBSD: compat_sysv_50_mod.c,v 1.2 2019/01/27 02:08:39 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_50_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_sysv.h"
+#endif
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/syscall.h>
+#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
+#include <sys/sysctl.h>
+#include <sys/compat_stub.h>
+
+#include <compat/common/compat_sysv_mod.h>
+
+MODULE(MODULE_CLASS_EXEC, compat_sysv_50, "sysv_ipc");
+
+/* Build the syscall package based on options specified */
+
+static const struct syscall_package compat_sysv_50_syscalls[] = {
+#ifdef SYSVSHM
+ { SYS_compat_50___shmctl13, 0, (sy_call_t *)compat_50_sys___shmctl13 },
+#endif
+#ifdef SYSVSEM
+ { SYS_compat_50_____semctl13, 0, (sy_call_t *)compat_50_sys_____semctl13 },
+#endif
+#ifdef SYSVMSG
+ { SYS_compat_50___msgctl13, 0, (sy_call_t *)compat_50_sys___msgctl13 },
+#endif
+ { 0, 0, NULL }
+};
+
+static int
+compat_sysv_50_modcmd(modcmd_t cmd, void *arg)
+{
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = syscall_establish(NULL, compat_sysv_50_syscalls);
+ if (error != 0) {
+ break;
+ }
+ MODULE_SET_HOOK(sysvipc50_sysctl_hook, "sysv50",
+ sysctl_kern_sysvipc50);
+ break;
+
+ case MODULE_CMD_FINI:
+ error = syscall_disestablish(NULL, compat_sysv_50_syscalls);
+ if (error != 0) {
+ break;
+ }
+ MODULE_UNSET_HOOK(sysvipc50_sysctl_hook);
+ break;
+
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
diff --git a/sys/compat/common/compat_sysv_mod.h b/sys/compat/common/compat_sysv_mod.h
new file mode 100644
index 00000000000..a0b06c904f1
--- /dev/null
+++ b/sys/compat/common/compat_sysv_mod.h
@@ -0,0 +1,39 @@
+/* $NetBSD: compat_sysv_mod.h,v 1.2 2019/01/27 02:08:39 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.
+ */
+
+#ifndef _COMPAT_COMMON_SYSV_IPC_MOD_H_
+#define _COMPAT_COMMON_SYSV_IPC_MOD_H_
+
+#include <sys/sysctl.h>
+
+int sysctl_kern_sysvipc50(SYSCTLFN_PROTO);
+
+#endif /* _COMPAT_COMMON_SYSV_IPC_MOD_H_ */
diff --git a/sys/compat/common/compat_util.c b/sys/compat/common/compat_util.c
index 35d97639e89..8b858fc4b2c 100644
--- a/sys/compat/common/compat_util.c
+++ b/sys/compat/common/compat_util.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_util.c,v 1.46 2014/11/09 17:48:07 maxv Exp $ */
+/* $NetBSD: compat_util.c,v 1.47 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -58,7 +58,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_util.c,v 1.46 2014/11/09 17:48:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_util.c,v 1.47 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -73,83 +77,10 @@ __KERNEL_RCSID(0, "$NetBSD: compat_util.c,v 1.46 2014/11/09 17:48:07 maxv Exp $"
#include <sys/vnode.h>
#include <sys/syslog.h>
#include <sys/mount.h>
+#include <sys/module.h>
#include <compat/common/compat_util.h>
-void
-emul_find_root(struct lwp *l, struct exec_package *epp)
-{
- struct vnode *vp;
- const char *emul_path;
-
- if (epp->ep_emul_root != NULL)
- /* We've already found it */
- return;
-
- emul_path = epp->ep_esch->es_emul->e_path;
- if (emul_path == NULL)
- /* Emulation doesn't have a root */
- return;
-
- if (namei_simple_kernel(emul_path, NSM_FOLLOW_NOEMULROOT, &vp) != 0)
- /* emulation root doesn't exist */
- return;
-
- epp->ep_emul_root = vp;
-}
-
-/*
- * Search the alternate path for dynamic binary interpreter. If not found
- * there, check if the interpreter exists in within 'proper' tree.
- */
-int
-emul_find_interp(struct lwp *l, struct exec_package *epp, const char *itp)
-{
- int error;
- struct pathbuf *pb;
- struct nameidata nd;
- unsigned int flags;
-
- pb = pathbuf_create(itp);
- if (pb == NULL) {
- return ENOMEM;
- }
-
- /* If we haven't found the emulation root already, do so now */
- /* Maybe we should remember failures somehow ? */
- if (epp->ep_esch->es_emul->e_path != 0 && epp->ep_emul_root == NULL)
- emul_find_root(l, epp);
-
- if (epp->ep_interp != NULL)
- vrele(epp->ep_interp);
-
- /* We need to use the emulation root for the new program,
- * not the one for the current process. */
- if (epp->ep_emul_root == NULL)
- flags = FOLLOW;
- else {
- nd.ni_erootdir = epp->ep_emul_root;
- /* hack: Pass in the emulation path for ktrace calls */
- nd.ni_next = epp->ep_esch->es_emul->e_path;
- flags = FOLLOW | TRYEMULROOT | EMULROOTSET;
- }
-
- NDINIT(&nd, LOOKUP, flags, pb);
- error = namei(&nd);
- if (error != 0) {
- epp->ep_interp = NULL;
- pathbuf_destroy(pb);
- return error;
- }
-
- /* Save interpreter in case we actually need to load it */
- epp->ep_interp = nd.ni_vp;
-
- pathbuf_destroy(pb);
-
- return 0;
-}
-
/*
* Translate one set of flags to another, based on the entries in
* the given table. If 'leftover' is specified, it is filled in
@@ -229,3 +160,18 @@ compat_elf_check_interp(struct exec_package *epp,
}
return error;
}
+
+MODULE(MODULE_CLASS_MISC, compat_util, NULL);
+
+int
+compat_util_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ case MODULE_CMD_FINI:
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/common/compat_util.h b/sys/compat/common/compat_util.h
index 4760f2022ad..0c26f9ac147 100644
--- a/sys/compat/common/compat_util.h
+++ b/sys/compat/common/compat_util.h
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_util.h,v 1.23 2013/02/21 01:39:54 pgoyette Exp $ */
+/* $NetBSD: compat_util.h,v 1.24 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -71,10 +71,6 @@ struct emul_flags_xtab {
unsigned long nval;
};
-void emul_find_root(struct lwp *, struct exec_package *);
-
-int emul_find_interp(struct lwp *, struct exec_package *, const char *);
-
unsigned long emul_flags_translate(const struct emul_flags_xtab *tab,
unsigned long in, unsigned long *leftover);
diff --git a/sys/compat/common/files.common b/sys/compat/common/files.common
new file mode 100644
index 00000000000..8be2437dfee
--- /dev/null
+++ b/sys/compat/common/files.common
@@ -0,0 +1,133 @@
+# $NetBSD: files.common,v 1.2 2019/01/27 02:08:39 pgoyette Exp $
+
+#
+# Generic utility files, used by various compat options.
+#
+define compat_netbsd_util
+file compat/common/compat_exec.c compat_utils
+file compat/common/compat_util.c compat_utils
+
+#
+# Sources for syscall and ioctl compatibility across the versions.
+#
+
+# Compatibility code for 4.3BSD
+file compat/common/compat_43_mod.c compat_43
+file compat/common/kern_exit_43.c compat_43
+file compat/common/kern_info_43.c compat_43
+file compat/common/kern_resource_43.c compat_43
+file compat/common/kern_sig_43.c compat_43
+file compat/common/tty_43.c compat_43
+file compat/common/uipc_syscalls_43.c compat_43
+file compat/common/vfs_syscalls_43.c compat_43
+file compat/common/vm_43.c compat_43
+file compat/common/if_43.c compat_43
+
+# Compatibility code for NetBSD 0.9
+file compat/common/compat_09_mod.c compat_09
+file compat/common/kern_info_09.c compat_09
+file compat/common/compat_sysctl_09_43.c compat_09 | compat_43
+
+# Compatability code for NetBSD 1.0
+file compat/common/compat_10_mod.c compat_10
+file compat/common/vfs_syscalls_10.c compat_10
+
+# Compatibility code for NetBSD 1.2
+file compat/common/compat_12_mod.c compat_12
+file compat/common/kern_xxx_12.c compat_12
+file compat/common/vfs_syscalls_12.c compat_12
+file compat/common/vm_12.c compat_12
+
+# Compatibility code for NetBSD 1.3
+file compat/common/compat_13_mod.c compat_13
+file compat/common/kern_sig_13.c compat_13
+file compat/common/uvm_13.c compat_13
+
+# Compatibility code for NetBSD 1.4
+file compat/common/compat_14_mod.c compat_14
+file compat/common/rtsock_14.c compat_14
+
+# Compatibility code for NetBSD 1.6
+file compat/common/compat_16_mod.c compat_16
+file compat/common/kern_sig_16.c compat_16
+
+# Compatibility code for NetBSD 2.0
+file compat/common/compat_20_mod.c compat_20
+file compat/common/vfs_syscalls_20.c compat_20
+file compat/common/if43_20.c compat_20
+file compat/common/ieee80211_20.c compat_20
+
+# Compatibility code for NetBSD 3.0
+file compat/common/compat_30_mod.c compat_30
+file compat/common/kern_time_30.c compat_30
+file compat/common/vfs_syscalls_30.c compat_30
+file compat/common/uipc_syscalls_30.c compat_30
+file compat/common/bio_30.c compat_30
+file compat/common/vnd_30.c compat_30
+file compat/common/usb_subr_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
+file compat/common/kern_50.c compat_50
+file compat/common/kern_time_50.c compat_50
+file compat/common/kern_select_50.c compat_50
+file compat/common/rndpseudo_50.c compat_50
+file compat/common/rtsock_50.c compat_50
+file compat/common/vfs_syscalls_50.c compat_50
+file compat/common/uipc_syscalls_50.c compat_50
+file compat/common/vnd_50.c compat_50
+file compat/common/clockctl_50.c compat_50
+file compat/common/if_spppsubr50.c compat_50
+file compat/common/uvm_50.c compat_50
+
+# Compatibility code for NetBSD 6.0
+file compat/common/compat_60_mod.c compat_60
+file compat/common/kern_sa_60.c compat_60
+file compat/common/tty_60.c compat_60
+file compat/common/kern_time_60.c compat_60
+file compat/common/kern_cpu_60.c compat_60
+file compat/common/ccd_60.c compat_60
+
+# Compatibility code for NetBSD 7.0
+file compat/common/compat_70_mod.c compat_70
+file compat/common/rtsock_70.c compat_70
+file compat/common/uipc_usrreq_70.c compat_70
+
+# Compatability code for NetBSD 8.0
+file compat/common/compat_80_mod.c compat_80
+file compat/common/kern_mod_80.c compat_80
+
+#
+# Sources for sysv ipc compatibility across the versions.
+#
+
+# Module interface for sysv ipc compatability options
+
+# Compatibility code for NetBSD 1.0
+file compat/common/compat_sysv_10_mod.c compat_10 &
+ (sysvmsg | sysvshm | sysvsem)
+file compat/common/kern_ipc_10.c compat_10 &
+ (sysvmsg | sysvshm | sysvsem)
+
+# Compatibility code for NetBSD 1.4
+file compat/common/compat_sysv_14_mod.c compat_14 &
+ (sysvmsg | sysvshm | sysvsem)
+file compat/common/sysv_msg_14.c compat_14 & sysvmsg
+file compat/common/sysv_sem_14.c compat_14 & sysvsem
+file compat/common/sysv_shm_14.c compat_14 & sysvshm
+
+# Compatibility code for NetBSD 5.0
+file compat/common/compat_sysv_50_mod.c compat_50 &
+ (sysvmsg | sysvshm | sysvsem)
+file compat/common/sysv_ipc_50.c compat_50 &
+ (sysvmsg | sysvshm | sysvsem)
+file compat/common/sysv_msg_50.c compat_50 & sysvmsg
+file compat/common/sysv_sem_50.c compat_50 & sysvsem
+file compat/common/sysv_shm_50.c compat_50 & sysvshm
+
diff --git a/sys/compat/common/ieee80211_20.c b/sys/compat/common/ieee80211_20.c
new file mode 100644
index 00000000000..42c8d2c702e
--- /dev/null
+++ b/sys/compat/common/ieee80211_20.c
@@ -0,0 +1,109 @@
+/* $NetBSD: ieee80211_20.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+/*-
+ * Copyright (c) 2001 Atsushi Onoe
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#ifdef __FreeBSD__
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $");
+#endif
+#ifdef __NetBSD__
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_20.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+#endif
+
+/*
+ * IEEE 802.11 ioctl support
+ */
+
+#ifdef _KERNEL_OPT
+#include "opt_inet.h"
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/endian.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/kauth.h>
+#include <sys/compat_stub.h>
+
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/if_media.h>
+#include <net/if_ether.h>
+
+#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_ioctl.h>
+
+#include <dev/ic/wi_ieee.h>
+
+#include <compat/common/compat_mod.h>
+
+#include <compat/sys/sockio.h>
+
+static int
+ieee80211_get_ostats(struct ieee80211_ostats *ostats,
+ struct ieee80211_stats *stats)
+{
+#define COPYSTATS1(__ostats, __nstats, __dstmemb, __srcmemb, __lastmemb)\
+ (void)memcpy(&(__ostats)->__dstmemb, &(__nstats)->__srcmemb, \
+ offsetof(struct ieee80211_stats, __lastmemb) - \
+ offsetof(struct ieee80211_stats, __srcmemb))
+#define COPYSTATS(__ostats, __nstats, __dstmemb, __lastmemb) \
+ COPYSTATS1(__ostats, __nstats, __dstmemb, __dstmemb, __lastmemb)
+
+ COPYSTATS(ostats, stats, is_rx_badversion, is_rx_unencrypted);
+ COPYSTATS(ostats, stats, is_rx_wepfail, is_rx_beacon);
+ COPYSTATS(ostats, stats, is_rx_rstoobig, is_rx_auth_countermeasures);
+ COPYSTATS(ostats, stats, is_rx_assoc_bss, is_rx_assoc_badwpaie);
+ COPYSTATS(ostats, stats, is_rx_deauth, is_rx_unauth);
+ COPYSTATS1(ostats, stats, is_tx_nombuf, is_tx_nobuf, is_tx_badcipher);
+ COPYSTATS(ostats, stats, is_scan_active, is_crypto_tkip);
+
+ return 0;
+}
+
+void
+ieee80211_20_init(void)
+{
+
+ MODULE_SET_HOOK(ieee80211_ostats_hook, "ieee20", ieee80211_get_ostats);
+}
+
+void
+ieee80211_20_fini(void)
+{
+
+ MODULE_UNSET_HOOK(ieee80211_ostats_hook);
+}
diff --git a/sys/compat/common/if43_20.c b/sys/compat/common/if43_20.c
new file mode 100644
index 00000000000..1cd78497968
--- /dev/null
+++ b/sys/compat/common/if43_20.c
@@ -0,0 +1,94 @@
+/* $NetBSD: if43_20.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if43_20.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/filedesc.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/fcntl.h>
+#include <sys/syslog.h>
+#include <sys/unistd.h>
+#include <sys/resourcevar.h>
+#include <sys/mbuf.h> /* for MLEN */
+#include <sys/protosw.h>
+#include <sys/compat_stub.h>
+
+#include <net/if.h>
+#include <net/bpf.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <net/if_gre.h>
+#include <net/if_tap.h>
+#include <net80211/ieee80211_ioctl.h>
+
+#include <compat/common/compat_mod.h>
+
+static int
+if43_cvtcmd_20(u_long ncmd)
+{
+
+ switch (ncmd) {
+ case OSIOCG80211STATS:
+ case OSIOCG80211ZSTATS:
+ return 0;
+ default:
+ return EINVAL;
+ }
+}
+
+void
+if43_20_init(void)
+{
+
+ MODULE_SET_HOOK(if43_20_hook, "if4320", if43_cvtcmd_20);
+}
+
+void
+if43_20_fini(void)
+{
+
+ MODULE_UNSET_HOOK(if43_20_hook);
+}
diff --git a/sys/compat/common/if_43.c b/sys/compat/common/if_43.c
index e7269e02c99..3f62fcf385c 100644
--- a/sys/compat/common/if_43.c
+++ b/sys/compat/common/if_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_43.c,v 1.15 2018/09/06 06:41:59 maxv Exp $ */
+/* $NetBSD: if_43.c,v 1.16 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.15 2018/09/06 06:41:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.16 2019/01/27 02:08:39 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.15 2018/09/06 06:41:59 maxv Exp $");
#include <sys/resourcevar.h>
#include <sys/mbuf.h> /* for MLEN */
#include <sys/protosw.h>
+#include <sys/compat_stub.h>
#include <sys/syscallargs.h>
@@ -72,12 +73,25 @@ __KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.15 2018/09/06 06:41:59 maxv Exp $");
#include <compat/sys/sockio.h>
#include <compat/common/compat_util.h>
-#include <compat/common/if_43.h>
+#include <compat/common/compat_mod.h>
#include <uvm/uvm_extern.h>
-u_long
-compat_cvtcmd(u_long cmd)
+#if defined(COMPAT_43)
+
+/*
+ * Use a wrapper so that the compat_cvtcmd() can return a u_long
+ */
+static int
+do_compat_cvtcmd(u_long *ncmd, u_long ocmd)
{
+
+ *ncmd = compat_cvtcmd(ocmd);
+ return 0;
+}
+
+u_long
+compat_cvtcmd(u_long cmd)
+{
u_long ncmd;
if (IOCPARM_LEN(cmd) != sizeof(struct oifreq))
@@ -145,10 +159,6 @@ compat_cvtcmd(u_long cmd)
case GRESADDRS:
case GRESPROTO:
case GRESSOCK:
-#ifdef COMPAT_20
- case OSIOCG80211STATS:
- case OSIOCG80211ZSTATS:
-#endif /* COMPAT_20 */
case SIOCADDMULTI:
case SIOCDELMULTI:
case SIOCDIFADDR:
@@ -202,7 +212,8 @@ compat_cvtcmd(u_long cmd)
case TAPGIFNAME:
return ncmd;
default:
- return cmd;
+ MODULE_CALL_HOOK(if43_20_hook, (ncmd), enosys(), ncmd);
+ return ncmd;
}
}
}
@@ -278,27 +289,21 @@ compat_ifioctl(struct socket *so, u_long ocmd, u_long cmd, void *data,
return error;
}
-#if defined(COMPAT_43)
-static u_long (*orig_compat_cvtcmd)(u_long);
-static int (*orig_compat_ifioctl)(struct socket *, u_long, u_long,
- void *, struct lwp *);
-
-void
+int
if_43_init(void)
{
- orig_compat_cvtcmd = vec_compat_cvtcmd;
- vec_compat_cvtcmd = compat_cvtcmd;
-
- orig_compat_ifioctl = vec_compat_ifioctl;
- vec_compat_ifioctl = compat_ifioctl;
+ MODULE_SET_HOOK(if_43_cvtcmd_hook, "if_43", do_compat_cvtcmd);
+ MODULE_SET_HOOK(if_43_ifioctl_hook, "if_43", compat_ifioctl);
+ return 0;
}
-void
+int
if_43_fini(void)
{
- vec_compat_cvtcmd = orig_compat_cvtcmd;
- vec_compat_ifioctl = orig_compat_ifioctl;
+ MODULE_UNSET_HOOK(if_43_cvtcmd_hook);
+ MODULE_UNSET_HOOK(if_43_ifioctl_hook);
+ return 0;
}
#endif /* defined(COMPAT_43) */
diff --git a/sys/compat/common/if_spppsubr50.c b/sys/compat/common/if_spppsubr50.c
new file mode 100644
index 00000000000..b621c1eda52
--- /dev/null
+++ b/sys/compat/common/if_spppsubr50.c
@@ -0,0 +1,169 @@
+/* $NetBSD: if_spppsubr50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*
+ * Synchronous PPP/Cisco link level subroutines.
+ * Keepalive protocol implemented in both Cisco and PPP modes.
+ *
+ * Copyright (C) 1994-1996 Cronyx Engineering Ltd.
+ * Author: Serge Vakulenko, <vak@cronyx.ru>
+ *
+ * Heavily revamped to conform to RFC 1661.
+ * Copyright (C) 1997, Joerg Wunsch.
+ *
+ * RFC2472 IPv6CP support.
+ * Copyright (C) 2000, Jun-ichiro itojun Hagino <itojun@iijlab.net>.
+ *
+ * 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 FREEBSD PROJECT ``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 FREEBSD PROJECT 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.
+ *
+ * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
+ *
+ * From: if_spppsubr.c,v 1.39 1998/04/04 13:26:03 phk Exp
+ *
+ * From: Id: if_spppsubr.c,v 1.23 1999/02/23 14:47:50 hm Exp
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_inet.h"
+#include "opt_modular.h"
+#include "opt_compat_netbsd.h"
+#include "opt_net_mpsafe.h"
+#endif
+
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <sys/syslog.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/callout.h>
+#include <sys/md5.h>
+#include <sys/inttypes.h>
+#include <sys/kauth.h>
+#include <sys/cprng.h>
+#include <sys/module.h>
+#include <sys/workqueue.h>
+#include <sys/atomic.h>
+#include <sys/compat_stub.h>
+
+#include <net/if.h>
+#include <net/netisr.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <net/ppp_defs.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#ifdef INET
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#endif
+#include <net/ethertypes.h>
+
+#ifdef INET6
+#include <netinet6/scope6_var.h>
+#endif
+
+#include <net/if_sppp.h>
+#include <net/if_spppvar.h>
+
+#include <compat/common/if_spppsubr50.h>
+
+#ifdef NET_MPSAFE
+#define SPPPSUBR_MPSAFE 1
+#endif
+
+#define SPPP_LOCK(_sp, _op) rw_enter(&(_sp)->pp_lock, (_op))
+#define SPPP_UNLOCK(_sp) rw_exit(&(_sp)->pp_lock)
+
+int sppp_compat50_params(struct sppp *, u_long, void *);
+
+int
+sppp_compat50_params(struct sppp *sp, u_long cmd, void *data)
+{
+ switch (cmd) {
+ case __SPPPGETIDLETO50:
+ {
+ struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
+
+ SPPP_LOCK(sp, RW_READER);
+ to->idle_seconds = (uint32_t)sp->pp_idle_timeout;
+ SPPP_UNLOCK(sp);
+ }
+ break;
+ case __SPPPSETIDLETO50:
+ {
+ struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
+
+ SPPP_LOCK(sp, RW_WRITER);
+ sp->pp_idle_timeout = (time_t)to->idle_seconds;
+ SPPP_UNLOCK(sp);
+ }
+ break;
+ case __SPPPGETKEEPALIVE50:
+ {
+ struct spppkeepalivesettings50 *settings =
+ (struct spppkeepalivesettings50*)data;
+
+ SPPP_LOCK(sp, RW_READER);
+ settings->maxalive = sp->pp_maxalive;
+ settings->max_noreceive = (uint32_t)sp->pp_max_noreceive;
+ SPPP_UNLOCK(sp);
+ }
+ break;
+ case __SPPPSETKEEPALIVE50:
+ {
+ struct spppkeepalivesettings50 *settings =
+ (struct spppkeepalivesettings50*)data;
+
+ SPPP_LOCK(sp, RW_WRITER);
+ sp->pp_maxalive = settings->maxalive;
+ sp->pp_max_noreceive = (time_t)settings->max_noreceive;
+ SPPP_UNLOCK(sp);
+ }
+ break;
+ default:
+ return EINVAL;
+ }
+
+ return 0;
+}
+
+void
+if_spppsubr_50_init(void)
+{
+
+ MODULE_SET_HOOK(sppp_params_50_hook, "sppp60", sppp_compat50_params);
+}
+
+void
+if_spppsubr_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(sppp_params_50_hook);
+}
diff --git a/sys/compat/common/if_spppsubr50.h b/sys/compat/common/if_spppsubr50.h
new file mode 100644
index 00000000000..fe7e5425567
--- /dev/null
+++ b/sys/compat/common/if_spppsubr50.h
@@ -0,0 +1,38 @@
+/* $NetBSD: if_spppsubr50.h,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to 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.
+ */
+
+#ifndef _COMPAT_IF_SPPPSUBR40_H_
+#define _COMPAT_IF_SPPPSUBR40_H_
+
+void if_spppsubr_50_init(void);
+void if_spppsubr_50_fini(void);
+
+#endif /* _COMPAT_IF_SPPPSUBR40_H_ */
diff --git a/sys/compat/common/kern_50.c b/sys/compat/common/kern_50.c
index fab24fb419a..f231c24095b 100644
--- a/sys/compat/common/kern_50.c
+++ b/sys/compat/common/kern_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_50.c,v 1.1 2014/04/04 18:17:36 njoly Exp $ */
+/* $NetBSD: kern_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,16 +29,32 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_50.c,v 1.1 2014/04/04 18:17:36 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/lwp.h>
#include <sys/proc.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <compat/sys/resource.h>
#include <compat/sys/time.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package kern_50_syscalls[] = {
+ { SYS_compat_50__lwp_park, 0, (sy_call_t *)compat_50_sys__lwp_park },
+ { SYS_compat_50___sigtimedwait, 0,
+ (sy_call_t *)compat_50_sys___sigtimedwait },
+ { SYS_compat_50_wait4, 0, (sy_call_t *)compat_50_sys_wait4 },
+ { 0, 0, NULL }
+};
+
int
compat_50_sys__lwp_park(struct lwp *l,
const struct compat_50_sys__lwp_park_args *uap, register_t *retval)
@@ -141,3 +157,17 @@ compat_50_sys_wait4(struct lwp *l, const struct compat_50_sys_wait4_args *uap,
return error;
}
+
+int
+kern_50_init(void)
+{
+
+ return syscall_establish(NULL, kern_50_syscalls);
+}
+
+int
+kern_50_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_50_syscalls);
+}
diff --git a/sys/compat/common/kern_cpu_60.c b/sys/compat/common/kern_cpu_60.c
index c0af9608254..5c1cb9290e9 100644
--- a/sys/compat/common/kern_cpu_60.c
+++ b/sys/compat/common/kern_cpu_60.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_cpu_60.c,v 1.3 2018/03/18 04:10:39 christos Exp $ */
+/* $NetBSD: kern_cpu_60.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.3 2018/03/18 04:10:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
+#endif
#ifdef _KERNEL_OPT
#include "opt_cpu_ucode.h"
@@ -42,28 +47,30 @@ __KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.3 2018/03/18 04:10:39 christos Exp
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/kauth.h>
+#include <sys/lwp.h>
#include <sys/cpu.h>
-#include <sys/cpuio.h>
#include <compat/sys/cpuio.h>
static int
compat6_cpuctl_ioctl(struct lwp *l, u_long cmd, void *data)
{
-#if defined(CPU_UCODE) && defined(COMPAT_60)
- int error;
-#endif
+
switch (cmd) {
#if defined(CPU_UCODE) && defined(COMPAT_60)
case OIOC_CPU_UCODE_GET_VERSION:
return compat6_cpu_ucode_get_version(data);
case OIOC_CPU_UCODE_APPLY:
+ {
+ int error;
+
error = kauth_authorize_machdep(l->l_cred,
KAUTH_MACHDEP_CPU_UCODE_APPLY, NULL, NULL, NULL, NULL);
if (error)
return error;
return compat6_cpu_ucode_apply(data);
+ }
#endif
default:
return ENOTTY;
@@ -73,11 +80,13 @@ compat6_cpuctl_ioctl(struct lwp *l, u_long cmd, void *data)
void
kern_cpu_60_init(void)
{
+
compat_cpuctl_ioctl = compat6_cpuctl_ioctl;
}
void
kern_cpu_60_fini(void)
{
+
compat_cpuctl_ioctl = (void *)enosys;
}
diff --git a/sys/compat/common/kern_exit_43.c b/sys/compat/common/kern_exit_43.c
index f8b77089ff3..dd34c7edb59 100644
--- a/sys/compat/common/kern_exit_43.c
+++ b/sys/compat/common/kern_exit_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exit_43.c,v 1.22 2009/11/04 21:23:02 rmind Exp $ */
+/* $NetBSD: kern_exit_43.c,v 1.23 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit_43.c,v 1.22 2009/11/04 21:23:02 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit_43.c,v 1.23 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -57,11 +61,14 @@ __KERNEL_RCSID(0, "$NetBSD: kern_exit_43.c,v 1.22 2009/11/04 21:23:02 rmind Exp
#include <sys/acct.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/cpu.h>
#include <machine/reg.h>
#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
#ifdef m68k
#include <machine/psl.h> /* only m68k ports use PSL_ALLCC */
@@ -71,6 +78,11 @@ __KERNEL_RCSID(0, "$NetBSD: kern_exit_43.c,v 1.22 2009/11/04 21:23:02 rmind Exp
#define GETPS(rp) (rp)[PS]
#endif
+static struct syscall_package kern_exit_43_syscalls[] = {
+ { SYS_compat_43_owait, 0, (sy_call_t *)compat_43_sys_wait },
+ { 0, 0, NULL}
+};
+
int
compat_43_sys_wait(struct lwp *l, const void *v, register_t *retval)
{
@@ -90,3 +102,17 @@ compat_43_sys_wait(struct lwp *l, const void *v, register_t *retval)
retval[1] = status;
return error;
}
+
+int
+kern_exit_43_init(void)
+{
+
+ return syscall_establish(NULL, kern_exit_43_syscalls);
+}
+
+int
+kern_exit_43_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_exit_43_syscalls);
+}
diff --git a/sys/compat/common/kern_info_09.c b/sys/compat/common/kern_info_09.c
index ee712e67580..149a575f4b4 100644
--- a/sys/compat/common/kern_info_09.c
+++ b/sys/compat/common/kern_info_09.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_info_09.c,v 1.20 2007/12/20 23:02:44 dsl Exp $ */
+/* $NetBSD: kern_info_09.c,v 1.21 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1986, 1991, 1993
@@ -32,7 +32,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_info_09.c,v 1.20 2007/12/20 23:02:44 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_info_09.c,v 1.21 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -45,11 +49,25 @@ __KERNEL_RCSID(0, "$NetBSD: kern_info_09.c,v 1.20 2007/12/20 23:02:44 dsl Exp $"
#include <sys/sysctl.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
+#include <compat/common/compat_mod.h>
+
+static struct syscall_package kern_info_09_syscalls[] = {
+ { SYS_compat_09_ogetdomainname, 0,
+ (sy_call_t *)compat_09_sys_getdomainname },
+ { SYS_compat_09_osetdomainname, 0,
+ (sy_call_t *)compat_09_sys_setdomainname },
+ { SYS_compat_09_ouname, 0, (sy_call_t *)compat_09_sys_uname },
+ { 0, 0, NULL }
+};
+
/* ARGSUSED */
int
-compat_09_sys_getdomainname(struct lwp *l, const struct compat_09_sys_getdomainname_args *uap, register_t *retval)
+compat_09_sys_getdomainname(struct lwp *l,
+ const struct compat_09_sys_getdomainname_args *uap, register_t *retval)
{
/* {
syscallarg(char *) domainname;
@@ -67,7 +85,8 @@ compat_09_sys_getdomainname(struct lwp *l, const struct compat_09_sys_getdomainn
/* ARGSUSED */
int
-compat_09_sys_setdomainname(struct lwp *l, const struct compat_09_sys_setdomainname_args *uap, register_t *retval)
+compat_09_sys_setdomainname(struct lwp *l,
+ const struct compat_09_sys_setdomainname_args *uap, register_t *retval)
{
/* {
syscallarg(char *) domainname;
@@ -91,7 +110,8 @@ struct outsname {
/* ARGSUSED */
int
-compat_09_sys_uname(struct lwp *l, const struct compat_09_sys_uname_args *uap, register_t *retval)
+compat_09_sys_uname(struct lwp *l,
+ const struct compat_09_sys_uname_args *uap, register_t *retval)
{
/* {
syscallarg(struct outsname *) name;
@@ -118,3 +138,17 @@ compat_09_sys_uname(struct lwp *l, const struct compat_09_sys_uname_args *uap, r
return (copyout((void *)&outsname, (void *)SCARG(uap, name),
sizeof(struct outsname)));
}
+
+int
+kern_info_09_init(void)
+{
+
+ return syscall_establish(NULL, kern_info_09_syscalls);
+}
+
+int
+kern_info_09_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_info_09_syscalls);
+}
diff --git a/sys/compat/common/kern_info_43.c b/sys/compat/common/kern_info_43.c
index fdc85c9ae91..29b04cfa32e 100644
--- a/sys/compat/common/kern_info_43.c
+++ b/sys/compat/common/kern_info_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_info_43.c,v 1.36 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: kern_info_43.c,v 1.37 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1986, 1991, 1993
@@ -32,7 +32,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.36 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.37 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,9 +60,27 @@ __KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.36 2018/09/03 16:29:29 riastradh
#include <sys/sysctl.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <compat/sys/time.h>
+#include <compat/common/compat_mod.h>
+
+static struct syscall_package kern_info_43_syscalls[] = {
+ { SYS_compat_43_ogetdtablesize, 0,
+ (sy_call_t *)compat_43_sys_getdtablesize },
+ { SYS_compat_43_ogethostid, 0, (sy_call_t *)compat_43_sys_gethostid },
+ { SYS_compat_43_ogethostname, 0,
+ (sy_call_t *)compat_43_sys_gethostname },
+ { SYS_compat_43_ogetkerninfo, 0,
+ (sy_call_t *)compat_43_sys_getkerninfo },
+ { SYS_compat_43_osethostid, 0, (sy_call_t *)compat_43_sys_sethostid },
+ { SYS_compat_43_osethostname, 0,
+ (sy_call_t *)compat_43_sys_sethostname },
+ { 0, 0, NULL }
+};
+
int
compat_43_sys_getdtablesize(struct lwp *l, const void *v, register_t *retval)
{
@@ -311,3 +333,17 @@ compat_43_sys_sethostname(struct lwp *l, const struct compat_43_sys_sethostname_
return (old_sysctl(&name[0], 2, 0, 0, SCARG(uap, hostname),
SCARG(uap, len), l));
}
+
+int
+kern_info_43_init(void)
+{
+
+ return syscall_establish(NULL, kern_info_43_syscalls);
+}
+
+int
+kern_info_43_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_info_43_syscalls);
+}
diff --git a/sys/compat/common/kern_ipc_10.c b/sys/compat/common/kern_ipc_10.c
index cf8790593ef..1ff88b769c0 100644
--- a/sys/compat/common/kern_ipc_10.c
+++ b/sys/compat/common/kern_ipc_10.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ipc_10.c,v 1.25 2009/01/11 02:45:46 christos Exp $ */
+/* $NetBSD: kern_ipc_10.c,v 1.26 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1994 Adam Glass and Charles M. Hannum. All rights reserved.
@@ -31,9 +31,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ipc_10.c,v 1.25 2009/01/11 02:45:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ipc_10.c,v 1.26 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
#include "opt_sysv.h"
#endif
diff --git a/sys/compat/common/kern_mod_80.c b/sys/compat/common/kern_mod_80.c
new file mode 100644
index 00000000000..1050e2589ed
--- /dev/null
+++ b/sys/compat/common/kern_mod_80.c
@@ -0,0 +1,167 @@
+/* $NetBSD: kern_mod_80.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 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.
+ */
+
+/*
+ * System calls relating to loadable modules.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: kern_mod_80.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_modular.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/namei.h>
+#include <sys/kauth.h>
+#include <sys/kmem.h>
+#include <sys/kobj.h>
+#include <sys/module.h>
+#include <sys/syscall.h>
+#include <sys/syscallargs.h>
+#include <sys/compat_stub.h>
+
+#include <compat/common/compat_mod.h>
+
+static int
+compat_80_modstat(int cmd, struct iovec *iov, void *arg)
+{
+ omodstat_t *oms, *omso;
+ modinfo_t *mi;
+ module_t *mod;
+ vaddr_t addr;
+ size_t size;
+ size_t omslen;
+ size_t used;
+ int error;
+ int omscnt;
+ bool stataddr;
+ const char *suffix = "...";
+
+ if (cmd != MODCTL_OSTAT)
+ return EINVAL;
+
+ error = copyin(arg, iov, sizeof(*iov));
+ if (error != 0) {
+ return error;
+ }
+
+ /* If not privileged, don't expose kernel addresses. */
+ error = kauth_authorize_system(kauth_cred_get(), KAUTH_SYSTEM_MODULE,
+ 0, (void *)(uintptr_t)MODCTL_STAT, NULL, NULL);
+ stataddr = (error == 0);
+
+ kernconfig_lock();
+ omscnt = 0;
+ TAILQ_FOREACH(mod, &module_list, mod_chain) {
+ omscnt++;
+ mi = mod->mod_info;
+ }
+ TAILQ_FOREACH(mod, &module_builtins, mod_chain) {
+ omscnt++;
+ mi = mod->mod_info;
+ }
+ omslen = omscnt * sizeof(omodstat_t);
+ omso = kmem_zalloc(omslen, KM_SLEEP);
+ oms = omso;
+ TAILQ_FOREACH(mod, &module_list, mod_chain) {
+ mi = mod->mod_info;
+ strlcpy(oms->oms_name, mi->mi_name, sizeof(oms->oms_name));
+ if (mi->mi_required != NULL) {
+ used = strlcpy(oms->oms_required, mi->mi_required,
+ sizeof(oms->oms_required));
+ if (used >= sizeof(oms->oms_required)) {
+ oms->oms_required[sizeof(oms->oms_required) -
+ strlen(suffix) - 1] = '\0';
+ strlcat(oms->oms_required, suffix,
+ sizeof(oms->oms_required));
+ }
+ }
+ if (mod->mod_kobj != NULL && stataddr) {
+ kobj_stat(mod->mod_kobj, &addr, &size);
+ oms->oms_addr = addr;
+ oms->oms_size = size;
+ }
+ oms->oms_class = mi->mi_class;
+ oms->oms_refcnt = mod->mod_refcnt;
+ oms->oms_source = mod->mod_source;
+ oms->oms_flags = mod->mod_flags;
+ oms++;
+ }
+ TAILQ_FOREACH(mod, &module_builtins, mod_chain) {
+ mi = mod->mod_info;
+ strlcpy(oms->oms_name, mi->mi_name, sizeof(oms->oms_name));
+ if (mi->mi_required != NULL) {
+ used = strlcpy(oms->oms_required, mi->mi_required,
+ sizeof(oms->oms_required));
+ if (used >= sizeof(oms->oms_required)) {
+ oms->oms_required[sizeof(oms->oms_required) -
+ strlen(suffix) - 1] = '\0';
+ strlcat(oms->oms_required, suffix,
+ sizeof(oms->oms_required));
+ }
+ }
+ if (mod->mod_kobj != NULL && stataddr) {
+ kobj_stat(mod->mod_kobj, &addr, &size);
+ oms->oms_addr = addr;
+ oms->oms_size = size;
+ }
+ oms->oms_class = mi->mi_class;
+ oms->oms_refcnt = -1;
+ KASSERT(mod->mod_source == MODULE_SOURCE_KERNEL);
+ oms->oms_source = mod->mod_source;
+ oms++;
+ }
+ kernconfig_unlock();
+ error = copyout(omso, iov->iov_base, uimin(omslen, iov->iov_len));
+ kmem_free(omso, omslen);
+ if (error == 0) {
+ iov->iov_len = omslen;
+ error = copyout(iov, arg, sizeof(*iov));
+ }
+
+ return error;
+}
+
+void
+kern_mod_80_init(void)
+{
+
+ MODULE_SET_HOOK(compat_modstat_80_hook, "mod_80",compat_80_modstat);
+}
+
+void
+kern_mod_80_fini(void)
+{
+
+ MODULE_UNSET_HOOK(compat_modstat_80_hook);
+}
diff --git a/sys/compat/common/kern_resource_43.c b/sys/compat/common/kern_resource_43.c
index 3805f6274a5..a0730c9ef34 100644
--- a/sys/compat/common/kern_resource_43.c
+++ b/sys/compat/common/kern_resource_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_resource_43.c,v 1.21 2007/12/20 23:02:44 dsl Exp $ */
+/* $NetBSD: kern_resource_43.c,v 1.22 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_resource_43.c,v 1.21 2007/12/20 23:02:44 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_resource_43.c,v 1.22 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -47,8 +51,18 @@ __KERNEL_RCSID(0, "$NetBSD: kern_resource_43.c,v 1.21 2007/12/20 23:02:44 dsl Ex
#include <sys/proc.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
+#include <compat/common/compat_mod.h>
+
+static struct syscall_package kern_resource_43_syscalls[] = {
+ { SYS_compat_43_ogetrlimit, 0, (sy_call_t *)compat_43_sys_getrlimit },
+ { SYS_compat_43_osetrlimit, 0, (sy_call_t *)compat_43_sys_setrlimit },
+ { 0, 0, NULL }
+};
+
/* ARGSUSED */
int
compat_43_sys_getrlimit(struct lwp *l, const struct compat_43_sys_getrlimit_args *uap, register_t *retval)
@@ -92,3 +106,17 @@ compat_43_sys_setrlimit(struct lwp *l, const struct compat_43_sys_setrlimit_args
lim.rlim_max = olim.rlim_max;
return (dosetrlimit(l, l->l_proc, which, &lim));
}
+
+int
+kern_resource_43_init(void)
+{
+
+ return syscall_establish(NULL, kern_resource_43_syscalls);
+}
+
+int
+kern_resource_43_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_resource_43_syscalls);
+}
diff --git a/sys/compat/common/kern_sa_60.c b/sys/compat/common/kern_sa_60.c
index 8c36c314473..e4c369aa647 100644
--- a/sys/compat/common/kern_sa_60.c
+++ b/sys/compat/common/kern_sa_60.c
@@ -29,12 +29,31 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: kern_sa_60.c,v 1.1 2012/02/19 17:40:46 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: kern_sa_60.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/systm.h>
#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package kern_sa_60_syscalls[] = {
+ { SYS_compat_60_sa_register, 0,
+ (sy_call_t *)compat_60_sys_sa_register },
+ { SYS_compat_60_sa_stacks, 0, (sy_call_t *)compat_60_sys_sa_stacks },
+ { SYS_compat_60_sa_enable, 0, (sy_call_t *)compat_60_sys_sa_enable },
+ { SYS_compat_60_sa_setconcurrency, 0,
+ (sy_call_t *)compat_60_sys_sa_setconcurrency },
+ { SYS_compat_60_sa_yield, 0, (sy_call_t *)compat_60_sys_sa_yield },
+ { SYS_compat_60_sa_preempt, 0, (sy_call_t *)compat_60_sys_sa_preempt },
+ { 0, 0, NULL }
+};
+
int
compat_60_sys_sa_register(lwp_t *l,
const struct compat_60_sys_sa_register_args *uap,
@@ -82,3 +101,17 @@ compat_60_sys_sa_preempt(lwp_t *l,
{
return sys_nosys(l, uap, retval);
}
+
+int
+kern_sa_60_init(void)
+{
+
+ return syscall_establish(NULL, kern_sa_60_syscalls);
+}
+
+int
+kern_sa_60_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_sa_60_syscalls);
+}
diff --git a/sys/compat/common/kern_select_50.c b/sys/compat/common/kern_select_50.c
index 685dec6ac13..b599f0b6406 100644
--- a/sys/compat/common/kern_select_50.c
+++ b/sys/compat/common/kern_select_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_select_50.c,v 1.1 2011/01/17 15:57:04 pooka Exp $ */
+/* $NetBSD: kern_select_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,16 +29,31 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_select_50.c,v 1.1 2011/01/17 15:57:04 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_select_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/event.h>
#include <sys/poll.h>
#include <sys/select.h>
#include <sys/time.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <compat/sys/time.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package kern_select_50_syscalls[] = {
+ { SYS_compat_50_kevent, 0, (sy_call_t *)compat_50_sys_kevent },
+ { SYS_compat_50_select, 0, (sy_call_t *)compat_50_sys_select },
+ { SYS_compat_50_pselect, 0, (sy_call_t *)compat_50_sys_pselect },
+ { SYS_compat_50_pollts, 0, (sy_call_t *)compat_50_sys_pollts },
+ { 0, 0, NULL }
+};
static int
compat_50_kevent_fetch_timeout(const void *src, void *dest, size_t length)
@@ -174,3 +189,17 @@ compat_50_sys_pollts(struct lwp *l, const struct compat_50_sys_pollts_args *uap,
return pollcommon(retval, SCARG(uap, fds), SCARG(uap, nfds), ts, mask);
}
+
+int
+kern_select_50_init(void)
+{
+
+return syscall_establish(NULL, kern_select_50_syscalls);
+}
+
+int
+kern_select_50_fini(void)
+{
+
+return syscall_disestablish(NULL, kern_select_50_syscalls);
+}
diff --git a/sys/compat/common/kern_sig_13.c b/sys/compat/common/kern_sig_13.c
index c357e842d2a..453dbc0d788 100644
--- a/sys/compat/common/kern_sig_13.c
+++ b/sys/compat/common/kern_sig_13.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: kern_sig_13.c,v 1.21 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.21 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/proc.h>
@@ -38,6 +42,8 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp
#include <sys/signalvar.h>
#include <sys/systm.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <machine/limits.h>
@@ -46,6 +52,22 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp
#include <compat/sys/signalvar.h>
#include <compat/common/compat_util.h>
#include <compat/common/compat_sigaltstack.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package kern_sig_13_syscalls[] = {
+ { SYS_compat_13_sigaction13, 0, (sy_call_t *)compat_13_sys_sigaction },
+ { SYS_compat_13_sigaltstack13, 0,
+ (sy_call_t *)compat_13_sys_sigaltstack },
+ { SYS_compat_13_sigpending13, 0,
+ (sy_call_t *)compat_13_sys_sigpending },
+ { SYS_compat_13_sigprocmask13, 0,
+ (sy_call_t *)compat_13_sys_sigprocmask },
+ { SYS_compat_13_sigsuspend13, 0,
+ (sy_call_t *)compat_13_sys_sigsuspend },
+ /* compat_13_sigreturn13 is in MD code! */
+ { SYS_compat_13_sigreturn13, 0, (sy_call_t *)compat_13_sys_sigreturn },
+ { 0, 0, NULL }
+};
void
native_sigset13_to_sigset(const sigset13_t *oss, sigset_t *ss)
@@ -173,3 +195,17 @@ compat_13_sys_sigsuspend(struct lwp *l, const struct compat_13_sys_sigsuspend_ar
native_sigset13_to_sigset(&ess, &bss);
return (sigsuspend1(l, &bss));
}
+
+int
+kern_sig_13_init(void)
+{
+
+ return syscall_establish(NULL, kern_sig_13_syscalls);
+}
+
+int
+kern_sig_13_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_sig_13_syscalls);
+}
diff --git a/sys/compat/common/kern_sig_16.c b/sys/compat/common/kern_sig_16.c
index 36e86746e9d..a70c4b3ae70 100644
--- a/sys/compat/common/kern_sig_16.c
+++ b/sys/compat/common/kern_sig_16.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sig_16.c,v 1.2 2012/02/19 21:06:36 rmind Exp $ */
+/* $NetBSD: kern_sig_16.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,18 +66,50 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig_16.c,v 1.2 2012/02/19 21:06:36 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig_16.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/rwlock.h>
#include <sys/signalvar.h>
#include <sys/proc.h>
#include <sys/pool.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/kauth.h>
#include <sys/wait.h>
#include <sys/kmem.h>
+#include <uvm/uvm_object.h>
+#include <uvm/uvm_prot.h>
+#include <uvm/uvm_pager.h>
+
+#include <compat/common/compat_mod.h>
+
+extern krwlock_t exec_lock;
+
+#if !defined(__amd64__) || defined(COMPAT_NETBSD32)
+#define COMPAT_SIGCONTEXT
+extern char sigcode[], esigcode[];
+struct uvm_object *emul_netbsd_object;
+#endif
+
+static const struct syscall_package kern_sig_16_syscalls[] = {
+#ifdef COMPAT_SIGCONTEXT
+ { SYS_compat_16___sigaction14, 0,
+ (sy_call_t *)compat_16_sys___sigaction14 },
+ /* compat_16_sigreturn14 is in MD code! */
+ { SYS_compat_16___sigreturn14, 0,
+ (sy_call_t *)compat_16_sys___sigreturn14 },
+#endif
+ { 0, 0, NULL }
+};
+
int
compat_16_sys___sigaction14(struct lwp *l,
const struct compat_16_sys___sigaction14_args *uap, register_t *retval)
@@ -107,3 +139,72 @@ compat_16_sys___sigaction14(struct lwp *l,
}
return (0);
}
+
+int
+kern_sig_16_init(void)
+{
+ int error;
+
+ error = syscall_establish(NULL, kern_sig_16_syscalls);
+ if (error)
+ return error;
+#if defined(COMPAT_SIGCONTEXT)
+ KASSERT(emul_netbsd.e_sigobject == NULL);
+ rw_enter(&exec_lock, RW_WRITER);
+ emul_netbsd.e_sigcode = sigcode;
+ emul_netbsd.e_esigcode = esigcode;
+ emul_netbsd.e_sigobject = &emul_netbsd_object;
+ rw_exit(&exec_lock);
+ KASSERT(sendsig_sigcontext_vec == NULL);
+ sendsig_sigcontext_vec = sendsig_sigcontext;
+#endif
+
+ return 0;
+}
+
+int
+kern_sig_16_fini(void)
+{
+ proc_t *p;
+ int error;
+
+ error = syscall_disestablish(NULL, kern_sig_16_syscalls);
+ if (error)
+ return error;
+ /*
+ * Ensure sendsig_sigcontext() is not being used.
+ * module_lock prevents the flag being set on any
+ * further processes while we are here. See
+ * sigaction1() for the opposing half.
+ */
+ mutex_enter(proc_lock);
+ PROCLIST_FOREACH(p, &allproc) {
+ if ((p->p_lflag & PL_SIGCOMPAT) != 0) {
+ break;
+ }
+ }
+ mutex_exit(proc_lock);
+ if (p != NULL) {
+ syscall_establish(NULL, kern_sig_16_syscalls);
+ return EBUSY;
+ }
+ sendsig_sigcontext_vec = NULL;
+
+#if defined(COMPAT_SIGCONTEXT)
+ /*
+ * The sigobject may persist if still in use, but
+ * is reference counted so will die eventually.
+ */
+ rw_enter(&exec_lock, RW_WRITER);
+ if (emul_netbsd_object != NULL) {
+ (*emul_netbsd_object->pgops->pgo_detach)(emul_netbsd_object);
+ }
+ emul_netbsd_object = NULL;
+ emul_netbsd.e_sigcode = NULL;
+ emul_netbsd.e_esigcode = NULL;
+ emul_netbsd.e_sigobject = NULL;
+ rw_exit(&exec_lock);
+#endif
+ return 0;
+}
+
diff --git a/sys/compat/common/kern_sig_43.c b/sys/compat/common/kern_sig_43.c
index edf835885c0..32893244821 100644
--- a/sys/compat/common/kern_sig_43.c
+++ b/sys/compat/common/kern_sig_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sig_43.c,v 1.34 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: kern_sig_43.c,v 1.35 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.34 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.35 2019/01/27 02:08:39 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -56,11 +56,15 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.34 2011/01/19 10:21:16 tsutsui Exp
#include <sys/core.h>
#include <sys/kauth.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
+#include <sys/compat_stub.h>
#include <sys/cpu.h>
#include <compat/sys/signal.h>
+#include <compat/common/compat_mod.h>
void compat_43_sigmask_to_sigset(const int *, sigset_t *);
void compat_43_sigset_to_sigmask(const sigset_t *, int *);
@@ -69,6 +73,15 @@ void compat_43_sigaction_to_sigvec(const struct sigaction *, struct sigvec *);
void compat_43_sigstack_to_sigaltstack(const struct sigstack *, struct sigaltstack *);
void compat_43_sigaltstack_to_sigstack(const struct sigaltstack *, struct sigstack *);
+static struct syscall_package kern_sig_43_syscalls[] = {
+ { SYS_compat_43_osigblock, 0, (sy_call_t *)compat_43_sys_sigblock },
+ { SYS_compat_43_osigsetmask, 0, (sy_call_t *)compat_43_sys_sigsetmask },
+ { SYS_compat_43_osigstack, 0, (sy_call_t *)compat_43_sys_sigstack },
+ { SYS_compat_43_osigvec, 0, (sy_call_t *)compat_43_sys_sigvec },
+ { SYS_compat_43_okillpg, 0, (sy_call_t *)compat_43_sys_killpg },
+ { 0, 0, NULL }
+};
+
void
compat_43_sigmask_to_sigset(const int *sm, sigset_t *ss)
{
@@ -247,9 +260,7 @@ compat_43_sys_killpg(struct lwp *l, const struct compat_43_sys_killpg_args *uap,
ksiginfo_t ksi;
int pgid = SCARG(uap, pgid);
-#ifdef COMPAT_09
- pgid &= 0xffff;
-#endif
+ pgid &= kern_sig_43_pgid_mask;
if ((u_int)SCARG(uap, signum) >= NSIG)
return (EINVAL);
@@ -260,3 +271,17 @@ compat_43_sys_killpg(struct lwp *l, const struct compat_43_sys_killpg_args *uap,
ksi.ksi_uid = kauth_cred_geteuid(l->l_cred);
return killpg1(l, &ksi, pgid, 0);
}
+
+int
+kern_sig_43_init(void)
+{
+
+ return syscall_establish(NULL, kern_sig_43_syscalls);
+}
+
+int
+kern_sig_43_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_sig_43_syscalls);
+}
diff --git a/sys/compat/common/kern_time_30.c b/sys/compat/common/kern_time_30.c
index bc2c62c8aee..3c43a391e0a 100644
--- a/sys/compat/common/kern_time_30.c
+++ b/sys/compat/common/kern_time_30.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time_30.c,v 1.6 2018/10/30 14:43:38 riastradh Exp $ */
+/* $NetBSD: kern_time_30.c,v 1.7 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,9 +36,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.6 2018/10/30 14:43:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.7 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
#include "opt_ntp.h"
#endif
@@ -46,18 +47,26 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.6 2018/10/30 14:43:38 riastradh E
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/timex.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+#include <sys/compat_stub.h>
+#include <compat/common/compat_mod.h>
#include <compat/common/compat_util.h>
#include <compat/sys/time.h>
#include <compat/sys/timex.h>
-#include <sys/syscallargs.h>
+static const struct syscall_package kern_time_30_syscalls[] = {
+ { SYS_compat_30_ntp_gettime, 0,
+ (sy_call_t *)compat_30_sys_ntp_gettime },
+ { 0, 0, NULL }
+};
int
compat_30_sys_ntp_gettime(struct lwp *l,
const struct compat_30_sys_ntp_gettime_args *uap, register_t *retval)
{
-#ifdef NTP
/* {
syscallarg(struct ntptimeval30 *) ontvp;
} */
@@ -66,8 +75,11 @@ compat_30_sys_ntp_gettime(struct lwp *l,
struct timeval tv;
int error;
+ if (vec_ntp_gettime == NULL)
+ return ENOSYS;
+
if (SCARG(uap, ntvp)) {
- ntp_gettime(&ntv);
+ (*vec_ntp_gettime)(&ntv);
memset(&ntv30, 0, sizeof(ntv30));
TIMESPEC_TO_TIMEVAL(&tv, &ntv.time);
timeval_to_timeval50(&tv, &ntv30.time);
@@ -78,9 +90,20 @@ compat_30_sys_ntp_gettime(struct lwp *l,
if (error)
return error;
}
- *retval = ntp_timestatus();
+ *retval = (*vec_ntp_timestatus)();
return 0;
-#else
- return ENOSYS;
-#endif
+}
+
+int
+kern_time_30_init(void)
+{
+
+ return syscall_establish(NULL, kern_time_30_syscalls);
+}
+
+int
+kern_time_30_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_time_30_syscalls);
}
diff --git a/sys/compat/common/kern_time_50.c b/sys/compat/common/kern_time_50.c
index 181c0dd2ee2..0920d0152e9 100644
--- a/sys/compat/common/kern_time_50.c
+++ b/sys/compat/common/kern_time_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time_50.c,v 1.32 2018/10/30 14:35:16 riastradh Exp $ */
+/* $NetBSD: kern_time_50.c,v 1.33 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,9 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.32 2018/10/30 14:35:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.33 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
#include "opt_aio.h"
#include "opt_ntp.h"
#include "opt_mqueue.h"
@@ -56,9 +57,12 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.32 2018/10/30 14:35:16 riastradh
#include <sys/clockctl.h>
#include <sys/aio.h>
#include <sys/poll.h>
+#include <sys/syscall.h>
#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
#include <sys/sysctl.h>
#include <sys/resource.h>
+#include <sys/compat_stub.h>
#include <compat/common/compat_util.h>
#include <compat/common/compat_mod.h>
@@ -69,6 +73,39 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.32 2018/10/30 14:35:16 riastradh
struct timeval50 boottime50;
+static struct sysctllog *kern_time_50_clog = NULL;
+
+static const struct syscall_package kern_time_50_syscalls[] = {
+ { 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_nanosleep, 0, (sy_call_t *)compat_50_sys_nanosleep },
+ { SYS_compat_50_gettimeofday, 0,
+ (sy_call_t *)compat_50_sys_gettimeofday },
+ { SYS_compat_50_settimeofday, 0,
+ (sy_call_t *)compat_50_sys_settimeofday },
+ { SYS_compat_50_adjtime, 0, (sy_call_t *)compat_50_sys_adjtime },
+ { 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_aio_suspend, 0,
+ (sy_call_t *)compat_50_sys_aio_suspend },
+ { 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_getrusage, 0, (sy_call_t *)compat_50_sys_getrusage },
+ { 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___ntp_gettime30, 0,
+ (sy_call_t *)compat_50_sys___ntp_gettime30 },
+ { 0, 0, NULL }
+};
+
int
compat_50_sys_clock_gettime(struct lwp *l,
const struct compat_50_sys_clock_gettime_args *uap, register_t *retval)
@@ -516,7 +553,9 @@ int
compat_50_sys___ntp_gettime30(struct lwp *l,
const struct compat_50_sys___ntp_gettime30_args *uap, register_t *retval)
{
-#ifdef NTP
+ if (vec_ntp_gettime == NULL)
+ return ENOSYS; /* No NTP available in kernel */
+
/* {
syscallarg(struct ntptimeval *) ntvp;
} */
@@ -525,7 +564,7 @@ compat_50_sys___ntp_gettime30(struct lwp *l,
int error;
if (SCARG(uap, ntvp)) {
- ntp_gettime(&ntv);
+ (*vec_ntp_gettime)(&ntv);
memset(&ntv50, 0, sizeof(ntv50));
timespec_to_timespec50(&ntv.time, &ntv50.time);
ntv50.maxerror = ntv.maxerror;
@@ -537,14 +576,11 @@ compat_50_sys___ntp_gettime30(struct lwp *l,
if (error)
return error;
}
- *retval = ntp_timestatus();
+ *retval = (*vec_ntp_timestatus)();
return 0;
-#else
- return ENOSYS;
-#endif
}
-void
+static void
compat_sysctl_time(struct sysctllog **clog)
{
struct timeval tv;
@@ -559,3 +595,29 @@ compat_sysctl_time(struct sysctllog **clog)
NULL, 0, &boottime50, sizeof(boottime50),
CTL_KERN, KERN_OBOOTTIME, CTL_EOL);
}
+
+int
+kern_time_50_init(void)
+{
+ int error;
+
+ compat_sysctl_time(&kern_time_50_clog);
+
+ error = syscall_establish(NULL, kern_time_50_syscalls);
+ if (error != 0)
+ sysctl_teardown(&kern_time_50_clog);
+
+ return error;
+}
+
+int
+kern_time_50_fini(void)
+{
+ int error;
+
+ error = syscall_disestablish(NULL, kern_time_50_syscalls);
+ if (error == 0)
+ sysctl_teardown(&kern_time_50_clog);
+
+ return error;
+}
diff --git a/sys/compat/common/kern_time_60.c b/sys/compat/common/kern_time_60.c
index 60943ee3e1e..99e366d9023 100644
--- a/sys/compat/common/kern_time_60.c
+++ b/sys/compat/common/kern_time_60.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time_60.c,v 1.1 2013/03/29 01:02:50 christos Exp $ */
+/* $NetBSD: kern_time_60.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -29,18 +29,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_60.c,v 1.1 2013/03/29 01:02:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_60.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lwp.h>
#include <sys/time.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>
+static const struct syscall_package compat_60_syscalls[] = {
+ { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },
+ { 0, 0, NULL }
+};
+
int
compat_60_sys__lwp_park(struct lwp *l,
const struct compat_60_sys__lwp_park_args *uap, register_t *retval)
@@ -72,3 +82,17 @@ compat_60_sys__lwp_park(struct lwp *l,
return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp, SCARG(uap, hint));
}
+
+int
+kern_time_60_init(void)
+{
+
+ return syscall_establish(NULL, compat_60_syscalls);
+}
+
+int
+kern_time_60_fini(void)
+{
+
+ return syscall_disestablish(NULL, compat_60_syscalls);
+}
diff --git a/sys/compat/common/kern_xxx_12.c b/sys/compat/common/kern_xxx_12.c
index 5bbfae384af..202ae2436f4 100644
--- a/sys/compat/common/kern_xxx_12.c
+++ b/sys/compat/common/kern_xxx_12.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_xxx_12.c,v 1.15 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: kern_xxx_12.c,v 1.16 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -33,20 +33,32 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_xxx_12.c,v 1.15 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_xxx_12.c,v 1.16 2019/01/27 02:08:39 pgoyette Exp $");
-/*#ifdef COMPAT_12*/
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/reboot.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/kauth.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package kern_xxx_12_syscalls[] = {
+ { SYS_compat_12_oreboot, 0, (sy_call_t *)compat_12_sys_reboot },
+ { 0, 0, NULL }
+};
+
/* ARGSUSED */
int
-compat_12_sys_reboot(struct lwp *l, const struct compat_12_sys_reboot_args *uap, register_t *retval)
+compat_12_sys_reboot(struct lwp *l,
+ const struct compat_12_sys_reboot_args *uap, register_t *retval)
{
/* {
syscallarg(int) opt;
@@ -61,4 +73,17 @@ compat_12_sys_reboot(struct lwp *l, const struct compat_12_sys_reboot_args *uap,
KERNEL_UNLOCK_ONE(NULL);
return (0);
}
-/*#endif COMPAT_12 */
+
+int
+kern_xxx_12_init(void)
+{
+
+ return syscall_establish(NULL, kern_xxx_12_syscalls);
+}
+
+int
+kern_xxx_12_fini(void)
+{
+
+ return syscall_disestablish(NULL, kern_xxx_12_syscalls);
+}
diff --git a/sys/compat/common/rndpseudo_50.c b/sys/compat/common/rndpseudo_50.c
index 7929a087e31..bcc8596829e 100644
--- a/sys/compat/common/rndpseudo_50.c
+++ b/sys/compat/common/rndpseudo_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rndpseudo_50.c,v 1.2 2012/08/03 07:51:21 matt Exp $ */
+/* $NetBSD: rndpseudo_50.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -30,18 +30,21 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rndpseudo_50.c,v 1.2 2012/08/03 07:51:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rndpseudo_50.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
-#include "opt_compat_netbsd32.h"
#endif
#include <sys/param.h>
#include <sys/file.h>
#include <sys/rnd.h>
+#include <sys/module_hook.h>
+#include <sys/compat_stub.h>
+
#include <compat/sys/rnd.h>
+#include <compat/common/compat_mod.h>
/*
* Convert from rndsource_t to rndsource50_t, for the results from
@@ -57,22 +60,6 @@ rndsource_to_rndsource50(rndsource_t *r, rndsource50_t *r50)
r50->flags = r->flags;
}
-#if defined(COMPAT_NETBSD32) && defined(_LP64)
-/*
- * Convert from rndsource_t to rndsource50_32_t, for the results from
- * RNDGETNUM50_32 and RNDGETNAME50_32.
- */
-static void
-rndsource_to_rndsource50_32(rndsource_t *r, rndsource50_32_t *r50_32)
-{
- memset(r50_32, 0, sizeof(*r50_32));
- strlcpy(r50_32->name, r->name, sizeof(r50_32->name));
- r50_32->total = r->total;
- r50_32->type = r->type;
- r50_32->flags = r->flags;
-}
-#endif /* COMPAT_NETBSD32 */
-
/*
* COMPAT_50 handling for rnd_ioctl. This is called from rnd_ioctl.
*
@@ -110,33 +97,6 @@ compat_50_rnd_ioctl(struct file *fp, u_long cmd, void *addr)
break;
}
-#if defined(COMPAT_NETBSD32) && defined(_LP64)
- case RNDGETSRCNUM50_32:
- {
- rndstat_t rstbuf = {.start = 0};
- rndstat50_32_t *rst50_32 = (rndstat50_32_t *)addr;
- int count;
-
- if (rst50_32->count > RND_MAXSTATCOUNT50)
- return (EINVAL);
-
- rstbuf.start = rst50_32->start;
- rstbuf.count = rst50_32->count;
-
- ret = (fp->f_ops->fo_ioctl)(fp, RNDGETSRCNUM, &rstbuf);
- if (ret != 0)
- return ret;
-
- for (count = 0; count < rst50_32->count; count++) {
- rndsource_to_rndsource50_32(&rstbuf.source[count],
- &rst50_32->source[count]);
- }
- rst50_32->count = rstbuf.count;
-
- break;
- }
-#endif /* COMPAT_NETBSD32 */
-
case RNDGETSRCNAME50:
{
rndstat_name_t rstnmbuf = {.name[0] = 0};
@@ -154,29 +114,23 @@ compat_50_rnd_ioctl(struct file *fp, u_long cmd, void *addr)
break;
}
-#if defined(COMPAT_NETBSD32) && defined(_LP64)
- case RNDGETSRCNAME50_32:
- {
- rndstat_name_t rstnmbuf = {.name[0] = 0};
- rndstat_name50_32_t *rstnm50_32;
- rstnm50_32 = (rndstat_name50_32_t *)addr;
-
- strlcpy(rstnmbuf.name, rstnm50_32->name, sizeof(rstnmbuf.name));
-
- ret = (fp->f_ops->fo_ioctl)(fp, RNDGETSRCNAME, &rstnmbuf);
- if (ret != 0)
- return ret;
-
- rndsource_to_rndsource50_32(&rstnmbuf.source,
- &rstnm50_32->source);
-
- break;
- }
-#endif
-
default:
return ENOTTY;
}
return ret;
}
+
+void
+rndpseudo_50_init(void)
+{
+
+ MODULE_SET_HOOK(rnd_ioctl_50_hook, "rnd_50", compat_50_rnd_ioctl);
+}
+
+void
+rndpseudo_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(rnd_ioctl_50_hook);
+}
diff --git a/sys/compat/common/rtsock_14.c b/sys/compat/common/rtsock_14.c
index 165e7821e05..48a793d7731 100644
--- a/sys/compat/common/rtsock_14.c
+++ b/sys/compat/common/rtsock_14.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock_14.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $ */
+/* $NetBSD: rtsock_14.c,v 1.6 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.6 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -77,6 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.5 2016/11/03 03:37:06 riastradh Exp
#include <sys/protosw.h>
#include <sys/sysctl.h>
#include <sys/kauth.h>
+#include <sys/compat_stub.h>
#ifdef RTSOCK_DEBUG
#include <netinet/in.h>
#endif /* RTSOCK_DEBUG */
@@ -88,6 +93,8 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.5 2016/11/03 03:37:06 riastradh Exp
#include <compat/net/if.h>
#include <compat/net/route.h>
+#include <compat/common/compat_mod.h>
+
void
compat_14_rt_oifmsg(struct ifnet *ifp)
{
@@ -165,3 +172,19 @@ compat_14_iflist(struct ifnet *ifp, struct rt_walkarg *w,
w->w_where = (char *)w->w_where + len;
return 0;
}
+
+void
+rtsock_14_init(void)
+{
+
+ MODULE_SET_HOOK(rtsock_14_oifmsg_hook, "rts_14", compat_14_rt_oifmsg);
+ MODULE_SET_HOOK(rtsock_14_iflist_hook, "rts_14", compat_14_iflist);
+}
+
+void
+rtsock_14_fini(void)
+{
+
+ MODULE_UNSET_HOOK(rtsock_14_oifmsg_hook);
+ MODULE_UNSET_HOOK(rtsock_14_iflist_hook);
+}
diff --git a/sys/compat/common/rtsock_50.c b/sys/compat/common/rtsock_50.c
index a896fed2a34..1c4e7683ec5 100644
--- a/sys/compat/common/rtsock_50.c
+++ b/sys/compat/common/rtsock_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock_50.c,v 1.7 2018/05/10 09:33:46 nonaka Exp $ */
+/* $NetBSD: rtsock_50.c,v 1.8 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,23 +61,15 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.7 2018/05/10 09:33:46 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.8 2019/01/27 02:08:39 pgoyette Exp $");
-#ifdef _KERNEL_OPT
-#include "opt_compat_netbsd.h"
-#endif
+#define COMPAT_RTSOCK /* Use the COMPATNAME/COMPATCALL macros and the
+ * various other compat definitions - see
+ * sys/net/rtsock_shared.c for details
+ */
-/*
- * COMPAT_50 and COMPAT_RTSOCK must be defined for rtsock.c regardless of
- * the currently enabled options.
- */
-#ifndef COMPAT_50
-#define COMPAT_50
-#endif
-
-#define COMPAT_RTSOCK
-
-#include <net/rtsock.c>
+#include <net/rtsock_shared.c>
+#include <compat/net/route_50.h>
void
compat_50_rt_oifmsg(struct ifnet *ifp)
@@ -156,3 +148,33 @@ compat_50_iflist(struct ifnet *ifp, struct rt_walkarg *w,
w->w_where = (char *)w->w_where + len;
return 0;
}
+
+void
+rtsock_50_init(void)
+{
+
+ MODULE_SET_HOOK(rtsock_50_iflist_hook, "rts_50", compat_50_iflist);
+ MODULE_SET_HOOK(rtsock_50_oifmsg_hook, "rts_50", compat_50_rt_oifmsg);
+ MODULE_SET_HOOK(rtsock_50_rt_missmsg_hook, "rts_50",
+ compat_50_rt_missmsg);
+ MODULE_SET_HOOK(rtsock_50_rt_ifmsg_hook, "rts_50", compat_50_rt_ifmsg);
+ MODULE_SET_HOOK(rtsock_50_rt_newaddrmsg_hook, "rts_50",
+ compat_50_rt_newaddrmsg);
+ MODULE_SET_HOOK(rtsock_50_rt_ifannouncemsg_hook, "rts_50",
+ compat_50_rt_ifannouncemsg);
+ MODULE_SET_HOOK(rtsock_50_rt_ieee80211msg_hook, "rts_50",
+ compat_50_rt_ieee80211msg);
+}
+
+void
+rtsock_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(rtsock_50_iflist_hook);
+ MODULE_UNSET_HOOK(rtsock_50_oifmsg_hook);
+ MODULE_UNSET_HOOK(rtsock_50_rt_missmsg_hook);
+ MODULE_UNSET_HOOK(rtsock_50_rt_ifmsg_hook);
+ MODULE_UNSET_HOOK(rtsock_50_rt_newaddrmsg_hook);
+ MODULE_UNSET_HOOK(rtsock_50_rt_ifannouncemsg_hook);
+ MODULE_UNSET_HOOK(rtsock_50_rt_ieee80211msg_hook);
+}
diff --git a/sys/compat/common/rtsock_70.c b/sys/compat/common/rtsock_70.c
index d88528020ae..2f5986cf4ff 100644
--- a/sys/compat/common/rtsock_70.c
+++ b/sys/compat/common/rtsock_70.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock_70.c,v 1.2 2017/12/16 09:10:30 maxv Exp $ */
+/* $NetBSD: rtsock_70.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,18 +30,21 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.2 2017/12/16 09:10:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
#endif
#include <sys/mbuf.h>
+#include <sys/compat_stub.h>
+
#include <net/if.h>
#include <net/route.h>
#include <compat/net/if.h>
#include <compat/net/route.h>
+#include <compat/net/route_70.h>
void
compat_70_rt_newaddrmsg1(int cmd, struct ifaddr *ifa)
@@ -111,3 +114,20 @@ compat_70_iflist_addr(struct rt_walkarg *w, struct ifaddr *ifa,
}
return error;
}
+
+void
+rtsock_70_init(void)
+{
+
+ MODULE_SET_HOOK(rtsock_70_newaddr_hook, "rts_70",
+ compat_70_rt_newaddrmsg1);
+ MODULE_SET_HOOK(rtsock_70_iflist_hook, "rts_70", compat_70_iflist_addr);
+}
+
+void
+rtsock_70_fini(void)
+{
+
+ MODULE_UNSET_HOOK(rtsock_70_newaddr_hook);
+ MODULE_UNSET_HOOK(rtsock_70_iflist_hook);
+}
diff --git a/sys/compat/common/sysmon_power_40.c b/sys/compat/common/sysmon_power_40.c
new file mode 100644
index 00000000000..3f9f1a999a2
--- /dev/null
+++ b/sys/compat/common/sysmon_power_40.c
@@ -0,0 +1,108 @@
+/* $NetBSD: sysmon_power_40.c,v 1.2 2019/01/27 02:08:39 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.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#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)
+{
+
+ MODULE_SET_HOOK(compat_sysmon_power_40_hook, "smon60",
+ compat_40_sysmon_power);
+}
+
+void
+sysmon_power_40_fini(void)
+{
+
+ MODULE_UNSET_HOOK(compat_sysmon_power_40_hook);
+}
diff --git a/sys/compat/common/sysv_ipc_50.c b/sys/compat/common/sysv_ipc_50.c
index 4262bb3f147..a8f6b980e01 100644
--- a/sys/compat/common/sysv_ipc_50.c
+++ b/sys/compat/common/sysv_ipc_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_ipc_50.c,v 1.5 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: sysv_ipc_50.c,v 1.6 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.c,v 1.5 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.c,v 1.6 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_sysv.h"
@@ -58,7 +58,6 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.c,v 1.5 2018/09/03 16:29:29 riastradh Ex
#include <sys/sysctl.h>
#include <sys/kauth.h>
-#ifdef COMPAT_50
#include <compat/sys/ipc.h>
#ifdef SYSVMSG
#include <compat/sys/msg.h>
@@ -74,8 +73,6 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.c,v 1.5 2018/09/03 16:29:29 riastradh Ex
* Check for ipc permission
*/
-int sysctl_kern_sysvipc50(SYSCTLFN_PROTO);
-
int
sysctl_kern_sysvipc50(SYSCTLFN_ARGS)
{
@@ -215,4 +212,3 @@ sysctl_kern_sysvipc50(SYSCTLFN_ARGS)
free(bf, M_TEMP);
return error;
}
-#endif /* COMPAT_50 */
diff --git a/sys/compat/common/sysv_msg_14.c b/sys/compat/common/sysv_msg_14.c
index e1741e7528a..5b907cef9d5 100644
--- a/sys/compat/common/sysv_msg_14.c
+++ b/sys/compat/common/sysv_msg_14.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_msg_14.c,v 1.19 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: sysv_msg_14.c,v 1.20 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_msg_14.c,v 1.19 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_msg_14.c,v 1.20 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/compat/common/sysv_msg_50.c b/sys/compat/common/sysv_msg_50.c
index 5d82fc7e542..bc54d2924a6 100644
--- a/sys/compat/common/sysv_msg_50.c
+++ b/sys/compat/common/sysv_msg_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_msg_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: sysv_msg_50.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_msg_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_msg_50.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/compat/common/sysv_sem_14.c b/sys/compat/common/sysv_sem_14.c
index 0ad2415c0e8..4ff03f80214 100644
--- a/sys/compat/common/sysv_sem_14.c
+++ b/sys/compat/common/sysv_sem_14.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_sem_14.c,v 1.16 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: sysv_sem_14.c,v 1.17 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_sem_14.c,v 1.16 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_sem_14.c,v 1.17 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/compat/common/sysv_sem_50.c b/sys/compat/common/sysv_sem_50.c
index 5cda9023d24..45488c81618 100644
--- a/sys/compat/common/sysv_sem_50.c
+++ b/sys/compat/common/sysv_sem_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_sem_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: sysv_sem_50.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_sem_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_sem_50.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/compat/common/sysv_shm_14.c b/sys/compat/common/sysv_shm_14.c
index 15800d51e8c..641a4aeb348 100644
--- a/sys/compat/common/sysv_shm_14.c
+++ b/sys/compat/common/sysv_shm_14.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_shm_14.c,v 1.17 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: sysv_shm_14.c,v 1.18 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_shm_14.c,v 1.17 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_shm_14.c,v 1.18 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/compat/common/sysv_shm_50.c b/sys/compat/common/sysv_shm_50.c
index df5fe128d6d..18129fc4c25 100644
--- a/sys/compat/common/sysv_shm_50.c
+++ b/sys/compat/common/sysv_shm_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_shm_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: sysv_shm_50.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_shm_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_shm_50.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/compat/common/tty_43.c b/sys/compat/common/tty_43.c
index 8564efb4f5e..4294e6cb718 100644
--- a/sys/compat/common/tty_43.c
+++ b/sys/compat/common/tty_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_43.c,v 1.30 2014/05/22 16:31:19 dholland Exp $ */
+/* $NetBSD: tty_43.c,v 1.31 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.30 2014/05/22 16:31:19 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.31 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -76,6 +80,8 @@ __KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.30 2014/05/22 16:31:19 dholland Exp $")
#include <sys/syslog.h>
#include <sys/ioctl_compat.h>
+#include <compat/common/compat_mod.h>
+
int ttydebug = 0;
static const struct speedtab compatspeeds[] = {
@@ -505,3 +511,17 @@ ttcompatsetlflags(struct tty *tp, struct termios *t)
t->c_lflag = lflag;
t->c_cflag = cflag;
}
+
+int
+tty_43_init(void)
+{
+
+ return 0;
+}
+
+int
+tty_43_fini(void)
+{
+
+ return 0;
+}
diff --git a/sys/compat/common/tty_60.c b/sys/compat/common/tty_60.c
index 7ec3d19bd9f..31316e6e57c 100644
--- a/sys/compat/common/tty_60.c
+++ b/sys/compat/common/tty_60.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_60.c,v 1.4 2015/10/22 15:18:25 christos Exp $ */
+/* $NetBSD: tty_60.c,v 1.5 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.4 2015/10/22 15:18:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.5 2019/01/27 02:08:39 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -41,11 +41,12 @@ __KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.4 2015/10/22 15:18:25 christos Exp $");
#include <sys/conf.h>
#include <sys/errno.h>
#include <sys/systm.h>
+#include <sys/compat_stub.h>
#include <sys/tty.h>
-#include <compat/sys/ttycom.h>
-#ifdef COMPAT_60
+#include <compat/common/compat_mod.h>
+#include <compat/sys/ttycom.h>
/* convert struct ptmget to struct compat_60_ptmget */
static int
@@ -92,14 +93,14 @@ compat_60_ptmget_ioctl(dev_t dev, u_long cmd, void *data, int flag,
* COMPAT_60 versions of ttioctl and ptmioctl.
*/
int
-compat_60_ttioctl(struct tty *tp, u_long cmd, void *data, int flag,
+compat_60_ttioctl(dev_t dev, u_long cmd, void *data, int flag,
struct lwp *l)
{
switch (cmd) {
case COMPAT_60_TIOCPTMGET:
case COMPAT_60_TIOCPTSNAME:
- return compat_60_ptmget_ioctl(tp->t_dev, cmd, data, flag, l);
+ return compat_60_ptmget_ioctl(dev, cmd, data, flag, l);
default:
return EPASSTHROUGH;
}
@@ -117,4 +118,17 @@ compat_60_ptmioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
}
}
-#endif /* COMPAT_60 */
+void
+kern_tty_60_init(void)
+{
+
+ MODULE_SET_HOOK(compat_60_ttioctl_hook, "tty_60", compat_60_ttioctl);
+ MODULE_SET_HOOK(compat_60_ptmioctl_hook, "tty_60", compat_60_ptmioctl);
+}
+
+void
+kern_tty_60_fini(void)
+{
+ MODULE_UNSET_HOOK(compat_60_ttioctl_hook);
+ MODULE_UNSET_HOOK(compat_60_ptmioctl_hook);
+}
diff --git a/sys/compat/common/uipc_syscalls_30.c b/sys/compat/common/uipc_syscalls_30.c
index beabc30f4fb..7c8f56ade0d 100644
--- a/sys/compat/common/uipc_syscalls_30.c
+++ b/sys/compat/common/uipc_syscalls_30.c
@@ -1,9 +1,13 @@
-/* $NetBSD: uipc_syscalls_30.c,v 1.3 2007/12/20 23:02:45 dsl Exp $ */
+/* $NetBSD: uipc_syscalls_30.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $ */
/* written by Pavel Cahyna, 2006. Public domain. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_30.c,v 1.3 2007/12/20 23:02:45 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_30.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
/*
* System call interface to the socket abstraction.
@@ -14,11 +18,21 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_30.c,v 1.3 2007/12/20 23:02:45 dsl Exp
#include <sys/msg.h>
#include <sys/sysctl.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/errno.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package uipc_syscalls_30_syscalls[] = {
+ { SYS_compat_30_socket, 0, (sy_call_t *)compat_30_sys_socket },
+ { 0, 0, NULL}
+};
+
int
-compat_30_sys_socket(struct lwp *l, const struct compat_30_sys_socket_args *uap, register_t *retval)
+compat_30_sys_socket(struct lwp *l,
+ const struct compat_30_sys_socket_args *uap, register_t *retval)
{
int error;
@@ -28,3 +42,17 @@ compat_30_sys_socket(struct lwp *l, const struct compat_30_sys_socket_args *uap,
return (error);
}
+
+int
+uipc_syscalls_30_init(void)
+{
+
+ return syscall_establish(NULL, uipc_syscalls_30_syscalls);
+}
+
+int
+uipc_syscalls_30_fini(void)
+{
+
+ return syscall_disestablish(NULL, uipc_syscalls_30_syscalls);
+}
diff --git a/sys/compat/common/uipc_syscalls_40.c b/sys/compat/common/uipc_syscalls_40.c
index 7991da715ba..87f6b0542e9 100644
--- a/sys/compat/common/uipc_syscalls_40.c
+++ b/sys/compat/common/uipc_syscalls_40.c
@@ -1,9 +1,13 @@
-/* $NetBSD: uipc_syscalls_40.c,v 1.16 2018/04/12 18:50:13 christos Exp $ */
+/* $NetBSD: uipc_syscalls_40.c,v 1.17 2019/01/27 02:08:39 pgoyette Exp $ */
/* written by Pavel Cahyna, 2006. Public domain. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.16 2018/04/12 18:50:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.17 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
/*
* System call interface to the socket abstraction.
@@ -15,12 +19,15 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.16 2018/04/12 18:50:13 christ
#include <sys/sysctl.h>
#include <sys/syscallargs.h>
#include <sys/errno.h>
+#include <sys/compat_stub.h>
#include <net/if.h>
#include <compat/sys/socket.h>
#include <compat/sys/sockio.h>
+#include <compat/common/compat_mod.h>
+
/*
* Return interface configuration
* of system. List may be used
@@ -29,7 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.16 2018/04/12 18:50:13 christ
*/
/*ARGSUSED*/
static int
-compat_ifconf(struct lwp *l, u_long cmd, void *data)
+compat_ifconf(u_long cmd, void *data)
{
struct oifconf *ifc = data;
struct ifnet *ifp;
@@ -158,14 +165,16 @@ release_exit:
return error;
}
-void
+void
uipc_syscalls_40_init(void)
{
- vec_compat_ifconf = compat_ifconf;
+
+ MODULE_SET_HOOK(uipc_syscalls_40_hook, "uipc40", compat_ifconf);
}
-
+
void
uipc_syscalls_40_fini(void)
{
- vec_compat_ifconf = (void *)enosys;
+
+ MODULE_UNSET_HOOK(uipc_syscalls_40_hook);
}
diff --git a/sys/compat/common/uipc_syscalls_43.c b/sys/compat/common/uipc_syscalls_43.c
index 9640ae0f67e..4850d5b065d 100644
--- a/sys/compat/common/uipc_syscalls_43.c
+++ b/sys/compat/common/uipc_syscalls_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls_43.c,v 1.50 2018/09/06 06:41:59 maxv Exp $ */
+/* $NetBSD: uipc_syscalls_43.c,v 1.51 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.50 2018/09/06 06:41:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.51 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -52,6 +56,8 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.50 2018/09/06 06:41:59 maxv E
#include <sys/protosw.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <net/if.h>
@@ -69,6 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.50 2018/09/06 06:41:59 maxv E
#include <compat/sys/sockio.h>
#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
#include <uvm/uvm_extern.h>
@@ -78,6 +85,20 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.50 2018/09/06 06:41:59 maxv E
* connect(2), bind(2), sendto(2)
*/
+static struct syscall_package uipc_syscalls_43_syscalls[] = {
+ { SYS_compat_43_oaccept, 0, (sy_call_t *)compat_43_sys_accept },
+ { SYS_compat_43_ogetpeername, 0,
+ (sy_call_t *)compat_43_sys_getpeername },
+ { SYS_compat_43_ogetsockname, 0,
+ (sy_call_t *)compat_43_sys_getsockname },
+ { SYS_compat_43_orecv, 0, (sy_call_t *)compat_43_sys_recv },
+ { SYS_compat_43_orecvfrom, 0, (sy_call_t *)compat_43_sys_recvfrom },
+ { SYS_compat_43_orecvmsg, 0, (sy_call_t *)compat_43_sys_recvmsg },
+ { SYS_compat_43_osend, 0, (sy_call_t *)compat_43_sys_send },
+ { SYS_compat_43_osendmsg, 0, (sy_call_t *)compat_43_sys_sendmsg },
+ { 0, 0, NULL }
+};
+
static int compat_43_sa_put(void *);
int
@@ -398,3 +419,17 @@ compat_43_sa_put(void *from)
return (0);
}
+
+int
+uipc_syscalls_43_init(void)
+{
+
+ return syscall_establish(NULL, uipc_syscalls_43_syscalls);
+}
+
+int
+uipc_syscalls_43_fini(void)
+{
+
+ return syscall_disestablish(NULL, uipc_syscalls_43_syscalls);
+}
diff --git a/sys/compat/common/uipc_syscalls_50.c b/sys/compat/common/uipc_syscalls_50.c
index 9a45df1e3f2..5fb59181bbc 100644
--- a/sys/compat/common/uipc_syscalls_50.c
+++ b/sys/compat/common/uipc_syscalls_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls_50.c,v 1.6 2018/09/12 02:24:25 msaitoh Exp $ */
+/* $NetBSD: uipc_syscalls_50.c,v 1.7 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.6 2018/09/12 02:24:25 msaitoh Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/kernel.h>
@@ -48,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.6 2018/09/12 02:24:25 msaitoh
#include <sys/kauth.h>
#include <sys/proc.h>
#include <sys/time.h>
+#include <sys/compat_stub.h>
#include <net/if.h>
@@ -55,6 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.6 2018/09/12 02:24:25 msaitoh
#include <compat/sys/socket.h>
#include <compat/sys/sockio.h>
+#include <compat/common/compat_mod.h>
+
/*ARGSUSED*/
static int
compat_ifdatareq(struct lwp *l, u_long cmd, void *data)
@@ -109,11 +115,13 @@ compat_ifdatareq(struct lwp *l, u_long cmd, void *data)
void
uipc_syscalls_50_init(void)
{
- vec_compat_ifdatareq = compat_ifdatareq;
+
+ MODULE_SET_HOOK(uipc_syscalls_50_hook, "uipc50", compat_ifdatareq);
}
void
uipc_syscalls_50_fini(void)
{
- vec_compat_ifdatareq = (void *)enosys;
+
+ MODULE_UNSET_HOOK(uipc_syscalls_50_hook);
}
diff --git a/sys/compat/common/uipc_usrreq_70.c b/sys/compat/common/uipc_usrreq_70.c
index 42dd9858075..b0f9e66e020 100644
--- a/sys/compat/common/uipc_usrreq_70.c
+++ b/sys/compat/common/uipc_usrreq_70.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_usrreq_70.c,v 1.1 2016/04/06 19:45:45 roy Exp $ */
+/* $NetBSD: uipc_usrreq_70.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq_70.c,v 1.1 2016/04/06 19:45:45 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq_70.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/lwp.h>
@@ -39,10 +43,10 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_usrreq_70.c,v 1.1 2016/04/06 19:45:45 roy Exp $
#include <sys/unpcb.h>
#include <sys/mbuf.h>
#include <sys/kauth.h>
+#include <sys/compat_stub.h>
#include <compat/sys/socket.h>
-#ifdef COMPAT_SOCKCRED70
struct mbuf *
compat_70_unp_addsockcred(struct lwp *l, struct mbuf *control)
{
@@ -52,8 +56,9 @@ compat_70_unp_addsockcred(struct lwp *l, struct mbuf *control)
m = sbcreatecontrol1(&p, SOCKCRED70SIZE(kauth_cred_ngroups(l->l_cred)),
SCM_OCREDS, SOL_SOCKET, M_WAITOK);
- if (m == NULL)
+ if (m == NULL) {
return control;
+ }
sc = p;
sc->sc_uid = kauth_cred_getuid(l->l_cred);
@@ -67,4 +72,18 @@ compat_70_unp_addsockcred(struct lwp *l, struct mbuf *control)
return m_add(control, m);
}
-#endif
+
+void
+uipc_usrreq_70_init(void)
+{
+
+ MODULE_SET_HOOK(compat_70_unp_hook, "unp_70",
+ compat_70_unp_addsockcred);
+}
+
+void
+uipc_usrreq_70_fini(void)
+{
+
+ MODULE_UNSET_HOOK(compat_70_unp_hook);
+}
diff --git a/sys/compat/common/usb_subr_30.c b/sys/compat/common/usb_subr_30.c
new file mode 100644
index 00000000000..624737233f0
--- /dev/null
+++ b/sys/compat/common/usb_subr_30.c
@@ -0,0 +1,246 @@
+/* $NetBSD: usb_subr_30.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
+
+/*
+ * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lennart@augustsson.net) at
+ * Carlstedt Research & Technology.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: usb_subr_30.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_usb.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/kmem.h>
+#include <sys/device.h>
+#include <sys/select.h>
+#include <sys/proc.h>
+
+#include <sys/bus.h>
+#include <sys/module.h>
+#include <sys/compat_stub.h>
+
+#include <compat/common/compat_mod.h>
+
+#include <dev/usb/usb.h>
+
+#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdi_util.h>
+#include <dev/usb/usbdivar.h>
+#include <dev/usb/usbdevs.h>
+#include <dev/usb/usb_quirks.h>
+#include <dev/usb/usb_verbose.h>
+#include <dev/usb/usbhist.h>
+
+Static void usb_copy_old_devinfo(struct usb_device_info_old *,
+ const struct usb_device_info *);
+
+Static void
+usb_copy_old_devinfo(struct usb_device_info_old *uo,
+ const struct usb_device_info *ue)
+{
+ const unsigned char *p;
+ unsigned char *q;
+ int i, n;
+
+ uo->udi_bus = ue->udi_bus;
+ uo->udi_addr = ue->udi_addr;
+ uo->udi_cookie = ue->udi_cookie;
+ for (i = 0, p = (const unsigned char *)ue->udi_product,
+ q = (unsigned char *)uo->udi_product;
+ *p && i < USB_MAX_STRING_LEN - 1; p++) {
+ if (*p < 0x80)
+ q[i++] = *p;
+ else {
+ q[i++] = '?';
+ if ((*p & 0xe0) == 0xe0)
+ p++;
+ p++;
+ }
+ }
+ q[i] = 0;
+
+ for (i = 0, p = ue->udi_vendor, q = uo->udi_vendor;
+ *p && i < USB_MAX_STRING_LEN - 1; p++) {
+ if (* p < 0x80)
+ q[i++] = *p;
+ else {
+ q[i++] = '?';
+ p++;
+ if ((*p & 0xe0) == 0xe0)
+ p++;
+ }
+ }
+ q[i] = 0;
+
+ memcpy(uo->udi_release, ue->udi_release, sizeof(uo->udi_release));
+
+ uo->udi_productNo = ue->udi_productNo;
+ uo->udi_vendorNo = ue->udi_vendorNo;
+ uo->udi_releaseNo = ue->udi_releaseNo;
+ uo->udi_class = ue->udi_class;
+ uo->udi_subclass = ue->udi_subclass;
+ uo->udi_protocol = ue->udi_protocol;
+ uo->udi_config = ue->udi_config;
+ uo->udi_speed = ue->udi_speed;
+ uo->udi_power = ue->udi_power;
+ uo->udi_nports = ue->udi_nports;
+
+ for (n=0; n<USB_MAX_DEVNAMES; n++)
+ memcpy(uo->udi_devnames[n],
+ ue->udi_devnames[n], USB_MAX_DEVNAMELEN);
+ memcpy(uo->udi_ports, ue->udi_ports, sizeof(uo->udi_ports));
+}
+
+static int
+usbd_fill_deviceinfo_old(struct usbd_device *dev,
+ struct usb_device_info_old *di, int usedev,
+ void (*do_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
+ size_t, int, int),
+ int (*do_printBCD)(char *cp, size_t l, int bcd))
+{
+ struct usbd_port *p;
+ int i, j, err;
+
+ di->udi_bus = device_unit(dev->ud_bus->ub_usbctl);
+ di->udi_addr = dev->ud_addr;
+ di->udi_cookie = dev->ud_cookie;
+ (*do_devinfo_vp)(dev, di->udi_vendor, sizeof(di->udi_vendor),
+ di->udi_product, sizeof(di->udi_product), usedev, 0);
+ (*do_printBCD)(di->udi_release, sizeof(di->udi_release),
+ UGETW(dev->ud_ddesc.bcdDevice));
+ di->udi_vendorNo = UGETW(dev->ud_ddesc.idVendor);
+ di->udi_productNo = UGETW(dev->ud_ddesc.idProduct);
+ di->udi_releaseNo = UGETW(dev->ud_ddesc.bcdDevice);
+ di->udi_class = dev->ud_ddesc.bDeviceClass;
+ di->udi_subclass = dev->ud_ddesc.bDeviceSubClass;
+ di->udi_protocol = dev->ud_ddesc.bDeviceProtocol;
+ di->udi_config = dev->ud_config;
+ di->udi_power = dev->ud_selfpowered ? 0 : dev->ud_power;
+ di->udi_speed = dev->ud_speed;
+
+ if (dev->ud_subdevlen > 0) {
+ for (i = 0, j = 0; i < dev->ud_subdevlen &&
+ j < USB_MAX_DEVNAMES; i++) {
+ if (!dev->ud_subdevs[i])
+ continue;
+ strncpy(di->udi_devnames[j],
+ device_xname(dev->ud_subdevs[i]), USB_MAX_DEVNAMELEN);
+ di->udi_devnames[j][USB_MAX_DEVNAMELEN-1] = '\0';
+ j++;
+ }
+ } else {
+ j = 0;
+ }
+ for (/* j is set */; j < USB_MAX_DEVNAMES; j++)
+ di->udi_devnames[j][0] = 0; /* empty */
+
+ if (!dev->ud_hub) {
+ di->udi_nports = 0;
+ return 0;
+ }
+
+ const int nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
+ for (i = 1; i <= __arraycount(di->udi_ports) && i <= nports;
+ i++) {
+ p = &dev->ud_hub->uh_ports[i - 1];
+ if (p->up_dev)
+ err = p->up_dev->ud_addr;
+ else {
+ const int s = UGETW(p->up_status.wPortStatus);
+ if (s & UPS_PORT_ENABLED)
+ err = USB_PORT_ENABLED;
+ else if (s & UPS_SUSPEND)
+ err = USB_PORT_SUSPENDED;
+ else if (s & UPS_PORT_POWER)
+ err = USB_PORT_POWERED;
+ else
+ err = USB_PORT_DISABLED;
+ }
+ di->udi_ports[i - 1] = err;
+ }
+ di->udi_nports = nports;
+
+ return 0;
+}
+
+static int
+usb_copy_to_old30(struct usb_event *ue, struct usb_event_old *ueo,
+ struct uio *uio)
+{
+
+ ueo->ue_type = ue->ue_type;
+ memcpy(&ueo->ue_time, &ue->ue_time, sizeof(struct timespec));
+ switch (ue->ue_type) {
+ case USB_EVENT_DEVICE_ATTACH:
+ case USB_EVENT_DEVICE_DETACH:
+ usb_copy_old_devinfo(&ueo->u.ue_device,
+ &ue->u.ue_device);
+ break;
+
+ case USB_EVENT_CTRLR_ATTACH:
+ case USB_EVENT_CTRLR_DETACH:
+ ueo->u.ue_ctrlr.ue_bus=ue->u.ue_ctrlr.ue_bus;
+ break;
+
+ case USB_EVENT_DRIVER_ATTACH:
+ case USB_EVENT_DRIVER_DETACH:
+ ueo->u.ue_driver.ue_cookie=ue->u.ue_driver.ue_cookie;
+ memcpy(ueo->u.ue_driver.ue_devname,
+ ue->u.ue_driver.ue_devname,
+ sizeof(ue->u.ue_driver.ue_devname));
+ break;
+ default:
+ ;
+ }
+
+ return 0;
+}
+
+void
+usb_30_init(void)
+{
+
+ MODULE_SET_HOOK(usb_subr_30_fill_hook, "usb_30",
+ usbd_fill_deviceinfo_old);
+ MODULE_SET_HOOK(usb_subr_30_copy_hook, "usb_30", usb_copy_to_old30);
+}
+
+void
+usb_30_fini(void)
+{
+
+ MODULE_UNSET_HOOK(usb_subr_30_fill_hook);
+ MODULE_UNSET_HOOK(usb_subr_30_copy_hook);
+}
diff --git a/sys/compat/common/uvm_13.c b/sys/compat/common/uvm_13.c
index 87033c50687..e8f92527df7 100644
--- a/sys/compat/common/uvm_13.c
+++ b/sys/compat/common/uvm_13.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_13.c,v 1.1 2018/03/15 03:13:51 christos Exp $ */
+/* $NetBSD: uvm_13.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_13.c,v 1.1 2018/03/15 03:13:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_13.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#if defined(_KERNEL) || defined(_MODULE)
#if defined(_KERNEL_OPT)
diff --git a/sys/compat/common/uvm_50.c b/sys/compat/common/uvm_50.c
index 53aecbaa53f..f2e8bfaafbc 100644
--- a/sys/compat/common/uvm_50.c
+++ b/sys/compat/common/uvm_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_50.c,v 1.1 2018/03/15 03:13:51 christos Exp $ */
+/* $NetBSD: uvm_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_50.c,v 1.1 2018/03/15 03:13:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#if defined(_KERNEL) || defined(_MODULE)
#if defined(_KERNEL_OPT)
diff --git a/sys/compat/common/vfs_syscalls_10.c b/sys/compat/common/vfs_syscalls_10.c
new file mode 100644
index 00000000000..747f8dc8159
--- /dev/null
+++ b/sys/compat/common/vfs_syscalls_10.c
@@ -0,0 +1,65 @@
+/* $NetBSD: vfs_syscalls_10.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_10.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/namei.h>
+#include <sys/vfs_syscalls.h>
+#include <sys/compat_stub.h>
+
+#include <compat/common/compat_mod.h>
+
+static int
+real_sys_openat_10(struct pathbuf **pb)
+{
+
+ *pb = pathbuf_create(".");
+ return (*pb == NULL ? ENOMEM : 0);
+}
+
+void vfs_syscalls_10_init(void)
+{
+
+ MODULE_SET_HOOK(compat_10_openat_hook, "openat_10", real_sys_openat_10);
+}
+
+void vfs_syscalls_10_fini(void)
+{
+
+ MODULE_UNSET_HOOK(compat_10_openat_hook);
+}
diff --git a/sys/compat/common/vfs_syscalls_12.c b/sys/compat/common/vfs_syscalls_12.c
index 6c34af46ae3..4ec2f1be974 100644
--- a/sys/compat/common/vfs_syscalls_12.c
+++ b/sys/compat/common/vfs_syscalls_12.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_12.c,v 1.36 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: vfs_syscalls_12.c,v 1.37 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.36 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.37 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -53,11 +57,24 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.36 2018/09/03 16:29:29 riastra
#include <sys/dirent.h>
#include <sys/vfs_syscalls.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <compat/sys/stat.h>
#include <compat/sys/dirent.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package vfs_syscalls_12_syscalls[] = {
+ { SYS_compat_12_fstat12, 0, (sy_call_t *)compat_12_sys_fstat },
+ { SYS_compat_12_getdirentries, 0,
+ (sy_call_t *)compat_12_sys_getdirentries },
+ { SYS_compat_12_lstat12, 0, (sy_call_t *)compat_12_sys_lstat },
+ { SYS_compat_12_stat12, 0, (sy_call_t *)compat_12_sys_stat },
+ { 0, 0, NULL }
+};
+
/*
* Convert from a new to an old stat structure.
*/
@@ -89,7 +106,8 @@ compat_12_stat_conv(const struct stat *st, struct stat12 *ost)
* Read a block of directory entries in a file system independent format.
*/
int
-compat_12_sys_getdirentries(struct lwp *l, const struct compat_12_sys_getdirentries_args *uap, register_t *retval)
+compat_12_sys_getdirentries(struct lwp *l,
+ const struct compat_12_sys_getdirentries_args *uap, register_t *retval)
{
/* {
syscallarg(int) fd;
@@ -245,7 +263,8 @@ out1:
*/
/* ARGSUSED */
int
-compat_12_sys_stat(struct lwp *l, const struct compat_12_sys_stat_args *uap, register_t *retval)
+compat_12_sys_stat(struct lwp *l, const struct compat_12_sys_stat_args *uap,
+ register_t *retval)
{
/* {
syscallarg(const char *) path;
@@ -269,7 +288,8 @@ compat_12_sys_stat(struct lwp *l, const struct compat_12_sys_stat_args *uap, reg
*/
/* ARGSUSED */
int
-compat_12_sys_lstat(struct lwp *l, const struct compat_12_sys_lstat_args *uap, register_t *retval)
+compat_12_sys_lstat(struct lwp *l, const struct compat_12_sys_lstat_args *uap,
+ register_t *retval)
{
/* {
syscallarg(const char *) path;
@@ -292,7 +312,8 @@ compat_12_sys_lstat(struct lwp *l, const struct compat_12_sys_lstat_args *uap, r
*/
/* ARGSUSED */
int
-compat_12_sys_fstat(struct lwp *l, const struct compat_12_sys_fstat_args *uap, register_t *retval)
+compat_12_sys_fstat(struct lwp *l, const struct compat_12_sys_fstat_args *uap,
+ register_t *retval)
{
/* {
syscallarg(int) fd;
@@ -309,3 +330,17 @@ compat_12_sys_fstat(struct lwp *l, const struct compat_12_sys_fstat_args *uap, r
}
return (error);
}
+
+int
+vfs_syscalls_12_init(void)
+{
+
+ return syscall_establish(NULL, vfs_syscalls_12_syscalls);
+}
+
+int
+vfs_syscalls_12_fini(void)
+{
+
+ return syscall_disestablish(NULL, vfs_syscalls_12_syscalls);
+}
diff --git a/sys/compat/common/vfs_syscalls_20.c b/sys/compat/common/vfs_syscalls_20.c
index 9d983ce7169..14aafb4cdb0 100644
--- a/sys/compat/common/vfs_syscalls_20.c
+++ b/sys/compat/common/vfs_syscalls_20.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_20.c,v 1.40 2017/04/13 09:41:28 hannken Exp $ */
+/* $NetBSD: vfs_syscalls_20.c,v 1.41 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.40 2017/04/13 09:41:28 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.41 2019/01/27 02:08:39 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -57,9 +57,13 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.40 2017/04/13 09:41:28 hannken
#include <sys/malloc.h>
#include <sys/dirent.h>
#include <sys/sysctl.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/kauth.h>
+#include <compat/common/compat_mod.h>
+
#include <compat/sys/mount.h>
#define MOUNTNO_NONE 0
@@ -86,6 +90,14 @@ static const struct {
{ MOUNT_AFS, MOUNTNO_AFS },
};
+static const struct syscall_package vfs_syscalls_20_syscalls[] = {
+ { SYS_compat_20_fhstatfs, 0, (sy_call_t *)compat_20_sys_fhstatfs },
+ { SYS_compat_20_fstatfs, 0, (sy_call_t *)compat_20_sys_fstatfs },
+ { SYS_compat_20_getfsstat, 0, (sy_call_t *)compat_20_sys_getfsstat },
+ { SYS_compat_20_statfs, 0, (sy_call_t *)compat_20_sys_statfs },
+ { 0, 0, NULL }
+};
+
static int
vfs2fs(struct statfs12 *bfs, const struct statvfs *fs)
{
@@ -287,3 +299,17 @@ out:
free(sbuf, M_TEMP);
return error;
}
+
+int
+vfs_syscalls_20_init(void)
+{
+
+ return syscall_establish(NULL, vfs_syscalls_20_syscalls);
+}
+
+int
+vfs_syscalls_20_fini(void)
+{
+
+ return syscall_disestablish(NULL, vfs_syscalls_20_syscalls);
+}
diff --git a/sys/compat/common/vfs_syscalls_30.c b/sys/compat/common/vfs_syscalls_30.c
index bfd3f4b52b7..55d09c66657 100644
--- a/sys/compat/common/vfs_syscalls_30.c
+++ b/sys/compat/common/vfs_syscalls_30.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_30.c,v 1.37 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: vfs_syscalls_30.c,v 1.38 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.37 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.38 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -47,9 +51,11 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.37 2018/09/03 16:29:29 riastra
#include <sys/malloc.h>
#include <sys/kauth.h>
#include <sys/vfs_syscalls.h>
-
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
+#include <compat/common/compat_mod.h>
#include <compat/common/compat_util.h>
#include <compat/sys/stat.h>
#include <compat/sys/dirent.h>
@@ -57,6 +63,19 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.37 2018/09/03 16:29:29 riastra
static void cvtstat(struct stat13 *, const struct stat *);
+static const struct syscall_package vfs_syscalls_30_syscalls[] = {
+ { SYS_compat_30___fhstat30, 0, (sy_call_t *)compat_30_sys___fhstat30 },
+ { SYS_compat_30___fstat13, 0, (sy_call_t *)compat_30_sys___fstat13 },
+ { SYS_compat_30___lstat13, 0, (sy_call_t *)compat_30_sys___lstat13 },
+ { SYS_compat_30___stat13, 0, (sy_call_t *)compat_30_sys___stat13 },
+ { SYS_compat_30_fhopen, 0, (sy_call_t *)compat_30_sys_fhopen },
+ { SYS_compat_30_fhstat, 0, (sy_call_t *)compat_30_sys_fhstat },
+ { SYS_compat_30_fhstatvfs1, 0, (sy_call_t *)compat_30_sys_fhstatvfs1 },
+ { SYS_compat_30_getdents, 0, (sy_call_t *)compat_30_sys_getdents },
+ { SYS_compat_30_getfh, 0, (sy_call_t *)compat_30_sys_getfh },
+ { 0,0, NULL }
+};
+
/*
* Convert from a new to an old stat structure.
*/
@@ -87,7 +106,8 @@ cvtstat(struct stat13 *ost, const struct stat *st)
*/
/* ARGSUSED */
int
-compat_30_sys___stat13(struct lwp *l, const struct compat_30_sys___stat13_args *uap, register_t *retval)
+compat_30_sys___stat13(struct lwp *l,
+ const struct compat_30_sys___stat13_args *uap, register_t *retval)
{
/* {
syscallarg(const char *) path;
@@ -111,7 +131,8 @@ compat_30_sys___stat13(struct lwp *l, const struct compat_30_sys___stat13_args *
*/
/* ARGSUSED */
int
-compat_30_sys___lstat13(struct lwp *l, const struct compat_30_sys___lstat13_args *uap, register_t *retval)
+compat_30_sys___lstat13(struct lwp *l,
+ const struct compat_30_sys___lstat13_args *uap, register_t *retval)
{
/* {
syscallarg(const char *) path;
@@ -131,7 +152,8 @@ compat_30_sys___lstat13(struct lwp *l, const struct compat_30_sys___lstat13_args
/* ARGSUSED */
int
-compat_30_sys_fhstat(struct lwp *l, const struct compat_30_sys_fhstat_args *uap, register_t *retval)
+compat_30_sys_fhstat(struct lwp *l,
+ const struct compat_30_sys_fhstat_args *uap, register_t *retval)
{
/* {
syscallarg(const struct compat_30_fhandle *) fhp;
@@ -174,7 +196,8 @@ compat_30_sys_fhstat(struct lwp *l, const struct compat_30_sys_fhstat_args *uap,
*/
/* ARGSUSED */
int
-compat_30_sys___fstat13(struct lwp *l, const struct compat_30_sys___fstat13_args *uap, register_t *retval)
+compat_30_sys___fstat13(struct lwp *l,
+ const struct compat_30_sys___fstat13_args *uap, register_t *retval)
{
/* {
syscallarg(int) fd;
@@ -196,7 +219,8 @@ compat_30_sys___fstat13(struct lwp *l, const struct compat_30_sys___fstat13_args
* Read a block of directory entries in a file system independent format.
*/
int
-compat_30_sys_getdents(struct lwp *l, const struct compat_30_sys_getdents_args *uap, register_t *retval)
+compat_30_sys_getdents(struct lwp *l,
+ const struct compat_30_sys_getdents_args *uap, register_t *retval)
{
/* {
syscallarg(int) fd;
@@ -329,7 +353,8 @@ out1:
* Get file handle system call
*/
int
-compat_30_sys_getfh(struct lwp *l, const struct compat_30_sys_getfh_args *uap, register_t *retval)
+compat_30_sys_getfh(struct lwp *l, const struct compat_30_sys_getfh_args *uap,
+ register_t *retval)
{
/* {
syscallarg(char *) fname;
@@ -380,7 +405,8 @@ compat_30_sys_getfh(struct lwp *l, const struct compat_30_sys_getfh_args *uap, r
* and call the device open routine if any.
*/
int
-compat_30_sys_fhopen(struct lwp *l, const struct compat_30_sys_fhopen_args *uap, register_t *retval)
+compat_30_sys_fhopen(struct lwp *l,
+ const struct compat_30_sys_fhopen_args *uap, register_t *retval)
{
/* {
syscallarg(const fhandle_t *) fhp;
@@ -393,7 +419,8 @@ compat_30_sys_fhopen(struct lwp *l, const struct compat_30_sys_fhopen_args *uap,
/* ARGSUSED */
int
-compat_30_sys___fhstat30(struct lwp *l, const struct compat_30_sys___fhstat30_args *uap_30, register_t *retval)
+compat_30_sys___fhstat30(struct lwp *l,
+ const struct compat_30_sys___fhstat30_args *uap_30, register_t *retval)
{
/* {
syscallarg(const fhandle_t *) fhp;
@@ -413,7 +440,8 @@ compat_30_sys___fhstat30(struct lwp *l, const struct compat_30_sys___fhstat30_ar
/* ARGSUSED */
int
-compat_30_sys_fhstatvfs1(struct lwp *l, const struct compat_30_sys_fhstatvfs1_args *uap_30, register_t *retval)
+compat_30_sys_fhstatvfs1(struct lwp *l,
+ const struct compat_30_sys_fhstatvfs1_args *uap_30, register_t *retval)
{
/* {
syscallarg(const fhandle_t *) fhp;
@@ -429,3 +457,17 @@ compat_30_sys_fhstatvfs1(struct lwp *l, const struct compat_30_sys_fhstatvfs1_ar
return sys___fhstatvfs140(l, &uap, retval);
}
+
+int
+vfs_syscalls_30_init(void)
+{
+
+ return syscall_establish(NULL, vfs_syscalls_30_syscalls);
+}
+
+int
+vfs_syscalls_30_fini(void)
+{
+
+ return syscall_disestablish(NULL, vfs_syscalls_30_syscalls);
+}
diff --git a/sys/compat/common/vfs_syscalls_40.c b/sys/compat/common/vfs_syscalls_40.c
index 8355e605a7d..006f20feac9 100644
--- a/sys/compat/common/vfs_syscalls_40.c
+++ b/sys/compat/common/vfs_syscalls_40.c
@@ -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.5 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,13 +63,26 @@
*/
#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.5 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#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 +97,17 @@ compat_40_sys_mount(struct lwp *l, const struct compat_40_sys_mount_args *uap, r
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);
+}
diff --git a/sys/compat/common/vfs_syscalls_43.c b/sys/compat/common/vfs_syscalls_43.c
index 500af6ae86b..f6325b39bbc 100644
--- a/sys/compat/common/vfs_syscalls_43.c
+++ b/sys/compat/common/vfs_syscalls_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_43.c,v 1.63 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: vfs_syscalls_43.c,v 1.64 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.63 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.64 2019/01/27 02:08:39 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -58,13 +58,13 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.63 2018/09/03 16:29:29 riastra
#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>
-#include <sys/sysctl.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/vfs_syscalls.h>
@@ -78,6 +78,11 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.63 2018/09/03 16:29:29 riastra
static void cvttimespec(struct timespec *, struct timespec50 *);
static void cvtstat(struct stat *, struct stat43 *);
+static struct syscall_package vfs_syscalls_43_syscalls[] = {
+ { SYS_compat_43_oquota, 0, (sy_call_t *)compat_43_sys_quota },
+ { 0, 0, NULL }
+};
+
/*
* Convert from an old to a new timespec structure.
*/
@@ -520,62 +525,16 @@ out1:
return copyout(&loff, SCARG(uap, basep), sizeof(long));
}
-/*
- * sysctl helper routine for vfs.generic.conf lookups.
- */
-#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44)
-
-static int
-sysctl_vfs_generic_conf(SYSCTLFN_ARGS)
+int
+vfs_syscalls_43_init(void)
{
- struct vfsconf vfc;
- struct sysctlnode node;
- struct vfsops *vfsp;
- u_int vfsnum;
-
- if (namelen != 1)
- return (ENOTDIR);
- vfsnum = name[0];
- if (vfsnum >= nmountcompatnames ||
- mountcompatnames[vfsnum] == NULL)
- return (EOPNOTSUPP);
- vfsp = vfs_getopsbyname(mountcompatnames[vfsnum]);
- if (vfsp == NULL)
- return (EOPNOTSUPP);
-
- vfc.vfc_vfsops = vfsp;
- strncpy(vfc.vfc_name, vfsp->vfs_name, sizeof(vfc.vfc_name));
- vfc.vfc_typenum = vfsnum;
- vfc.vfc_refcount = vfsp->vfs_refcount;
- vfc.vfc_flags = 0;
- vfc.vfc_mountroot = vfsp->vfs_mountroot;
- vfc.vfc_next = NULL;
- vfs_delref(vfsp);
-
- node = *rnode;
- node.sysctl_data = &vfc;
- return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+
+ return syscall_establish(NULL, vfs_syscalls_43_syscalls);
}
-/*
- * Top level filesystem related information gathering.
- */
-void
-compat_sysctl_vfs(struct sysctllog **clog)
+int
+vfs_syscalls_43_fini(void)
{
- 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(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_STRUCT, "conf",
- SYSCTL_DESCR("Filesystem configuration information"),
- sysctl_vfs_generic_conf, 0, NULL,
- sizeof(struct vfsconf),
- CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL);
+ return syscall_disestablish(NULL, vfs_syscalls_43_syscalls);
}
-#endif
diff --git a/sys/compat/common/vfs_syscalls_50.c b/sys/compat/common/vfs_syscalls_50.c
index d68518a3bd2..7b8f9b997f5 100644
--- a/sys/compat/common/vfs_syscalls_50.c
+++ b/sys/compat/common/vfs_syscalls_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_50.c,v 1.18 2014/09/05 09:21:54 matt Exp $ */
+/* $NetBSD: vfs_syscalls_50.c,v 1.19 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.18 2014/09/05 09:21:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.19 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -53,6 +57,9 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.18 2014/09/05 09:21:54 matt Ex
#include <sys/dirent.h>
#include <sys/kauth.h>
#include <sys/time.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
#include <sys/vfs_syscalls.h>
#ifndef LFS
#define LFS
@@ -66,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.18 2014/09/05 09:21:54 matt Ex
#include <ufs/ufs/quota1.h>
#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
#include <compat/sys/time.h>
#include <compat/sys/stat.h>
#include <compat/sys/dirent.h>
@@ -73,6 +81,21 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.18 2014/09/05 09:21:54 matt Ex
static void cvtstat(struct stat30 *, const struct stat *);
+static const struct syscall_package vfs_syscalls_50_syscalls[] = {
+ { 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 },
+ { SYS_compat_50___fhstat40, 0, (sy_call_t *)compat_50_sys___fhstat40 },
+ { SYS_compat_50_utimes, 0, (sy_call_t *)compat_50_sys_utimes },
+ { SYS_compat_50_lfs_segwait, 0,
+ (sy_call_t *)compat_50_sys_lfs_segwait } ,
+ { SYS_compat_50_futimes, 0, (sy_call_t *)compat_50_sys_futimes },
+ { SYS_compat_50_lutimes, 0, (sy_call_t *)compat_50_sys_lutimes },
+ { SYS_compat_50_mknod, 0, (sy_call_t *)compat_50_sys_mknod },
+ { SYS_compat_50_quotactl, 0, (sy_call_t *)compat_50_sys_quotactl },
+ { 0, 0, NULL }
+};
+
/*
* Convert from a new to an old stat structure.
*/
@@ -276,6 +299,7 @@ compat_50_sys_lfs_segwait(struct lwp *l,
syscallarg(struct timeval50 *) tv;
} */
#ifdef notyet
+/* XXX need to check presence of LFS at run-time XXX */
struct timeval atv;
struct timeval50 atv50;
fsid_t fsid;
@@ -426,3 +450,17 @@ compat_50_sys_quotactl(struct lwp *l, const struct compat_50_sys_quotactl_args *
vrele(vp);
return error;
}
+
+int
+vfs_syscalls_50_init(void)
+{
+
+ return syscall_establish(NULL, vfs_syscalls_50_syscalls);
+}
+
+int
+vfs_syscalls_50_fini(void)
+{
+
+ return syscall_disestablish(NULL, vfs_syscalls_50_syscalls);
+}
diff --git a/sys/compat/common/vm_12.c b/sys/compat/common/vm_12.c
index dacdd4ed576..0734571b788 100644
--- a/sys/compat/common/vm_12.c
+++ b/sys/compat/common/vm_12.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_12.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: vm_12.c,v 1.21 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1997 Matthew R. Green
@@ -27,17 +27,32 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_12.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_12.c,v 1.21 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/swap.h>
#include <sys/mman.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package vm_12_syscalls[] = {
+ { SYS_compat_12_msync, 0, (sy_call_t *)compat_12_sys_msync },
+ { SYS_compat_12_oswapon, 0, (sy_call_t *)compat_12_sys_swapon },
+ { 0, 0, NULL }
+};
+
int
-compat_12_sys_swapon(struct lwp *l, const struct compat_12_sys_swapon_args *uap, register_t *retval)
+compat_12_sys_swapon(struct lwp *l,
+ const struct compat_12_sys_swapon_args *uap, register_t *retval)
{
/* {
syscallarg(const char *) name;
@@ -52,7 +67,8 @@ compat_12_sys_swapon(struct lwp *l, const struct compat_12_sys_swapon_args *uap,
}
int
-compat_12_sys_msync(struct lwp *l, const struct compat_12_sys_msync_args *uap, register_t *retval)
+compat_12_sys_msync(struct lwp *l,
+ const struct compat_12_sys_msync_args *uap, register_t *retval)
{
/* {
syscallarg(void *) addr;
@@ -65,3 +81,17 @@ compat_12_sys_msync(struct lwp *l, const struct compat_12_sys_msync_args *uap, r
SCARG(&ua, flags) = MS_SYNC | MS_INVALIDATE;
return (sys___msync13(l, &ua, retval));
}
+
+int
+vm_12_init(void)
+{
+
+ return syscall_establish(NULL, vm_12_syscalls);
+}
+
+int
+vm_12_fini(void)
+{
+
+ return syscall_disestablish(NULL, vm_12_syscalls);
+}
diff --git a/sys/compat/common/vm_43.c b/sys/compat/common/vm_43.c
index bfa5fc3246c..ffe57ae1667 100644
--- a/sys/compat/common/vm_43.c
+++ b/sys/compat/common/vm_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_43.c,v 1.20 2017/04/29 13:25:27 christos Exp $ */
+/* $NetBSD: vm_43.c,v 1.21 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -43,7 +43,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_43.c,v 1.20 2017/04/29 13:25:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_43.c,v 1.21 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,10 +58,21 @@ __KERNEL_RCSID(0, "$NetBSD: vm_43.c,v 1.20 2017/04/29 13:25:27 christos Exp $");
#include <sys/file.h>
#include <sys/mman.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <miscfs/specfs/specdev.h>
+#include <compat/common/compat_mod.h>
+
+static struct syscall_package vm_43_syscalls[] = {
+ { SYS_compat_43_ogetpagesize, 0,
+ (sy_call_t *)compat_43_sys_getpagesize },
+ { SYS_compat_43_ommap, 0, (sy_call_t *)compat_43_sys_mmap },
+ { 0, 0, NULL }
+};
+
/* ARGSUSED */
int
compat_43_sys_getpagesize(struct lwp *l, const void *v, register_t *retval)
@@ -133,3 +148,17 @@ compat_43_sys_mmap(struct lwp *l, const struct compat_43_sys_mmap_args *uap, reg
SCARG(&nargs, pos) = SCARG(uap, pos);
return (sys_mmap(l, &nargs, retval));
}
+
+int
+vm_43_init(void)
+{
+
+ return syscall_establish(NULL, vm_43_syscalls);
+}
+
+int
+vm_43_fini(void)
+{
+
+ return syscall_disestablish(NULL, vm_43_syscalls);
+}
diff --git a/sys/compat/common/vnd_30.c b/sys/compat/common/vnd_30.c
new file mode 100644
index 00000000000..43f33abc840
--- /dev/null
+++ b/sys/compat/common/vnd_30.c
@@ -0,0 +1,134 @@
+/* $NetBSD: vnd_30.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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.
+ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * from: Utah $Hdr: vn.c 1.13 94/04/02$
+ *
+ * @(#)vn.c 8.9 (Berkeley) 5/14/95
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: vnd_30.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/errno.h>
+#include <sys/malloc.h>
+#include <sys/ioctl.h>
+#include <sys/device.h>
+#include <sys/disk.h>
+#include <sys/stat.h>
+#include <sys/vnode.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+#include <sys/conf.h>
+#include <sys/vnode.h>
+#include <sys/compat_stub.h>
+
+#include <net/zlib.h>
+
+#include <dev/vndvar.h>
+
+#include <compat/common/compat_mod.h>
+
+static int compat_30_vndioctl(u_long, struct lwp *, void *, int, struct vattr *,
+ int (*)(struct lwp *, void *, int, struct vattr *));
+
+static int
+compat_30_vndioctl(u_long cmd, struct lwp *l, void *data, int unit,
+ struct vattr *vattr_p,
+ int (*get)(struct lwp *, void *, int, struct vattr *))
+{
+ struct vnd_user30 *vnu = data;
+ int error;
+
+ if (cmd != VNDIOCGET30)
+ return EPASSTHROUGH;
+
+ error = (*get)(l, data, unit, vattr_p);
+ if (error != 0)
+ return error;
+
+ vnu->vnu_dev = vattr_p->va_fsid;
+ vnu->vnu_ino = vattr_p->va_fileid;
+ return 0;
+}
+
+void
+vnd_30_init(void)
+{
+
+ MODULE_SET_HOOK(compat_vndioctl_30_hook, "vnd_30", compat_30_vndioctl);
+}
+
+void
+vnd_30_fini(void)
+{
+
+ MODULE_UNSET_HOOK(compat_vndioctl_30_hook);
+}
diff --git a/sys/compat/common/vnd_50.c b/sys/compat/common/vnd_50.c
new file mode 100644
index 00000000000..4964f952f18
--- /dev/null
+++ b/sys/compat/common/vnd_50.c
@@ -0,0 +1,134 @@
+/* $NetBSD: vnd_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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.
+ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * from: Utah $Hdr: vn.c 1.13 94/04/02$
+ *
+ * @(#)vn.c 8.9 (Berkeley) 5/14/95
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: vnd_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/errno.h>
+#include <sys/malloc.h>
+#include <sys/ioctl.h>
+#include <sys/device.h>
+#include <sys/disk.h>
+#include <sys/stat.h>
+#include <sys/vnode.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+#include <sys/conf.h>
+#include <sys/vnode.h>
+#include <sys/compat_stub.h>
+
+#include <net/zlib.h>
+
+#include <dev/vndvar.h>
+
+#include <compat/common/compat_mod.h>
+
+static int compat_50_vndioctl(u_long, struct lwp *, void *, int, struct vattr *,
+ int (*)(struct lwp *, void *, int, struct vattr *));
+
+static int
+compat_50_vndioctl(u_long cmd, struct lwp *l, void *data, int unit,
+ struct vattr *vattr_p,
+ int (*get)(struct lwp *, void *, int, struct vattr *))
+{
+ struct vnd_user50 *vnu = data;
+ int error;
+
+ if (cmd != VNDIOCGET50)
+ return EPASSTHROUGH;
+
+ error = (*get)(l, data, unit, vattr_p);
+ if (error != 0)
+ return error;
+
+ vnu->vnu_dev = vattr_p->va_fsid;
+ vnu->vnu_ino = vattr_p->va_fileid;
+ return 0;
+}
+
+void
+vnd_50_init(void)
+{
+
+ MODULE_SET_HOOK(compat_vndioctl_50_hook, "vnd_50", compat_50_vndioctl);
+}
+
+void
+vnd_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(compat_vndioctl_50_hook);
+}
diff --git a/sys/compat/freebsd/files.freebsd b/sys/compat/freebsd/files.freebsd
index b04d1dfba36..e84e0315680 100644
--- a/sys/compat/freebsd/files.freebsd
+++ b/sys/compat/freebsd/files.freebsd
@@ -1,9 +1,9 @@
-# $NetBSD: files.freebsd,v 1.15 2017/08/01 14:43:54 maxv Exp $
+# $NetBSD: files.freebsd,v 1.16 2019/01/27 02:08:39 pgoyette Exp $
#
# Config file description for machine-independent FreeBSD compat code.
# Included by ports that need it. Only i386 is supported.
-define compat_freebsd
+define compat_freebsd : compat_netbsd, compat_ossaudio
file compat/freebsd/freebsd_exec.c compat_freebsd
file compat/freebsd/freebsd_exec_elf32.c compat_freebsd & exec_elf32
file compat/freebsd/freebsd_file.c compat_freebsd
diff --git a/sys/compat/linux/common/linux_exec_elf32.c b/sys/compat/linux/common/linux_exec_elf32.c
index 2850b514dc5..96d188215a7 100644
--- a/sys/compat/linux/common/linux_exec_elf32.c
+++ b/sys/compat/linux/common/linux_exec_elf32.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_exec_elf32.c,v 1.97 2018/07/15 21:31:00 christos Exp $ */
+/* $NetBSD: linux_exec_elf32.c,v 1.98 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.97 2018/07/15 21:31:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.98 2019/01/27 02:08:40 pgoyette Exp $");
#ifndef ELFSIZE
/* XXX should die */
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.97 2018/07/15 21:31:00 christ
#include <sys/stat.h>
#include <sys/kauth.h>
#include <sys/cprng.h>
+#include <sys/compat_stub.h>
#include <sys/mman.h>
#include <sys/syscallargs.h>
@@ -334,11 +335,8 @@ ELFNAME2(linux,go_rt0_signature)(struct lwp *l, struct exec_package *epp, Elf_Eh
goto out;
#if (ELFSIZE == 32)
- extern const char machine32[] __weak;
- if (machine32 != NULL)
- m = machine32;
- else
- m = machine;
+ extern struct netbsd32_machine32_hook_t netbsd32_machine32_hook;
+ MODULE_CALL_HOOK(netbsd32_machine32_hook, (), machine, m);
#else
m = machine;
#endif
diff --git a/sys/compat/linux/common/linux_mod.c b/sys/compat/linux/common/linux_mod.c
index 8e2b8c608b0..685c8b73aae 100644
--- a/sys/compat/linux/common/linux_mod.c
+++ b/sys/compat/linux/common/linux_mod.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_mod.c,v 1.10 2017/12/10 00:43:05 kre Exp $ */
+/* $NetBSD: linux_mod.c,v 1.11 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.10 2017/12/10 00:43:05 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.11 2019/01/27 02:08:40 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -66,8 +66,10 @@ __KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.10 2017/12/10 00:43:05 kre Exp $");
# define MD3 ""
#endif
-MODULE(MODULE_CLASS_EXEC, compat_linux, "compat,compat_ossaudio,sysv_ipc"
- MD1 MD2 MD3);
+#define REQ1 "compat_ossaudio,sysv_ipc,compat_util"
+#define REQ2 ",compat_50,compat_43"
+
+MODULE(MODULE_CLASS_EXEC, compat_linux, REQ1 REQ2 MD1 MD2 MD3);
static struct execsw linux_execsw[] = {
#if defined(EXEC_ELF32) && ELFSIZE == 32
diff --git a/sys/compat/linux/files.linux b/sys/compat/linux/files.linux
index b81b34f19b1..69924a27e48 100644
--- a/sys/compat/linux/files.linux
+++ b/sys/compat/linux/files.linux
@@ -1,4 +1,4 @@
-# $NetBSD: files.linux,v 1.21 2014/11/17 01:01:57 uebayasi Exp $
+# $NetBSD: files.linux,v 1.22 2019/01/27 02:08:39 pgoyette Exp $
#
# Config file description for machine-independent Linux compat code.
# Included by ports that need it.
@@ -6,7 +6,7 @@
# ports should define any machine-specific files they need in their
# own file lists.
-define compat_linux
+define compat_linux : compat, compat_ossaudio, sysv_ipc
file compat/linux/common/linux_blkio.c compat_linux
file compat/linux/common/linux_cdrom.c compat_linux
file compat/linux/common/linux_errno.c compat_linux
diff --git a/sys/compat/linux32/common/linux32_mod.c b/sys/compat/linux32/common/linux32_mod.c
index 0f69a15d1c8..de14ce1bc84 100644
--- a/sys/compat/linux32/common/linux32_mod.c
+++ b/sys/compat/linux32/common/linux32_mod.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_mod.c,v 1.11 2017/12/10 00:43:05 kre Exp $ */
+/* $NetBSD: linux32_mod.c,v 1.12 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.11 2017/12/10 00:43:05 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.12 2019/01/27 02:08:40 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -52,12 +52,15 @@ __KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.11 2017/12/10 00:43:05 kre Exp $")
#include <compat/linux32/common/linux32_exec.h>
#if defined(EXEC_ELF32)
-# define MD1 ",exec_elf32,compat_netbsd32,compat_netbsd32_sysvipc"
+# define MD1 ",exec_elf32,compat_netbsd32,compat_netbsd32_sysvipc"
#else
-# define MD1 ""
+# define MD1 ""
#endif
-MODULE(MODULE_CLASS_EXEC, compat_linux32, "compat_linux" MD1);
+#define REQ1 "compat_linux,sysv_ipc,compat_sysv_50"
+#define REQ2 ",compat_netbsd32_50,compat_netbsd32_43"
+
+MODULE(MODULE_CLASS_EXEC, compat_linux32, REQ1 REQ2 MD1);
static struct execsw linux32_execsw[] = {
#if defined(EXEC_ELF32)
diff --git a/sys/compat/linux32/files.linux32 b/sys/compat/linux32/files.linux32
index d998b006add..908075715b2 100644
--- a/sys/compat/linux32/files.linux32
+++ b/sys/compat/linux32/files.linux32
@@ -1,4 +1,4 @@
-# $NetBSD: files.linux32,v 1.6 2014/11/17 01:01:57 uebayasi Exp $
+# $NetBSD: files.linux32,v 1.7 2019/01/27 02:08:40 pgoyette Exp $
#
# Config file description for machine-independent Linux 32 bit compat code.
# Included by ports that need it.
@@ -6,7 +6,9 @@
# ports should define any machine-specific files they need in their
# own file lists.
-define compat_linux32
+define compat_linux32 : exec_elf32, compat_netbsd32,
+ compat_netbsd32_sysv_ipc, compat_linux,
+ compat_sysv
file compat/linux32/common/linux32_dirent.c compat_linux32
file compat/linux32/common/linux32_exec.c compat_linux32
file compat/linux32/common/linux32_exec_elf32.c compat_linux32 & exec_elf32
diff --git a/sys/compat/common/if_43.h b/sys/compat/net/route_50.h
index e21c954681b..62a9738dac3 100644
--- a/sys/compat/common/if_43.h
+++ b/sys/compat/net/route_50.h
@@ -1,7 +1,7 @@
-/* $NetBSD: if_43.h,v 1.1 2016/11/05 23:30:22 pgoyette Exp $ */
+/* $NetBSD: route_50.h,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -29,16 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _COMPAT_IF_43_H_
-#define _COMPAT_IF_43_H_
+#ifndef _COMPAT_NET_ROUTE_50_H_
+#define _COMPAT_NET_ROUTE_50_H_
-#if defined(COMPAT_43)
-extern u_long (*vec_compat_cvtcmd)(u_long);
-extern int (*vec_compat_ifioctl)(struct socket *, u_long, u_long,
- void *, struct lwp *);
+#include <net/route.h>
-void if_43_init(void);
-void if_43_fini(void);
-#endif
+/* compat interfaces */
-#endif /* !_COMPAT_IF_43_H_ */
+void rtsock_50_init(void);
+void rtsock_50_fini(void);
+
+#endif /* !_COMPAT_NET_ROUTE_70_H_ */
diff --git a/sys/compat/net/route_70.h b/sys/compat/net/route_70.h
new file mode 100644
index 00000000000..afa3992a66b
--- /dev/null
+++ b/sys/compat/net/route_70.h
@@ -0,0 +1,44 @@
+/* $NetBSD: route_70.h,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to 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.
+ */
+
+#ifndef _COMPAT_NET_ROUTE_70_H_
+#define _COMPAT_NET_ROUTE_70_H_
+
+#include <net/route.h>
+
+/* compat interfaces */
+
+void rtsock_70_init(void);
+void rtsock_70_fini(void);
+
+extern bool compat70_ocreds_valid;
+
+#endif /* !_COMPAT_NET_ROUTE_70_H_ */
diff --git a/sys/compat/netbsd32/files.netbsd32 b/sys/compat/netbsd32/files.netbsd32
index a188f7d1302..771e5dccc04 100644
--- a/sys/compat/netbsd32/files.netbsd32
+++ b/sys/compat/netbsd32/files.netbsd32
@@ -1,4 +1,4 @@
-# $NetBSD: files.netbsd32,v 1.42 2018/12/24 22:47:19 mrg Exp $
+# $NetBSD: files.netbsd32,v 1.43 2019/01/27 02:08:40 pgoyette Exp $
#
# config file description for machine-independent netbsd32 compat code.
# included by ports that need it.
@@ -15,6 +15,7 @@ file compat/netbsd32/netbsd32_event.c compat_netbsd32
file compat/netbsd32/netbsd32_execve.c compat_netbsd32
file compat/netbsd32/netbsd32_fd.c compat_netbsd32
file compat/netbsd32/netbsd32_fs.c compat_netbsd32
+file compat/netbsd32/netbsd32_kern_proc.c compat_netbsd32
file compat/netbsd32/netbsd32_ioctl.c compat_netbsd32
file compat/netbsd32/netbsd32_ipc.c compat_netbsd32
file compat/netbsd32/netbsd32_lwp.c compat_netbsd32
@@ -37,15 +38,21 @@ file compat/netbsd32/netbsd32_sysent.c compat_netbsd32
file compat/netbsd32/netbsd32_syscalls.c compat_netbsd32 & syscall_debug
file compat/netbsd32/netbsd32_compat_09.c compat_netbsd32 & (compat_09 | compat_sunos)
-file compat/netbsd32/netbsd32_compat_10.c compat_netbsd32 & (compat_10 | compat_sunos)
+file compat/netbsd32/netbsd32_compat_10_sysv.c compat_netbsd32 & compat_10 &
+ (sysvmsg | sysvsem | sysvshm)
file compat/netbsd32/netbsd32_compat_12.c compat_netbsd32 & (compat_12 | compat_sunos)
file compat/netbsd32/netbsd32_compat_13.c compat_netbsd32 & compat_13
-file compat/netbsd32/netbsd32_compat_14.c compat_netbsd32 & compat_14
+file compat/netbsd32/netbsd32_compat_14_sysv.c compat_netbsd32 & compat_14 &
+ (sysvmsg | sysvsem | sysvshm)
+file compat/netbsd32/netbsd32_compat_16.c compat_netbsd32 & compat_16
file compat/netbsd32/netbsd32_compat_20.c compat_netbsd32 & compat_20
file compat/netbsd32/netbsd32_compat_30.c compat_netbsd32 & compat_30
+file compat/netbsd32/netbsd32_compat_40.c compat_netbsd32 & compat_40
file compat/netbsd32/netbsd32_compat_43.c compat_netbsd32 & (compat_43 | compat_sunos | compat_linux32)
file compat/netbsd32/netbsd32_compat_40.c compat_netbsd32 & compat_40
file compat/netbsd32/netbsd32_compat_50.c compat_netbsd32 & compat_50
+file compat/netbsd32/netbsd32_rndpseudo_50.c compat_netbsd32 & compat_50
file compat/netbsd32/netbsd32_compat_50_sysv.c compat_netbsd32 & compat_50 &
(sysvmsg | sysvsem | sysvshm)
file compat/netbsd32/netbsd32_compat_60.c compat_netbsd32 & compat_60
+file compat/netbsd32/netbsd32_compat_80.c compat_netbsd32 & compat_80
diff --git a/sys/compat/netbsd32/netbsd32.h b/sys/compat/netbsd32/netbsd32.h
index a498a799d26..e1888c84ef3 100644
--- a/sys/compat/netbsd32/netbsd32.h
+++ b/sys/compat/netbsd32/netbsd32.h
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32.h,v 1.120 2018/11/25 17:58:29 mlelstv Exp $ */
+/* $NetBSD: netbsd32.h,v 1.121 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -46,6 +46,8 @@
#include <sys/shm.h>
#include <sys/ucontext.h>
#include <sys/ucred.h>
+#include <sys/module_hook.h>
+
#include <compat/sys/ucontext.h>
#include <compat/sys/mount.h>
#include <compat/sys/signal.h>
@@ -1171,4 +1173,38 @@ struct iovec *netbsd32_get_iov(struct netbsd32_iovec *, int, struct iovec *,
#ifdef SYSCTL_SETUP_PROTO
SYSCTL_SETUP_PROTO(netbsd32_sysctl_emul_setup);
#endif /* SYSCTL_SETUP_PROTO */
+
+MODULE_HOOK(netbsd32_sendsig_hook, void,
+ (const ksiginfo_t *, const sigset_t *));
+
+extern struct sysent netbsd32_sysent[];
+extern const uint32_t netbsd32_sysent_nomodbits[];
+#ifdef SYSCALL_DEBUG
+extern const char * const netbsd32_syscallnames[];
+#endif
+
+extern struct sysctlnode netbsd32_sysctl_root;
+
+struct netbsd32_modctl_args;
+MODULE_HOOK(compat32_80_modctl_hook, int,
+ (struct lwp *, const struct netbsd32_modctl_args *, register_t *));
+
+/*
+ * Finally, declare emul_netbsd32 as this is needed in lots of
+ * places when calling syscall_{,dis}establish()
+ */
+
+extern struct emul emul_netbsd32;
+extern char netbsd32_sigcode[], netbsd32_esigcode[];
+
+/*
+ * Prototypes for MD initialization routines
+ */
+void netbsd32_machdep_md_init(void);
+void netbsd32_machdep_md_fini(void);
+void netbsd32_machdep_md_13_init(void);
+void netbsd32_machdep_md_13_fini(void);
+void netbsd32_machdep_md_16_init(void);
+void netbsd32_machdep_md_16_fini(void);
+
#endif /* _COMPAT_NETBSD32_NETBSD32_H_ */
diff --git a/sys/compat/netbsd32/netbsd32_compat_09.c b/sys/compat/netbsd32/netbsd32_compat_09.c
index 754bb86873e..e0193933f4e 100644
--- a/sys/compat/netbsd32/netbsd32_compat_09.c
+++ b/sys/compat/netbsd32/netbsd32_compat_09.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_09.c,v 1.18 2008/05/29 14:51:26 mrg Exp $ */
+/* $NetBSD: netbsd32_compat_09.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@@ -27,18 +27,23 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_09.c,v 1.18 2008/05/29 14:51:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_09.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/mount.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/time.h>
#include <uvm/uvm_extern.h>
#include <sys/sysctl.h>
+#include <compat/sys/siginfo.h>
+
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
int
@@ -84,3 +89,33 @@ compat_09_netbsd32_uname(struct lwp *l, const struct compat_09_netbsd32_uname_ar
NETBSD32TOP_UAP(name, struct outsname);
return (compat_09_sys_uname(l, &ua, retval));
}
+
+static struct syscall_package compat_netbsd32_09_syscalls[] = {
+ { NETBSD32_SYS_compat_09_netbsd32_ogetdomainname, 0,
+ (sy_call_t *)compat_09_netbsd32_ogetdomainname },
+ { NETBSD32_SYS_compat_09_netbsd32_osetdomainname, 0,
+ (sy_call_t *)compat_09_netbsd32_osetdomainname },
+ { NETBSD32_SYS_compat_09_netbsd32_uname, 0,
+ (sy_call_t *)compat_09_netbsd32_uname },
+ { 0, 0, NULL }
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_09, "compat_netbsd32_12,compat_09");
+
+static int
+compat_netbsd32_09_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_netbsd32_09_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_netbsd32_09_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/netbsd32/netbsd32_compat_10.c b/sys/compat/netbsd32/netbsd32_compat_10_sysv.c
index f2ed23f05d1..ebc485d16ca 100644
--- a/sys/compat/netbsd32/netbsd32_compat_10.c
+++ b/sys/compat/netbsd32/netbsd32_compat_10_sysv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_10.c,v 1.25 2015/12/03 10:38:21 pgoyette Exp $ */
+/* $NetBSD: netbsd32_compat_10_sysv.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1994 Adam Glass and Charles M. Hannum. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_10.c,v 1.25 2015/12/03 10:38:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_10_sysv.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_sysv.h"
@@ -40,18 +40,22 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_10.c,v 1.25 2015/12/03 10:38:21 pgoy
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/sem.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/sys/shm.h>
#if defined(COMPAT_10)
+
#if defined(SYSVSEM)
int
compat_10_netbsd32_semsys(struct lwp *l, const struct compat_10_netbsd32_semsys_args *uap, register_t *retval)
@@ -239,4 +243,48 @@ compat_10_netbsd32_msgsys(struct lwp *l, const struct compat_10_netbsd32_msgsys_
}
}
#endif
+
+#define _PKG_ENTRY(name) \
+ { NETBSD32_SYS_ ## name, 0, (sy_call_t *)name }
+
+#define _PKG_ENTRY2(code, name) \
+ { NETBSD32_SYS_ ## code, 0, (sy_call_t *)name }
+
+static const struct syscall_package compat_sysvipc_10_syscalls[] = {
+#if defined(SYSVSEM)
+ _PKG_ENTRY2(compat_10_osemsys, compat_10_netbsd32_semsys),
+#endif
+#if defined(SYSVSHM)
+ _PKG_ENTRY2(compat_10_oshmsys, compat_10_netbsd32_shmsys),
+#endif
+#if defined(SYSVMSG)
+ _PKG_ENTRY2(compat_10_omsgsys, compat_10_netbsd32_msgsys),
+#endif
+ { 0, 0, NULL }
+};
+
+#define REQ1 "sysv_ipc,compat_sysv_10,"
+#define REQ2 "compat_netbsd32,compat_netbsd32_sysvipc,"
+#define REQ3 "compat_netbsd32_sysvipc_14,compat_netbsd32_sysvipc_50"
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_sysvipc_10, REQ1 REQ2 REQ3 );
+
+static int
+compat_netbsd32_sysvipc_10_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_sysvipc_10_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_sysvipc_10_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
+
#endif /* COMPAT_10 */
diff --git a/sys/compat/netbsd32/netbsd32_compat_12.c b/sys/compat/netbsd32/netbsd32_compat_12.c
index c1668fafe4e..70b6b5351d5 100644
--- a/sys/compat/netbsd32/netbsd32_compat_12.c
+++ b/sys/compat/netbsd32/netbsd32_compat_12.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_12.c,v 1.33 2012/12/10 02:21:58 chs Exp $ */
+/* $NetBSD: netbsd32_compat_12.c,v 1.34 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_12.c,v 1.33 2012/12/10 02:21:58 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_12.c,v 1.34 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_12.c,v 1.33 2012/12/10 02:21:58 chs
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/filedesc.h>
#include <sys/mount.h>
#include <sys/mman.h>
@@ -45,10 +46,12 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_12.c,v 1.33 2012/12/10 02:21:58 chs
#include <sys/vfs_syscalls.h>
#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
#include <compat/sys/stat.h>
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
static void netbsd32_stat12_to_netbsd32(struct stat12 *,
@@ -207,3 +210,41 @@ compat_12_netbsd32_getdirentries(struct lwp *l, const struct compat_12_netbsd32_
return (compat_12_sys_getdirentries(l, &ua, retval));
}
+
+static struct syscall_package compat_netbsd32_12_syscalls[] = {
+ { NETBSD32_SYS_compat_12_netbsd32_reboot, 0,
+ (sy_call_t *)compat_12_netbsd32_reboot },
+ { NETBSD32_SYS_compat_12_netbsd32_msync, 0,
+ (sy_call_t *)compat_12_netbsd32_msync },
+ { NETBSD32_SYS_compat_12_netbsd32_oswapon, 0,
+ (sy_call_t *)compat_12_netbsd32_oswapon },
+ { NETBSD32_SYS_compat_12_netbsd32_stat12, 0,
+ (sy_call_t *)compat_12_netbsd32_stat12 },
+ { NETBSD32_SYS_compat_12_netbsd32_fstat12, 0,
+ (sy_call_t *)compat_12_netbsd32_fstat12 },
+ { NETBSD32_SYS_compat_12_netbsd32_lstat12, 0,
+ (sy_call_t *)compat_12_netbsd32_lstat12 },
+ { NETBSD32_SYS_compat_12_netbsd32_getdirentries, 0,
+ (sy_call_t *)compat_12_netbsd32_getdirentries },
+ { 0, 0, NULL }
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_12, "compat_netbsd32_13,compat_12");
+
+static int
+compat_netbsd32_12_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_netbsd32_12_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_netbsd32_12_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/netbsd32/netbsd32_compat_13.c b/sys/compat/netbsd32/netbsd32_compat_13.c
index d417e45c75f..f72d93d1605 100644
--- a/sys/compat/netbsd32/netbsd32_compat_13.c
+++ b/sys/compat/netbsd32/netbsd32_compat_13.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_13.c,v 1.26 2014/01/24 22:44:00 christos Exp $ */
+/* $NetBSD: netbsd32_compat_13.c,v 1.27 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,17 +27,20 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_13.c,v 1.26 2014/01/24 22:44:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_13.c,v 1.27 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/sys/stat.h>
@@ -90,3 +93,35 @@ compat_13_netbsd32_sigsuspend(struct lwp *l, const struct compat_13_netbsd32_sig
native_sigset13_to_sigset(&ess, &bss);
return (sigsuspend1(l, &bss));
}
+
+static struct syscall_package compat_netbsd32_13_syscalls[] = {
+ { NETBSD32_SYS_compat_13_netbsd32_sigaltstack13, 0,
+ (sy_call_t *)compat_13_netbsd32_sigaltstack13 },
+ { NETBSD32_SYS_compat_13_sigprocmask13, 0,
+ (sy_call_t *)compat_13_netbsd32_sigprocmask },
+ { NETBSD32_SYS_compat_13_sigsuspend13, 0,
+ (sy_call_t *)compat_13_netbsd32_sigsuspend },
+ { 0, 0, NULL }
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_13, "compat_13,compat_netbsd32_16");
+
+static int
+compat_netbsd32_13_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ netbsd32_machdep_md_13_init();
+ return syscall_establish(&emul_netbsd32,
+ compat_netbsd32_13_syscalls);
+
+ case MODULE_CMD_FINI:
+ netbsd32_machdep_md_13_fini();
+ return syscall_disestablish(&emul_netbsd32,
+ compat_netbsd32_13_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/netbsd32/netbsd32_compat_14_sysv.c b/sys/compat/netbsd32/netbsd32_compat_14_sysv.c
new file mode 100644
index 00000000000..1c2b5f79b40
--- /dev/null
+++ b/sys/compat/netbsd32/netbsd32_compat_14_sysv.c
@@ -0,0 +1,368 @@
+/* $NetBSD: netbsd32_compat_14_sysv.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 1999 Eduardo E. Horvath
+ * 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14_sysv.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_sysv.h"
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/ipc.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/signal.h>
+#include <sys/proc.h>
+#include <sys/mount.h>
+#include <sys/msg.h>
+#include <sys/sem.h>
+#include <sys/shm.h>
+
+#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+#include <compat/sys/siginfo.h>
+#include <compat/sys/shm.h>
+
+#if defined(COMPAT_14)
+
+#if defined(SYSVMSG)
+static inline void
+netbsd32_ipc_perm14_to_native(struct netbsd32_ipc_perm14 *operm, struct ipc_perm *perm)
+{
+
+#define CVT(x) perm->x = operm->x
+ CVT(uid);
+ CVT(gid);
+ CVT(cuid);
+ CVT(cgid);
+ CVT(mode);
+#undef CVT
+}
+
+static inline void
+native_to_netbsd32_ipc_perm14(struct ipc_perm *perm, struct netbsd32_ipc_perm14 *operm)
+{
+
+#define CVT(x) operm->x = perm->x
+ CVT(uid);
+ CVT(gid);
+ CVT(cuid);
+ CVT(cgid);
+ CVT(mode);
+#undef CVT
+
+ /*
+ * Not part of the API, but some programs might look at it.
+ */
+ operm->seq = perm->_seq;
+ operm->key = (key_t)perm->_key;
+}
+
+static inline void
+netbsd32_msqid_ds14_to_native(struct netbsd32_msqid_ds14 *omsqbuf, struct msqid_ds *msqbuf)
+{
+
+ netbsd32_ipc_perm14_to_native(&omsqbuf->msg_perm, &msqbuf->msg_perm);
+
+#define CVT(x) msqbuf->x = omsqbuf->x
+ CVT(msg_qnum);
+ CVT(msg_qbytes);
+ CVT(msg_lspid);
+ CVT(msg_lrpid);
+ CVT(msg_stime);
+ CVT(msg_rtime);
+ CVT(msg_ctime);
+#undef CVT
+}
+
+static inline void
+native_to_netbsd32_msqid_ds14(struct msqid_ds *msqbuf, struct netbsd32_msqid_ds14 *omsqbuf)
+{
+
+ memset(omsqbuf, 0, sizeof(*omsqbuf));
+ native_to_netbsd32_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
+
+#define CVT(x) omsqbuf->x = msqbuf->x
+ CVT(msg_qnum);
+ CVT(msg_qbytes);
+ CVT(msg_lspid);
+ CVT(msg_lrpid);
+ CVT(msg_stime);
+ CVT(msg_rtime);
+ CVT(msg_ctime);
+#undef CVT
+
+ /*
+ * Not part of the API, but some programs might look at it.
+ */
+ omsqbuf->msg_cbytes = msqbuf->_msg_cbytes;
+}
+#endif
+
+#if defined(SYSVSEM)
+static inline void
+netbsd32_semid_ds14_to_native(struct netbsd32_semid_ds14 *osembuf, struct semid_ds *sembuf)
+{
+
+ netbsd32_ipc_perm14_to_native(&osembuf->sem_perm, &sembuf->sem_perm);
+
+#define CVT(x) sembuf->x = osembuf->x
+ CVT(sem_nsems);
+ CVT(sem_otime);
+ CVT(sem_ctime);
+#undef CVT
+}
+
+static inline void
+native_to_netbsd32_semid_ds14(struct semid_ds *sembuf, struct netbsd32_semid_ds14 *osembuf)
+{
+
+ native_to_netbsd32_ipc_perm14(&sembuf->sem_perm, &osembuf->sem_perm);
+
+#define CVT(x) osembuf->x = sembuf->x
+ CVT(sem_nsems);
+ CVT(sem_otime);
+ CVT(sem_ctime);
+#undef CVT
+}
+
+static inline void
+netbsd32_shmid_ds14_to_native(struct netbsd32_shmid_ds14 *oshmbuf, struct shmid_ds *shmbuf)
+{
+
+ netbsd32_ipc_perm14_to_native(&oshmbuf->shm_perm, &shmbuf->shm_perm);
+
+#define CVT(x) shmbuf->x = oshmbuf->x
+ CVT(shm_segsz);
+ CVT(shm_lpid);
+ CVT(shm_cpid);
+ CVT(shm_nattch);
+ CVT(shm_atime);
+ CVT(shm_dtime);
+ CVT(shm_ctime);
+#undef CVT
+}
+
+static inline void
+native_to_netbsd32_shmid_ds14(struct shmid_ds *shmbuf, struct netbsd32_shmid_ds14 *oshmbuf)
+{
+
+ native_to_netbsd32_ipc_perm14(&shmbuf->shm_perm, &oshmbuf->shm_perm);
+
+#define CVT(x) oshmbuf->x = shmbuf->x
+ CVT(shm_segsz);
+ CVT(shm_lpid);
+ CVT(shm_cpid);
+ CVT(shm_nattch);
+ CVT(shm_atime);
+ CVT(shm_dtime);
+ CVT(shm_ctime);
+#undef CVT
+}
+
+/*
+ * the compat_14 system calls
+ */
+int
+compat_14_netbsd32_msgctl(struct lwp *l, const struct compat_14_netbsd32_msgctl_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(int) msqid;
+ syscallarg(int) cmd;
+ syscallarg(struct msqid_ds14 *) buf;
+ } */
+ struct msqid_ds msqbuf;
+ struct netbsd32_msqid_ds14 omsqbuf;
+ int cmd, error;
+
+ cmd = SCARG(uap, cmd);
+
+ if (cmd == IPC_SET) {
+ error = copyin(SCARG_P32(uap, buf),
+ &omsqbuf, sizeof(omsqbuf));
+ if (error)
+ return (error);
+ netbsd32_msqid_ds14_to_native(&omsqbuf, &msqbuf);
+ }
+
+ error = msgctl1(l, SCARG(uap, msqid), cmd,
+ (cmd == IPC_SET || cmd == IPC_STAT) ? &msqbuf : NULL);
+
+ if (error == 0 && cmd == IPC_STAT) {
+ native_to_netbsd32_msqid_ds14(&msqbuf, &omsqbuf);
+ error = copyout(&omsqbuf,
+ SCARG_P32(uap, buf), sizeof(omsqbuf));
+ }
+
+ return (error);
+}
+#endif
+
+#if defined(SYSVSEM)
+int
+compat_14_netbsd32___semctl(struct lwp *l, const struct compat_14_netbsd32___semctl_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(int) semid;
+ syscallarg(int) semnum;
+ syscallarg(int) cmd;
+ syscallarg(union __semun *) arg;
+ } */
+ union __semun arg;
+ struct semid_ds sembuf;
+ struct netbsd32_semid_ds14 osembuf;
+ int cmd, error;
+ void *pass_arg = NULL;
+
+ cmd = SCARG(uap, cmd);
+
+ switch (cmd) {
+ case IPC_SET:
+ case IPC_STAT:
+ pass_arg = &sembuf;
+ break;
+
+ case GETALL:
+ case SETVAL:
+ case SETALL:
+ pass_arg = &arg;
+ break;
+ }
+
+ if (pass_arg != NULL) {
+ error = copyin(NETBSD32IPTR64(SCARG(uap, arg)), &arg,
+ sizeof(arg));
+ if (error)
+ return (error);
+ if (cmd == IPC_SET) {
+ error = copyin(arg.buf, &osembuf, sizeof(osembuf));
+ if (error)
+ return (error);
+ netbsd32_semid_ds14_to_native(&osembuf, &sembuf);
+ }
+ }
+
+ error = semctl1(l, SCARG(uap, semid), SCARG(uap, semnum), cmd,
+ pass_arg, retval);
+
+ if (error == 0 && cmd == IPC_STAT) {
+ native_to_netbsd32_semid_ds14(&sembuf, &osembuf);
+ error = copyout(&osembuf, arg.buf, sizeof(osembuf));
+ }
+
+ return (error);
+}
+#endif
+
+#if defined(SYSVSHM)
+int
+compat_14_netbsd32_shmctl(struct lwp *l, const struct compat_14_netbsd32_shmctl_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(int) shmid;
+ syscallarg(int) cmd;
+ syscallarg(struct netbsd32_shmid_ds14 *) buf;
+ } */
+ struct shmid_ds shmbuf;
+ struct netbsd32_shmid_ds14 oshmbuf;
+ int cmd, error;
+
+ cmd = SCARG(uap, cmd);
+
+ if (cmd == IPC_SET) {
+ error = copyin(SCARG_P32(uap, buf), &oshmbuf, sizeof(oshmbuf));
+ if (error)
+ return (error);
+ netbsd32_shmid_ds14_to_native(&oshmbuf, &shmbuf);
+ }
+
+ error = shmctl1(l, SCARG(uap, shmid), cmd,
+ (cmd == IPC_SET || cmd == IPC_STAT) ? &shmbuf : NULL);
+
+ if (error == 0 && cmd == IPC_STAT) {
+ native_to_netbsd32_shmid_ds14(&shmbuf, &oshmbuf);
+ error = copyout(&oshmbuf, SCARG_P32(uap, buf), sizeof(oshmbuf));
+ }
+
+ return (error);
+}
+#endif
+
+#define REQ1 "sysv_ipc,compat_sysv_14,"
+#define REQ2 "compat_netbsd32,compat_netbsd32_sysvipc,"
+#define REQ3 "compat_netbsd32_sysvipc_50"
+
+#define _PKG_ENTRY(name) \
+ { NETBSD32_SYS_ ## name, 0, (sy_call_t *)name }
+
+static const struct syscall_package compat_sysvipc_14_syscalls[] = {
+#if defined(SYSVSEM)
+ _PKG_ENTRY(compat_14_netbsd32___semctl),
+#endif
+#if defined(SYSVSHM)
+ _PKG_ENTRY(compat_14_netbsd32_shmctl),
+#endif
+#if defined(SYSVMSG)
+ _PKG_ENTRY(compat_14_netbsd32_msgctl),
+#endif
+ { 0, 0, NULL }
+};
+
+#define REQ1 "sysv_ipc,compat_sysv_14,"
+#define REQ2 "compat_netbsd32,compat_netbsd32_sysvipc,"
+#define REQ3 "compat_netbsd32_sysvipc_50"
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_sysvipc_14, REQ1 REQ2 REQ3 );
+
+static int
+compat_netbsd32_sysvipc_14_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_sysvipc_14_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_sysvipc_14_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
+
+#endif /* COMPAT_14 */
diff --git a/sys/compat/netbsd32/netbsd32_compat_16.c b/sys/compat/netbsd32/netbsd32_compat_16.c
new file mode 100644
index 00000000000..dc263268207
--- /dev/null
+++ b/sys/compat/netbsd32/netbsd32_compat_16.c
@@ -0,0 +1,80 @@
+/* $NetBSD: netbsd32_compat_16.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2008 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_16.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/dirent.h>
+#include <sys/lwp.h>
+#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+#include <compat/netbsd32/netbsd32_conv.h>
+
+struct uvm_object *emul_netbsd32_object;
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_16, "compat_netbsd32_20,compat_16");
+
+static int
+compat_netbsd32_16_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ emul_netbsd32.e_sigcode = netbsd32_sigcode;
+ emul_netbsd32.e_esigcode = netbsd32_esigcode;
+ emul_netbsd32.e_sigobject = &emul_netbsd32_object;
+ netbsd32_machdep_md_16_init();
+ return 0;
+
+ case MODULE_CMD_FINI:
+ emul_netbsd32.e_sigcode = NULL;
+ emul_netbsd32.e_esigcode = NULL;
+ emul_netbsd32.e_sigobject = NULL;
+ netbsd32_machdep_md_16_fini();
+ return 0;
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/netbsd32/netbsd32_compat_20.c b/sys/compat/netbsd32/netbsd32_compat_20.c
index 0199e79d88e..ac9a9d3fa1a 100644
--- a/sys/compat/netbsd32/netbsd32_compat_20.c
+++ b/sys/compat/netbsd32/netbsd32_compat_20.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_20.c,v 1.37 2018/05/10 02:36:07 christos Exp $ */
+/* $NetBSD: netbsd32_compat_20.c,v 1.38 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,10 +27,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.37 2018/05/10 02:36:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.38 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -41,10 +42,12 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.37 2018/05/10 02:36:07 chri
#include <sys/filedesc.h>
#include <sys/namei.h>
#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
#include <sys/proc.h>
#include <sys/dirent.h>
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
@@ -216,3 +219,35 @@ compat_20_netbsd32_fhstatfs(struct lwp *l, const struct compat_20_netbsd32_fhsta
#endif
return (compat_30_sys_fhstatvfs1(l, &ua, retval));
}
+
+static struct syscall_package compat_netbsd32_20_syscalls[] = {
+ { NETBSD32_SYS_compat_20_netbsd32_statfs, 0,
+ (sy_call_t *)compat_20_netbsd32_statfs },
+ { NETBSD32_SYS_compat_20_netbsd32_fstatfs, 0,
+ (sy_call_t *)compat_20_netbsd32_fstatfs },
+ { NETBSD32_SYS_compat_20_netbsd32_fhstatfs, 0,
+ (sy_call_t *)compat_20_netbsd32_fhstatfs },
+ { NETBSD32_SYS_compat_20_netbsd32_getfsstat, 0,
+ (sy_call_t *)compat_20_netbsd32_getfsstat },
+ { 0, 0, NULL }
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_20, "compat_netbsd32_30,compat_20");
+
+static int
+compat_netbsd32_20_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_netbsd32_20_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_netbsd32_20_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/netbsd32/netbsd32_compat_30.c b/sys/compat/netbsd32/netbsd32_compat_30.c
index 6f03d539a05..918dbae876e 100644
--- a/sys/compat/netbsd32/netbsd32_compat_30.c
+++ b/sys/compat/netbsd32/netbsd32_compat_30.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_30.c,v 1.32 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: netbsd32_compat_30.c,v 1.33 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,10 +27,16 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.32 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.33 2019/01/27 02:08:40 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include <opt_ntp.h>
+#endif
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/mount.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
@@ -44,17 +50,19 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.32 2018/09/03 16:29:29 rias
#include <sys/namei.h>
#include <sys/statvfs.h>
#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
#include <sys/proc.h>
#include <sys/dirent.h>
#include <sys/kauth.h>
#include <sys/vfs_syscalls.h>
+#include <sys/compat_stub.h>
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
#include <compat/sys/mount.h>
-
int
compat_30_netbsd32_getdents(struct lwp *l, const struct compat_30_netbsd32_getdents_args *uap, register_t *retval)
{
@@ -293,3 +301,83 @@ compat_30_netbsd32_fhopen(struct lwp *l, const struct compat_30_netbsd32_fhopen_
NETBSD32TO64_UAP(flags);
return (compat_30_sys_fhopen(l, &ua, retval));
}
+
+#ifdef NTP
+int
+compat_30_netbsd32_ntp_gettime(struct lwp *l, const struct compat_30_netbsd32_ntp_gettime_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(netbsd32_ntptimevalp_t) ntvp;
+ } */
+ struct netbsd32_ntptimeval30 ntv32;
+ struct ntptimeval ntv;
+ int error = 0;
+
+ if (vec_ntp_gettime == NULL)
+ return EINVAL;
+
+ if (SCARG_P32(uap, ntvp)) {
+ (*vec_ntp_gettime)(&ntv);
+
+ memset(&ntv32, 0, sizeof(ntv32));
+ ntv32.time.tv_sec = ntv.time.tv_sec;
+ ntv32.time.tv_usec = ntv.time.tv_nsec / 1000;
+ ntv32.maxerror = (netbsd32_long)ntv.maxerror;
+ ntv32.esterror = (netbsd32_long)ntv.esterror;
+ error = copyout(&ntv32, SCARG_P32(uap, ntvp), sizeof(ntv32));
+ }
+ if (!error) {
+ *retval = (*vec_ntp_timestatus)();
+ }
+
+ return (error);
+}
+#endif
+
+static struct syscall_package compat_netbsd32_30_syscalls[] = {
+ { NETBSD32_SYS_compat_30_netbsd32_getdents, 0,
+ (sy_call_t *)compat_30_netbsd32_getdents },
+ { NETBSD32_SYS_compat_30_netbsd32___stat13, 0,
+ (sy_call_t *)compat_30_netbsd32___stat13 },
+ { NETBSD32_SYS_compat_30_netbsd32___fstat13, 0,
+ (sy_call_t *)compat_30_netbsd32___fstat13 },
+ { NETBSD32_SYS_compat_30_netbsd32___lstat13, 0,
+ (sy_call_t *)compat_30_netbsd32___lstat13 },
+ { NETBSD32_SYS_compat_30_netbsd32_fhstat, 0,
+ (sy_call_t *)compat_30_netbsd32_fhstat },
+ { NETBSD32_SYS_compat_30_netbsd32_fhstatvfs1, 0,
+ (sy_call_t *)compat_30_netbsd32_fhstatvfs1 },
+ { NETBSD32_SYS_compat_30_netbsd32_socket, 0,
+ (sy_call_t *)compat_30_netbsd32_socket },
+ { NETBSD32_SYS_compat_30_netbsd32_getfh, 0,
+ (sy_call_t *)compat_30_netbsd32_getfh },
+ { NETBSD32_SYS_compat_30_netbsd32___fhstat30, 0,
+ (sy_call_t *)compat_30_netbsd32___fhstat30 },
+ { NETBSD32_SYS_compat_30_netbsd32_fhopen, 0,
+ (sy_call_t *)compat_30_netbsd32_fhopen },
+#ifdef NTP
+ { NETBSD32_SYS_compat_30_netbsd32_ntp_gettime, 0,
+ (sy_call_t *)compat_30_netbsd32_ntp_gettime },
+#endif
+ { 0, 0, NULL }
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_30, "compat_netbsd32_40,compat_30");
+
+static int
+compat_netbsd32_30_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_netbsd32_30_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_netbsd32_30_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/netbsd32/netbsd32_compat_43.c b/sys/compat/netbsd32/netbsd32_compat_43.c
index 9898cf335fd..ab7b9a752d6 100644
--- a/sys/compat/netbsd32/netbsd32_compat_43.c
+++ b/sys/compat/netbsd32/netbsd32_compat_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_43.c,v 1.56 2018/05/03 21:43:33 christos Exp $ */
+/* $NetBSD: netbsd32_compat_43.c,v 1.57 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.56 2018/05/03 21:43:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.57 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_43.h"
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.56 2018/05/03 21:43:33 chri
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/fcntl.h>
#include <sys/filedesc.h>
#include <sys/mbuf.h>
@@ -45,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.56 2018/05/03 21:43:33 chri
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/stat.h>
+#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/time.h>
#include <sys/ucred.h>
@@ -54,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.56 2018/05/03 21:43:33 chri
#include <sys/swap.h>
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/sys/stat.h>
@@ -67,7 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.56 2018/05/03 21:43:33 chri
SYS_DEF(compat_43_netbsd32_sethostid);
SYS_DEF(compat_43_netbsd32_killpg);
SYS_DEF(compat_43_netbsd32_sigblock);
-SYS_DEF(compat_43_netbsd32_sigblock);
SYS_DEF(compat_43_netbsd32_sigsetmask);
#undef SYS_DEF
@@ -708,3 +710,83 @@ compat_43_netbsd32_osigstack(struct lwp *l, const struct compat_43_netbsd32_osig
return error;
}
+
+static struct syscall_package compat_netbsd32_43_syscalls[] = {
+ { NETBSD32_SYS_compat_43_netbsd32_ocreat, 0,
+ (sy_call_t *)compat_43_netbsd32_ocreat },
+ { NETBSD32_SYS_compat_43_netbsd32_olseek, 0,
+ (sy_call_t *)compat_43_netbsd32_olseek },
+ { NETBSD32_SYS_compat_43_netbsd32_stat43, 0,
+ (sy_call_t *)compat_43_netbsd32_stat43 },
+ { NETBSD32_SYS_compat_43_netbsd32_lstat43, 0,
+ (sy_call_t *)compat_43_netbsd32_lstat43 },
+ { NETBSD32_SYS_compat_43_netbsd32_fstat43, 0,
+ (sy_call_t *)compat_43_netbsd32_fstat43 },
+ { NETBSD32_SYS_compat_43_netbsd32_otruncate, 0,
+ (sy_call_t *)compat_43_netbsd32_otruncate },
+ { NETBSD32_SYS_compat_43_netbsd32_oftruncate, 0,
+ (sy_call_t *)compat_43_netbsd32_oftruncate },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetdirentries, 0,
+ (sy_call_t *)compat_43_netbsd32_ogetdirentries },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetkerninfo, 0,
+ (sy_call_t *)compat_43_netbsd32_ogetkerninfo },
+ { NETBSD32_SYS_compat_43_netbsd32_ogethostname, 0,
+ (sy_call_t *)compat_43_netbsd32_ogethostname },
+ { NETBSD32_SYS_compat_43_netbsd32_osethostname, 0,
+ (sy_call_t *)compat_43_netbsd32_osethostname },
+ { NETBSD32_SYS_compat_43_netbsd32_sethostid, 0,
+ (sy_call_t *)compat_43_netbsd32_sethostid },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetrlimit, 0,
+ (sy_call_t *)compat_43_netbsd32_ogetrlimit },
+ { NETBSD32_SYS_compat_43_netbsd32_osetrlimit, 0,
+ (sy_call_t *)compat_43_netbsd32_osetrlimit },
+ { NETBSD32_SYS_compat_43_netbsd32_killpg, 0,
+ (sy_call_t *)compat_43_netbsd32_killpg },
+ { NETBSD32_SYS_compat_43_netbsd32_ommap, 0,
+ (sy_call_t *)compat_43_netbsd32_ommap },
+ { NETBSD32_SYS_compat_43_netbsd32_oaccept, 0,
+ (sy_call_t *)compat_43_netbsd32_oaccept },
+ { NETBSD32_SYS_compat_43_netbsd32_osend, 0,
+ (sy_call_t *)compat_43_netbsd32_osend },
+ { NETBSD32_SYS_compat_43_netbsd32_orecv, 0,
+ (sy_call_t *)compat_43_netbsd32_orecv },
+ { NETBSD32_SYS_compat_43_netbsd32_orecvmsg, 0,
+ (sy_call_t *)compat_43_netbsd32_orecvmsg },
+ { NETBSD32_SYS_compat_43_netbsd32_osendmsg, 0,
+ (sy_call_t *)compat_43_netbsd32_osendmsg },
+ { NETBSD32_SYS_compat_43_netbsd32_orecvfrom, 0,
+ (sy_call_t *)compat_43_netbsd32_orecvfrom },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetsockname, 0,
+ (sy_call_t *)compat_43_netbsd32_ogetsockname },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetpeername, 0,
+ (sy_call_t *)compat_43_netbsd32_ogetpeername },
+ { NETBSD32_SYS_compat_43_netbsd32_osigvec, 0,
+ (sy_call_t *)compat_43_netbsd32_osigvec },
+ { NETBSD32_SYS_compat_43_netbsd32_sigblock, 0,
+ (sy_call_t *)compat_43_netbsd32_sigblock },
+ { NETBSD32_SYS_compat_43_netbsd32_sigsetmask, 0,
+ (sy_call_t *)compat_43_netbsd32_sigsetmask },
+ { NETBSD32_SYS_compat_43_netbsd32_osigstack, 0,
+ (sy_call_t *)compat_43_netbsd32_osigstack },
+ { 0, 0, NULL }
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_43, "compat_netbsd32,compat_43");
+
+static int
+compat_netbsd32_43_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_netbsd32_43_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_netbsd32_43_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/netbsd32/netbsd32_compat_50.c b/sys/compat/netbsd32/netbsd32_compat_50.c
index c8e71b9d7dc..a92a5862e84 100644
--- a/sys/compat/netbsd32/netbsd32_compat_50.c
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50.c,v 1.33 2018/12/26 08:01:40 mrg Exp $ */
+/* $NetBSD: netbsd32_compat_50.c,v 1.34 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,14 +36,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.33 2018/12/26 08:01:40 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.34 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
+#include <opt_ntp.h>
#endif
+
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
@@ -59,16 +62,22 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.33 2018/12/26 08:01:40 mrg
#include <sys/namei.h>
#include <sys/statvfs.h>
#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
#include <sys/proc.h>
#include <sys/dirent.h>
#include <sys/kauth.h>
#include <sys/vfs_syscalls.h>
+#include <sys/rnd.h>
+#include <sys/compat_stub.h>
+#include <sys/module_hook.h>
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
#include <compat/sys/mount.h>
#include <compat/sys/time.h>
+#include <compat/sys/rnd.h>
#if defined(COMPAT_50)
@@ -924,4 +933,130 @@ compat_50_netbsd32_quotactl(struct lwp *l, const struct compat_50_netbsd32_quota
return (compat_50_sys_quotactl(l, &ua, retval));
}
+#ifdef NTP
+int
+compat_50_netbsd32_ntp_gettime(struct lwp *l,
+ const struct compat_50_netbsd32_ntp_gettime_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(netbsd32_ntptimeval50p_t) ntvp;
+ } */
+ struct netbsd32_ntptimeval50 ntv32;
+ struct ntptimeval ntv;
+ int error = 0;
+
+ if (vec_ntp_gettime == NULL)
+ return EINVAL;
+
+ if (SCARG_P32(uap, ntvp)) {
+ (*vec_ntp_gettime)(&ntv);
+
+ memset(&ntv32, 0, sizeof(ntv32));
+ ntv32.time.tv_sec = (int32_t)ntv.time.tv_sec;
+ ntv32.time.tv_nsec = ntv.time.tv_nsec;
+ ntv32.maxerror = (netbsd32_long)ntv.maxerror;
+ ntv32.esterror = (netbsd32_long)ntv.esterror;
+ ntv32.tai = (netbsd32_long)ntv.tai;
+ ntv32.time_state = ntv.time_state;
+ error = copyout(&ntv32, SCARG_P32(uap, ntvp), sizeof(ntv32));
+ }
+ if (!error) {
+ *retval = (*vec_ntp_timestatus)();
+ }
+
+ return (error);
+}
+#endif
+
+static struct syscall_package compat_netbsd32_50_syscalls[] = {
+ { NETBSD32_SYS_compat_50_netbsd32_mknod, 0,
+ (sy_call_t *)compat_50_netbsd32_mknod },
+ { NETBSD32_SYS_compat_50_netbsd32_select, 0,
+ (sy_call_t *)compat_50_netbsd32_select },
+ { NETBSD32_SYS_compat_50_netbsd32_gettimeofday, 0,
+ (sy_call_t *)compat_50_netbsd32_gettimeofday },
+ { NETBSD32_SYS_compat_50_netbsd32_settimeofday, 0,
+ (sy_call_t *)compat_50_netbsd32_settimeofday },
+ { NETBSD32_SYS_compat_50_netbsd32_utimes, 0,
+ (sy_call_t *)compat_50_netbsd32_utimes },
+ { NETBSD32_SYS_compat_50_netbsd32_futimes, 0,
+ (sy_call_t *)compat_50_netbsd32_futimes },
+ { NETBSD32_SYS_compat_50_netbsd32_adjtime, 0,
+ (sy_call_t *)compat_50_netbsd32_adjtime },
+ { NETBSD32_SYS_compat_50_netbsd32_clock_gettime, 0,
+ (sy_call_t *)compat_50_netbsd32_clock_gettime },
+ { NETBSD32_SYS_compat_50_netbsd32_clock_settime, 0,
+ (sy_call_t *)compat_50_netbsd32_clock_settime },
+ { NETBSD32_SYS_compat_50_netbsd32_clock_getres, 0,
+ (sy_call_t *)compat_50_netbsd32_clock_getres },
+ { NETBSD32_SYS_compat_50_netbsd32_timer_settime, 0,
+ (sy_call_t *)compat_50_netbsd32_timer_settime },
+ { NETBSD32_SYS_compat_50_netbsd32_timer_gettime, 0,
+ (sy_call_t *)compat_50_netbsd32_timer_gettime },
+ { NETBSD32_SYS_compat_50_netbsd32_nanosleep, 0,
+ (sy_call_t *)compat_50_netbsd32_nanosleep },
+ { NETBSD32_SYS_compat_50_netbsd32___sigtimedwait, 0,
+ (sy_call_t *)compat_50_netbsd32___sigtimedwait },
+ { NETBSD32_SYS_compat_50_netbsd32_lutimes, 0,
+ (sy_call_t *)compat_50_netbsd32_lutimes },
+ { NETBSD32_SYS_compat_50_netbsd32__lwp_park, 0,
+ (sy_call_t *)compat_50_netbsd32__lwp_park },
+ { NETBSD32_SYS_compat_50_netbsd32_kevent, 0,
+ (sy_call_t *)compat_50_netbsd32_kevent },
+ { NETBSD32_SYS_compat_50_netbsd32_pselect, 0,
+ (sy_call_t *)compat_50_netbsd32_pselect },
+ { NETBSD32_SYS_compat_50_netbsd32_pollts, 0,
+ (sy_call_t *)compat_50_netbsd32_pollts },
+ { NETBSD32_SYS_compat_50_netbsd32___stat30, 0,
+ (sy_call_t *)compat_50_netbsd32___stat30 },
+ { NETBSD32_SYS_compat_50_netbsd32___fstat30, 0,
+ (sy_call_t *)compat_50_netbsd32___fstat30 },
+ { NETBSD32_SYS_compat_50_netbsd32___lstat30, 0,
+ (sy_call_t *)compat_50_netbsd32___lstat30 },
+ { NETBSD32_SYS_compat_50_netbsd32___fhstat40, 0,
+ (sy_call_t *)compat_50_netbsd32___fhstat40 },
+ { NETBSD32_SYS_compat_50_netbsd32_wait4, 0,
+ (sy_call_t *)compat_50_netbsd32_wait4 },
+ { NETBSD32_SYS_compat_50_netbsd32_getrusage, 0,
+ (sy_call_t *)compat_50_netbsd32_getrusage },
+ { NETBSD32_SYS_compat_50_netbsd32_setitimer, 0,
+ (sy_call_t *)compat_50_netbsd32_setitimer },
+ { NETBSD32_SYS_compat_50_netbsd32_getitimer, 0,
+ (sy_call_t *)compat_50_netbsd32_getitimer },
+ { NETBSD32_SYS_compat_50_netbsd32_quotactl, 0,
+ (sy_call_t *)compat_50_netbsd32_quotactl },
+#ifdef NTP
+ { NETBSD32_SYS_compat_50_netbsd32_ntp_gettime, 0,
+ (sy_call_t *)compat_50_netbsd32_ntp_gettime },
+#endif
+ { 0, 0, NULL }
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_50, "compat_netbsd32_60,compat_50");
+
+static int
+compat_netbsd32_50_modcmd(modcmd_t cmd, void *arg)
+{
+ int ret;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ ret = syscall_establish(&emul_netbsd32,
+ compat_netbsd32_50_syscalls);
+ if (ret == 0)
+ MODULE_SET_HOOK(rnd_ioctl_50_32_hook, "rnd32_50",
+ compat32_50_rnd_ioctl);
+ return ret;
+
+ case MODULE_CMD_FINI:
+ ret = syscall_disestablish(&emul_netbsd32,
+ compat_netbsd32_50_syscalls);
+ if (ret == 0)
+ MODULE_UNSET_HOOK(rnd_ioctl_50_32_hook);
+ return ret;
+
+ default:
+ return ENOTTY;
+ }
+}
#endif /* COMPAT_50 */
diff --git a/sys/compat/netbsd32/netbsd32_compat_50_sysv.c b/sys/compat/netbsd32/netbsd32_compat_50_sysv.c
index 612ced0f2ba..afe374b0884 100644
--- a/sys/compat/netbsd32/netbsd32_compat_50_sysv.c
+++ b/sys/compat/netbsd32/netbsd32_compat_50_sysv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50_sysv.c,v 1.1 2015/12/03 10:38:21 pgoyette Exp $ */
+/* $NetBSD: netbsd32_compat_50_sysv.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50_sysv.c,v 1.1 2015/12/03 10:38:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50_sysv.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -45,11 +45,15 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50_sysv.c,v 1.1 2015/12/03 10:38:21
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/msg.h>
#include <sys/sem.h>
#include <sys/shm.h>
+#include <sys/syscallvar.h>
+
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
@@ -207,4 +211,43 @@ compat_50_netbsd32___shmctl13(struct lwp *l, const struct compat_50_netbsd32___s
}
#endif
+#define _PKG_ENTRY(name) \
+ { NETBSD32_SYS_ ## name, 0, (sy_call_t *)name }
+
+static const struct syscall_package compat_sysvipc_50_syscalls[] = {
+#if defined(SYSVSEM)
+ _PKG_ENTRY(compat_50_netbsd32___semctl14),
+#endif
+#if defined(SYSVSHM)
+ _PKG_ENTRY(compat_50_netbsd32___shmctl13),
+#endif
+#if defined(SYSVMSG)
+ _PKG_ENTRY(compat_50_netbsd32___msgctl13),
+#endif
+ { 0, 0, NULL }
+};
+
+#define REQ1 "sysv_ipc,compat_sysv_50,"
+#define REQ2 "compat_netbsd32,compat_netbsd32_sysvipc,"
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_sysvipc_50, REQ1 REQ2);
+
+static int
+compat_netbsd32_sysvipc_50_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_sysvipc_50_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_sysvipc_50_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
+
#endif /* COMPAT_50 */
diff --git a/sys/compat/netbsd32/netbsd32_compat_60.c b/sys/compat/netbsd32/netbsd32_compat_60.c
index addc02557be..b5cd850c648 100644
--- a/sys/compat/netbsd32/netbsd32_compat_60.c
+++ b/sys/compat/netbsd32/netbsd32_compat_60.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_60.c,v 1.3 2017/12/06 04:12:25 christos Exp $ */
+/* $NetBSD: netbsd32_compat_60.c,v 1.4 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,21 +36,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_60.c,v 1.3 2017/12/06 04:12:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_60.c,v 1.4 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
#include <sys/time.h>
#include <sys/dirent.h>
#include <sys/lwp.h>
#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
-
-
int
compat_60_netbsd32__lwp_park(struct lwp *l,
const struct compat_60_netbsd32__lwp_park_args *uap, register_t *retval)
@@ -85,3 +86,30 @@ compat_60_netbsd32__lwp_park(struct lwp *l,
return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp,
SCARG_P32(uap, hint));
}
+
+static struct syscall_package compat_netbsd32_60_syscalls[] = {
+ { NETBSD32_SYS_compat_60_netbsd32__lwp_park, 0,
+ (sy_call_t *)compat_60_netbsd32__lwp_park },
+ { 0, 0, NULL }
+};
+
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_60, "compat_netbsd32_80,compat_60");
+
+static int
+compat_netbsd32_60_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return syscall_establish(&emul_netbsd32,
+ compat_netbsd32_60_syscalls);
+
+ case MODULE_CMD_FINI:
+ return syscall_disestablish(&emul_netbsd32,
+ compat_netbsd32_60_syscalls);
+
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/compat/netbsd32/netbsd32_compat_80.c b/sys/compat/netbsd32/netbsd32_compat_80.c
new file mode 100644
index 00000000000..68f8a55908c
--- /dev/null
+++ b/sys/compat/netbsd32/netbsd32_compat_80.c
@@ -0,0 +1,198 @@
+/* $NetBSD: netbsd32_compat_80.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_80.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/dirent.h>
+#include <sys/kauth.h>
+#include <sys/module.h>
+#include <sys/kobj.h>
+
+#include <compat/sys/siginfo.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+#include <compat/netbsd32/netbsd32_conv.h>
+
+#ifdef COMPAT_80
+
+int netbsd32_80_modctl(struct lwp *, const struct netbsd32_modctl_args *,
+ register_t *);
+
+static int
+modctl32_handle_ostat(int cmd, struct netbsd32_iovec *iov, void *arg)
+{
+ omodstat_t *oms, *omso;
+ modinfo_t *mi;
+ module_t *mod;
+ vaddr_t addr;
+ size_t size;
+ size_t omslen;
+ size_t used;
+ int error;
+ int omscnt;
+ bool stataddr;
+ const char *suffix = "...";
+
+ if (cmd != MODCTL_OSTAT)
+ return EINVAL;
+
+ /* If not privileged, don't expose kernel addresses. */
+ error = kauth_authorize_system(kauth_cred_get(), KAUTH_SYSTEM_MODULE,
+ 0, (void *)(uintptr_t)MODCTL_STAT, NULL, NULL);
+ stataddr = (error == 0);
+
+ kernconfig_lock();
+ omscnt = 0;
+ TAILQ_FOREACH(mod, &module_list, mod_chain) {
+ omscnt++;
+ mi = mod->mod_info;
+ }
+ TAILQ_FOREACH(mod, &module_builtins, mod_chain) {
+ omscnt++;
+ mi = mod->mod_info;
+ }
+ omslen = omscnt * sizeof(omodstat_t);
+ omso = kmem_zalloc(omslen, KM_SLEEP);
+ oms = omso;
+ TAILQ_FOREACH(mod, &module_list, mod_chain) {
+ mi = mod->mod_info;
+ strlcpy(oms->oms_name, mi->mi_name, sizeof(oms->oms_name));
+ if (mi->mi_required != NULL) {
+ used = strlcpy(oms->oms_required, mi->mi_required,
+ sizeof(oms->oms_required));
+ if (used >= sizeof(oms->oms_required)) {
+ oms->oms_required[sizeof(oms->oms_required) -
+ strlen(suffix) - 1] = '\0';
+ strlcat(oms->oms_required, suffix,
+ sizeof(oms->oms_required));
+ }
+ }
+ if (mod->mod_kobj != NULL && stataddr) {
+ kobj_stat(mod->mod_kobj, &addr, &size);
+ oms->oms_addr = addr;
+ oms->oms_size = size;
+ }
+ oms->oms_class = mi->mi_class;
+ oms->oms_refcnt = mod->mod_refcnt;
+ oms->oms_source = mod->mod_source;
+ oms->oms_flags = mod->mod_flags;
+ oms++;
+ }
+ TAILQ_FOREACH(mod, &module_builtins, mod_chain) {
+ mi = mod->mod_info;
+ strlcpy(oms->oms_name, mi->mi_name, sizeof(oms->oms_name));
+ if (mi->mi_required != NULL) {
+ used = strlcpy(oms->oms_required, mi->mi_required,
+ sizeof(oms->oms_required));
+ if (used >= sizeof(oms->oms_required)) {
+ oms->oms_required[sizeof(oms->oms_required) -
+ strlen(suffix) - 1] = '\0';
+ strlcat(oms->oms_required, suffix,
+ sizeof(oms->oms_required));
+ }
+ }
+ if (mod->mod_kobj != NULL && stataddr) {
+ kobj_stat(mod->mod_kobj, &addr, &size);
+ oms->oms_addr = addr;
+ oms->oms_size = size;
+ }
+ oms->oms_class = mi->mi_class;
+ oms->oms_refcnt = -1;
+ KASSERT(mod->mod_source == MODULE_SOURCE_KERNEL);
+ oms->oms_source = mod->mod_source;
+ oms++;
+ }
+ kernconfig_unlock();
+ error = copyout(omso, NETBSD32PTR64(iov->iov_base),
+ uimin(omslen - sizeof(modstat_t), iov->iov_len));
+ kmem_free(omso, omslen);
+ if (error == 0) {
+ iov->iov_len = omslen - sizeof(modstat_t);
+ error = copyout(iov, arg, sizeof(*iov));
+ }
+
+ return error;
+}
+
+int
+netbsd32_80_modctl(struct lwp *lwp, const struct netbsd32_modctl_args *uap,
+ register_t *result)
+{
+ /* {
+ syscallarg(int) cmd;
+ syscallarg(netbsd32_voidp) arg;
+ } */
+ struct netbsd32_iovec iov;
+ int error;
+ void *arg;
+
+ arg = SCARG_P32(uap, arg);
+
+ switch (SCARG(uap, cmd)) {
+ case MODCTL_OSTAT:
+ error = copyin(arg, &iov, sizeof(iov));
+ if (error != 0) {
+ break;
+ }
+ error = modctl32_handle_ostat(SCARG(uap, cmd), &iov, arg);
+ break;
+ default:
+ error = EPASSTHROUGH;
+ break;
+ }
+
+ return error;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_80, "compat_netbsd32,compat_80");
+
+static int
+compat_netbsd32_80_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ MODULE_SET_HOOK(compat32_80_modctl_hook, "nb32_modctl_80",
+ netbsd32_80_modctl);
+ return 0;
+
+ case MODULE_CMD_FINI:
+ MODULE_UNSET_HOOK(compat32_80_modctl_hook);
+ return 0;
+
+ default:
+ return ENOTTY;
+ }
+}
+#endif /* COMPAT_80 */
diff --git a/sys/compat/netbsd32/netbsd32_exec.h b/sys/compat/netbsd32/netbsd32_exec.h
index 57073a1325f..d79e49d6f11 100644
--- a/sys/compat/netbsd32/netbsd32_exec.h
+++ b/sys/compat/netbsd32/netbsd32_exec.h
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_exec.h,v 1.33 2017/01/25 21:45:39 jakllsch Exp $ */
+/* $NetBSD: netbsd32_exec.h,v 1.34 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -52,8 +52,6 @@ struct netbsd32_exec {
netbsd32_u_long a_drsize; /* data relocation size */
};
-extern struct emul emul_netbsd32;
-
#ifdef EXEC_AOUT
int netbsd32_exec_aout_prep_zmagic(struct lwp *, struct exec_package *);
int netbsd32_exec_aout_prep_nmagic(struct lwp *, struct exec_package *);
diff --git a/sys/compat/netbsd32/netbsd32_exec_elf32.c b/sys/compat/netbsd32/netbsd32_exec_elf32.c
index 0d58d9e3ec6..c91ffef98c9 100644
--- a/sys/compat/netbsd32/netbsd32_exec_elf32.c
+++ b/sys/compat/netbsd32/netbsd32_exec_elf32.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_exec_elf32.c,v 1.40 2016/08/06 15:13:13 maxv Exp $ */
+/* $NetBSD: netbsd32_exec_elf32.c,v 1.41 2019/01/27 02:08:40 pgoyette Exp $ */
/* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */
/*
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_exec_elf32.c,v 1.40 2016/08/06 15:13:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_exec_elf32.c,v 1.41 2019/01/27 02:08:40 pgoyette Exp $");
#define ELFSIZE 32
@@ -72,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_exec_elf32.c,v 1.40 2016/08/06 15:13:13 max
#include <sys/signalvar.h>
#include <sys/kauth.h>
#include <sys/namei.h>
+#include <sys/compat_stub.h>
#include <compat/common/compat_util.h>
@@ -108,9 +109,11 @@ int
ELFNAME2(netbsd32,probe_noteless)(struct lwp *l, struct exec_package *epp,
void *eh, char *itp, vaddr_t *pos)
{
+ const char *m;
+
if (itp && epp->ep_interp == NULL) {
- extern const char machine32[];
- (void)compat_elf_check_interp(epp, itp, machine32);
+ MODULE_CALL_HOOK(netbsd32_machine32_hook, (), machine, m);
+ (void)compat_elf_check_interp(epp, itp, m);
}
#ifdef _LP64
epp->ep_flags |= EXEC_32 | EXEC_FORCEAUX;
diff --git a/sys/compat/netbsd32/netbsd32_ioctl.c b/sys/compat/netbsd32/netbsd32_ioctl.c
index ef42db87cb8..db770bb5d7c 100644
--- a/sys/compat/netbsd32/netbsd32_ioctl.c
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.100 2018/11/25 17:58:29 mlelstv Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.101 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.100 2018/11/25 17:58:29 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.101 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.100 2018/11/25 17:58:29 mlelstv
#include <sys/exec_elf.h>
#include <sys/ksyms.h>
#include <sys/drvctlio.h>
+#include <sys/compat_stub.h>
#ifdef __sparc__
#include <dev/sun/fbio.h>
@@ -1047,12 +1048,15 @@ netbsd32_do_clockctl_ntp_adjtime(struct clockctl_ntp_adjtime *args)
struct timex ntv;
int error;
+ if (vec_ntp_adjtime1 == NULL)
+ return EINVAL;
+
error = copyin(args->tp, &ntv32, sizeof(ntv32));
if (error)
return (error);
netbsd32_to_timex(&ntv32, &ntv);
- ntp_adjtime1(&ntv);
+ (*vec_ntp_adjtime1)(&ntv);
netbsd32_from_timex(&ntv, &ntv32);
error = copyout(&ntv32, args->tp, sizeof(ntv));
diff --git a/sys/compat/netbsd32/netbsd32_ipc.c b/sys/compat/netbsd32/netbsd32_ipc.c
index cb7b00b139e..24f94efc9da 100644
--- a/sys/compat/netbsd32/netbsd32_ipc.c
+++ b/sys/compat/netbsd32/netbsd32_ipc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ipc.c,v 1.18 2015/12/03 10:38:21 pgoyette Exp $ */
+/* $NetBSD: netbsd32_ipc.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.18 2015/12/03 10:38:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -52,8 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.18 2015/12/03 10:38:21 pgoyette E
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
-extern struct emul emul_netbsd32;
-
#define _PKG_ENTRY(name) \
{ NETBSD32_SYS_ ## name, 0, (sy_call_t *)name }
@@ -66,15 +64,6 @@ static const struct syscall_package compat_sysvipc_syscalls[] = {
_PKG_ENTRY(netbsd32_semget),
_PKG_ENTRY(netbsd32_semop),
_PKG_ENTRY(netbsd32_semconfig),
-#if defined(COMPAT_10)
- _PKG_ENTRY2(compat_10_osemsys, compat_10_netbsd32_semsys),
-#endif
-#if defined(COMPAT_14)
- _PKG_ENTRY(compat_14_netbsd32___semctl),
-#endif
-#if defined(COMPAT_50)
- _PKG_ENTRY(compat_50_netbsd32___semctl14),
-#endif
#endif /* SYSVSEM */
#if defined(SYSVSHM)
@@ -82,15 +71,6 @@ static const struct syscall_package compat_sysvipc_syscalls[] = {
_PKG_ENTRY(netbsd32___shmctl50),
_PKG_ENTRY(netbsd32_shmdt),
_PKG_ENTRY(netbsd32_shmget),
-#if defined(COMPAT_10)
- _PKG_ENTRY2(compat_10_oshmsys, compat_10_netbsd32_shmsys),
-#endif
-#if defined(COMPAT_14)
- _PKG_ENTRY(compat_14_netbsd32_shmctl),
-#endif
-#if defined(COMPAT_50)
- _PKG_ENTRY(compat_50_netbsd32___shmctl13),
-#endif
#endif /* SYSVSHM */
#if defined(SYSVMSG)
@@ -98,20 +78,12 @@ static const struct syscall_package compat_sysvipc_syscalls[] = {
_PKG_ENTRY(netbsd32_msgget),
_PKG_ENTRY(netbsd32_msgsnd),
_PKG_ENTRY(netbsd32_msgrcv),
-#if defined(COMPAT_10)
- _PKG_ENTRY2(compat_10_omsgsys, compat_10_netbsd32_msgsys),
-#endif
-#if defined(COMPAT_14)
- _PKG_ENTRY(compat_14_netbsd32_msgctl),
-#endif
-#if defined(COMPAT_50)
- _PKG_ENTRY(compat_50_netbsd32___msgctl13),
-#endif
#endif /* SYSVMSG */
{ 0, 0, NULL }
};
-MODULE(MODULE_CLASS_EXEC, compat_netbsd32_sysvipc, "sysv_ipc,compat_netbsd32");
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_sysvipc,
+ "compat_netbsd32,sysv_ipc");
static int
compat_netbsd32_sysvipc_modcmd(modcmd_t cmd, void *arg)
diff --git a/sys/compat/netbsd32/netbsd32_kern_proc.c b/sys/compat/netbsd32/netbsd32_kern_proc.c
new file mode 100644
index 00000000000..4174bb5b558
--- /dev/null
+++ b/sys/compat/netbsd32/netbsd32_kern_proc.c
@@ -0,0 +1,156 @@
+/* $NetBSD: netbsd32_kern_proc.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center, and 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ * The Regents of the University of California. 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_kern_proc.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_kstack.h"
+#include "opt_maxuprc.h"
+#include "opt_dtrace.h"
+#include "opt_compat_netbsd32.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/resourcevar.h>
+#include <sys/buf.h>
+#include <sys/acct.h>
+#include <sys/wait.h>
+#include <sys/file.h>
+#include <ufs/ufs/quota.h>
+#include <sys/uio.h>
+#include <sys/pool.h>
+#include <sys/pset.h>
+#include <sys/mbuf.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/signalvar.h>
+#include <sys/ras.h>
+#include <sys/filedesc.h>
+#include <sys/syscall_stats.h>
+#include <sys/kauth.h>
+#include <sys/sleepq.h>
+#include <sys/atomic.h>
+#include <sys/kmem.h>
+#include <sys/namei.h>
+#include <sys/dtrace_bsd.h>
+#include <sys/sysctl.h>
+#include <sys/exec.h>
+#include <sys/cpu.h>
+#include <sys/compat_stub.h>
+
+#include <uvm/uvm_extern.h>
+#include <uvm/uvm.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_kern_proc.h>
+
+static int
+copyin_psstrings_32(struct proc *p, struct ps_strings *arginfo)
+{
+ struct ps_strings32 arginfo32;
+
+ int error = copyin_proc(p, (void *)p->p_psstrp, &arginfo32,
+ sizeof(arginfo32));
+ if (error)
+ return error;
+ arginfo->ps_argvstr = (void *)(uintptr_t)arginfo32.ps_argvstr;
+ arginfo->ps_nargvstr = arginfo32.ps_nargvstr;
+ arginfo->ps_envstr = (void *)(uintptr_t)arginfo32.ps_envstr;
+ arginfo->ps_nenvstr = arginfo32.ps_nenvstr;
+ return 0;
+}
+
+static vaddr_t
+get_base32(char **argv, size_t i)
+{
+
+ netbsd32_charp *argv32;
+
+ argv32 = (netbsd32_charp *)argv;
+ return (vaddr_t)NETBSD32PTR64(argv32[i]);
+}
+
+void
+netbsd32_kern_proc_32_init(void)
+{
+
+#if !defined(_RUMPSERVER)
+ MODULE_SET_HOOK(kern_proc_32_copyin_hook, "kern_proc_32",
+ copyin_psstrings_32);
+ MODULE_SET_HOOK(kern_proc_32_base_hook, "kern_proc_32", get_base32);
+#endif
+}
+
+void
+netbsd32_kern_proc_32_fini(void)
+{
+
+#if !defined(_RUMPSERVER)
+ MODULE_UNSET_HOOK(kern_proc_32_copyin_hook);
+ MODULE_UNSET_HOOK(kern_proc_32_base_hook);
+#endif
+}
diff --git a/sys/compat/netbsd32/netbsd32_kern_proc.h b/sys/compat/netbsd32/netbsd32_kern_proc.h
new file mode 100644
index 00000000000..bb167c8c70b
--- /dev/null
+++ b/sys/compat/netbsd32/netbsd32_kern_proc.h
@@ -0,0 +1,38 @@
+/* $NetBSD: netbsd32_kern_proc.h,v 1.2 2019/01/27 02:08:40 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.
+ */
+
+#ifndef _NETBSD32_KERN_PROC_H
+#define _NETBSD32_KERN_PROC_H
+
+void netbsd32_kern_proc_32_init(void);
+void netbsd32_kern_proc_32_fini(void);
+
+#endif /* !_NETBSD32_KERN_PROC_H */
diff --git a/sys/compat/netbsd32/netbsd32_mod.c b/sys/compat/netbsd32/netbsd32_mod.c
index 14080fea170..6e642cbb243 100644
--- a/sys/compat/netbsd32/netbsd32_mod.c
+++ b/sys/compat/netbsd32/netbsd32_mod.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_mod.c,v 1.14 2018/12/26 08:01:40 mrg Exp $ */
+/* $NetBSD: netbsd32_mod.c,v 1.15 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.14 2018/12/26 08:01:40 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15 2019/01/27 02:08:40 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -44,11 +44,18 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.14 2018/12/26 08:01:40 mrg Exp $"
#include <sys/module.h>
#include <sys/exec.h>
#include <sys/exec_elf.h>
+#include <sys/module_hook.h>
#include <compat/netbsd32/netbsd32_sysctl.h>
+#include <compat/netbsd32/netbsd32_kern_proc.h>
#include <compat/netbsd32/netbsd32_exec.h>
-# define DEPS1 "compat,sysv_ipc,ksem"
+#define ELF32_AUXSIZE (howmany(ELF_AUX_ENTRIES * sizeof(Aux32Info), \
+ sizeof(Elf32_Addr)) + MAXPATHLEN + ALIGN(1))
+
+struct compat32_80_modctl_hook_t compat32_80_modctl_hook;
+
+# define DEPS1 "ksem,coredump,compat_util"
#if defined(EXEC_ELF32)
# define DEPS2 ",exec_elf32"
@@ -56,9 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.14 2018/12/26 08:01:40 mrg Exp $"
# define DEPS2 ""
#endif
-#define ELF32_AUXSIZE (howmany(ELF_AUX_ENTRIES * sizeof(Aux32Info), \
- sizeof(Elf32_Addr)) + MAXPATHLEN + ALIGN(1))
-
MODULE(MODULE_CLASS_EXEC, compat_netbsd32, DEPS1 DEPS2);
static struct execsw netbsd32_execsw[] = {
@@ -103,18 +107,27 @@ compat_netbsd32_modcmd(modcmd_t cmd, void *arg)
switch (cmd) {
case MODULE_CMD_INIT:
- netbsd32_sysctl_init();
error = exec_add(netbsd32_execsw,
__arraycount(netbsd32_execsw));
- if (error != 0)
- netbsd32_sysctl_fini();
+ if (error == 0) {
+ netbsd32_sysctl_init();
+ netbsd32_machdep_md_init();
+ netbsd32_kern_proc_32_init();
+ }
return error;
case MODULE_CMD_FINI:
+ netbsd32_machdep_md_fini();
+ netbsd32_sysctl_fini();
+ netbsd32_kern_proc_32_fini();
+
error = exec_remove(netbsd32_execsw,
__arraycount(netbsd32_execsw));
- if (error == 0)
- netbsd32_sysctl_fini();
+ if (error) {
+ netbsd32_kern_proc_32_init();
+ netbsd32_sysctl_init();
+ netbsd32_machdep_md_init();
+ }
return error;
default:
diff --git a/sys/compat/netbsd32/netbsd32_module.c b/sys/compat/netbsd32/netbsd32_module.c
index 6b1b682a1e9..0faeb1727c6 100644
--- a/sys/compat/netbsd32/netbsd32_module.c
+++ b/sys/compat/netbsd32/netbsd32_module.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_module.c,v 1.7 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: netbsd32_module.c,v 1.8 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_module.c,v 1.7 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_module.c,v 1.8 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@@ -45,12 +45,21 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_module.c,v 1.7 2018/09/03 16:29:29 riastrad
static int
modctl32_handle_stat(struct netbsd32_iovec *iov, void *arg)
{
+ int ms_cnt;
modstat_t *ms, *mso;
+ size_t ms_len;
+ int req_cnt;
+ char *req, *reqo;
+ size_t req_len;
+ char *out_p;
+ size_t out_s;
+
modinfo_t *mi;
module_t *mod;
vaddr_t addr;
size_t size;
- size_t mslen;
+ size_t used;
+ int off;
int error;
bool stataddr;
@@ -60,16 +69,54 @@ modctl32_handle_stat(struct netbsd32_iovec *iov, void *arg)
stataddr = (error == 0);
kernconfig_lock();
- mslen = (module_count+module_builtinlist+1) * sizeof(modstat_t);
- mso = kmem_zalloc(mslen, KM_SLEEP);
- ms = mso;
+ ms_cnt = 0;
+ req_len = 1;
+
+ /*
+ * Count up the number of modstat_t needed, and total size of
+ * require_module lists on both active and built-in lists
+ */
TAILQ_FOREACH(mod, &module_list, mod_chain) {
+ ms_cnt++;
+ mi = mod->mod_info;
+ if (mi->mi_required != NULL) {
+ req_cnt++;
+ req_len += strlen(mi->mi_required) + 1;
+ }
+ }
+ TAILQ_FOREACH(mod, &module_builtins, mod_chain) {
+ ms_cnt++;
mi = mod->mod_info;
- strlcpy(ms->ms_name, mi->mi_name, sizeof(ms->ms_name));
if (mi->mi_required != NULL) {
- strlcpy(ms->ms_required, mi->mi_required,
- sizeof(ms->ms_required));
+ req_cnt++;
+ req_len += strlen(mi->mi_required) + 1;
}
+ }
+
+ /* Allocate internal buffers to hold all the output data */
+ ms_len = ms_cnt * sizeof(modstat_t);
+ ms = kmem_zalloc(ms_len, KM_SLEEP);
+ req = kmem_zalloc(req_len, KM_SLEEP);
+
+ mso = ms;
+ reqo = req++;
+ off = 1;
+
+ /*
+ * Load data into our internal buffers for both active and
+ * build-in module lists
+ */
+ TAILQ_FOREACH(mod, &module_list, mod_chain) {
+ mi = mod->mod_info;
+ strlcpy(ms->ms_name, mi->mi_name, sizeof(ms->ms_name));
+ if (mi->mi_required != NULL) {
+ ms->ms_reqoffset = off;
+ used = strlcpy(req, mi->mi_required, req_len - off);
+ KASSERTMSG(used < req_len - off, "reqlist grew!");
+ off = used + 1;
+ req += used + 1;
+ } else
+ ms->ms_reqoffset = 0;
if (mod->mod_kobj != NULL && stataddr) {
kobj_stat(mod->mod_kobj, &addr, &size);
ms->ms_addr = addr;
@@ -85,9 +132,13 @@ modctl32_handle_stat(struct netbsd32_iovec *iov, void *arg)
mi = mod->mod_info;
strlcpy(ms->ms_name, mi->mi_name, sizeof(ms->ms_name));
if (mi->mi_required != NULL) {
- strlcpy(ms->ms_required, mi->mi_required,
- sizeof(ms->ms_required));
- }
+ ms->ms_reqoffset = off;
+ used = strlcpy(req, mi->mi_required, req_len - off);
+ KASSERTMSG(used < req_len - off, "reqlist grew!");
+ off += used + 1;
+ req += used + 1;
+ } else
+ ms->ms_reqoffset = 0;
if (mod->mod_kobj != NULL && stataddr) {
kobj_stat(mod->mod_kobj, &addr, &size);
ms->ms_addr = addr;
@@ -100,11 +151,41 @@ modctl32_handle_stat(struct netbsd32_iovec *iov, void *arg)
ms++;
}
kernconfig_unlock();
- error = copyout(mso, NETBSD32PTR64(iov->iov_base),
- uimin(mslen - sizeof(modstat_t), iov->iov_len));
- kmem_free(mso, mslen);
+
+ /*
+ * Now copyout our internal buffers back to userland
+ */
+ out_p = NETBSD32PTR64(iov->iov_base);
+ out_s = iov->iov_len;
+ size = sizeof(ms_cnt);
+
+ /* Copy out the count of modstat_t */
+ if (out_s) {
+ size = uimin(sizeof(ms_cnt), out_s);
+ error = copyout(&ms_cnt, out_p, size);
+ out_p += size;
+ out_s -= size;
+ }
+ /* Copy out the modstat_t array */
+ if (out_s && error == 0) {
+ size = uimin(ms_len, out_s);
+ error = copyout(mso, out_p, size);
+ out_p += size;
+ out_s -= size;
+ }
+ /* Copy out the "required" strings */
+ if (out_s && error == 0) {
+ size = uimin(req_len, out_s);
+ error = copyout(reqo, out_p, size);
+ out_p += size;
+ out_s -= size;
+ }
+ kmem_free(mso, ms_len);
+ kmem_free(reqo, req_len);
+
+ /* Finally, update the userland copy of the iovec's length */
if (error == 0) {
- iov->iov_len = mslen - sizeof(modstat_t);
+ iov->iov_len = ms_len + req_len + sizeof(ms_cnt);
error = copyout(iov, arg, sizeof(*iov));
}
@@ -112,6 +193,14 @@ modctl32_handle_stat(struct netbsd32_iovec *iov, void *arg)
}
int
+compat32_80_modctl_compat_stub(struct lwp *lwp,
+ const struct netbsd32_modctl_args *uap, register_t *result)
+{
+
+ return EPASSTHROUGH;
+}
+
+int
netbsd32_modctl(struct lwp *lwp, const struct netbsd32_modctl_args *uap,
register_t *result)
{
@@ -130,6 +219,11 @@ netbsd32_modctl(struct lwp *lwp, const struct netbsd32_modctl_args *uap,
arg = SCARG_P32(uap, arg);
+ MODULE_CALL_HOOK(compat32_80_modctl_hook, (lwp, uap, result),
+ enosys(), error);
+ if (error != EPASSTHROUGH && error != ENOSYS)
+ return error;
+
switch (SCARG(uap, cmd)) {
case MODCTL_LOAD:
error = copyin(arg, &ml, sizeof(ml));
diff --git a/sys/compat/netbsd32/netbsd32_mqueue.c b/sys/compat/netbsd32/netbsd32_mqueue.c
index b56086c1faa..c65abcc28d0 100644
--- a/sys/compat/netbsd32/netbsd32_mqueue.c
+++ b/sys/compat/netbsd32/netbsd32_mqueue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_mqueue.c,v 1.6 2015/12/01 23:56:43 pgoyette Exp $ */
+/* $NetBSD: netbsd32_mqueue.c,v 1.7 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mqueue.c,v 1.6 2015/12/01 23:56:43 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mqueue.c,v 1.7 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -47,8 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_mqueue.c,v 1.6 2015/12/01 23:56:43 pgoyette
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
-extern struct emul emul_netbsd32;
-
int
netbsd32_mq_open(struct lwp *l, const struct netbsd32_mq_open_args *uap,
register_t *retval)
diff --git a/sys/compat/netbsd32/netbsd32_netbsd.c b/sys/compat/netbsd32/netbsd32_netbsd.c
index 06549041428..8b90967e5a1 100644
--- a/sys/compat/netbsd32/netbsd32_netbsd.c
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_netbsd.c,v 1.222 2018/12/24 21:27:05 mrg Exp $ */
+/* $NetBSD: netbsd32_netbsd.c,v 1.223 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
@@ -27,7 +27,15 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.222 2018/12/24 21:27:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.223 2019/01/27 02:08:40 pgoyette Exp $");
+
+/*
+ * below are all the standard NetBSD system calls, in the 32bit
+ * environment, with the necessary conversions to 64bit before calling
+ * the real syscall. anything that needs special attention is handled
+ * elsewhere - this file should only contain structure assignment and
+ * calls to the original function.
+ */
/*
* below are all the standard NetBSD system calls, in the 32bit
@@ -94,11 +102,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.222 2018/12/24 21:27:05 mrg Ex
#include <ddb/ddbvar.h>
#endif
-extern struct sysent netbsd32_sysent[];
-extern const uint32_t netbsd32_sysent_nomodbits[];
-#ifdef SYSCALL_DEBUG
-extern const char * const netbsd32_syscallnames[];
-#endif
#ifdef __HAVE_SYSCALL_INTERN
void netbsd32_syscall_intern(struct proc *);
#else
@@ -107,13 +110,6 @@ void syscall(void);
#define LIMITCHECK(a, b) ((a) != RLIM_INFINITY && (a) > (b))
-#ifdef COMPAT_16
-extern char netbsd32_sigcode[], netbsd32_esigcode[];
-struct uvm_object *emul_netbsd32_object;
-#endif
-
-extern struct sysctlnode netbsd32_sysctl_root;
-
#ifdef MODULAR
#include <compat/netbsd32/netbsd32_syscalls_autoload.c>
#endif
@@ -139,15 +135,9 @@ struct emul emul_netbsd32 = {
#endif
.e_sendsig = netbsd32_sendsig,
.e_trapsignal = trapsignal,
-#ifdef COMPAT_16
- .e_sigcode = netbsd32_sigcode,
- .e_esigcode = netbsd32_esigcode,
- .e_sigobject = &emul_netbsd32_object,
-#else
.e_sigcode = NULL,
.e_esigcode = NULL,
.e_sigobject = NULL,
-#endif
.e_setregs = netbsd32_setregs,
.e_proc_exec = NULL,
.e_proc_fork = NULL,
diff --git a/sys/compat/netbsd32/netbsd32_nfssvc.c b/sys/compat/netbsd32/netbsd32_nfssvc.c
index 54a69d82fec..aacd4ae641e 100644
--- a/sys/compat/netbsd32/netbsd32_nfssvc.c
+++ b/sys/compat/netbsd32/netbsd32_nfssvc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_nfssvc.c,v 1.5 2016/10/15 06:50:13 skrll Exp $ */
+/* $NetBSD: netbsd32_nfssvc.c,v 1.6 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 2015 Matthew R. Green
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_nfssvc.c,v 1.5 2016/10/15 06:50:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_nfssvc.c,v 1.6 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfs.h"
@@ -53,8 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_nfssvc.c,v 1.5 2016/10/15 06:50:13 skrll Ex
#include <nfs/nfs.h>
#include <nfs/nfs_var.h>
-extern struct emul emul_netbsd32;
-
static int nfssvc32_addsock_in(struct nfsd_args *, const void *);
static int nfssvc32_setexports_in(struct mountd_exports_list *, const void *);
static int nfssvc32_nsd_in(struct nfsd_srvargs *, const void *);
diff --git a/sys/compat/netbsd32/netbsd32_ptrace.c b/sys/compat/netbsd32/netbsd32_ptrace.c
index 948b0354764..614d363c312 100644
--- a/sys/compat/netbsd32/netbsd32_ptrace.c
+++ b/sys/compat/netbsd32/netbsd32_ptrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ptrace.c,v 1.5 2017/12/17 20:59:27 christos Exp $ */
+/* $NetBSD: netbsd32_ptrace.c,v 1.6 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ptrace.c,v 1.5 2017/12/17 20:59:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ptrace.c,v 1.6 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ptrace.h"
@@ -47,9 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ptrace.c,v 1.5 2017/12/17 20:59:27 christos
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
-extern struct emul emul_netbsd32;
-
-
/*
* PTRACE methods
*/
diff --git a/sys/compat/netbsd32/netbsd32_rndpseudo_50.c b/sys/compat/netbsd32/netbsd32_rndpseudo_50.c
new file mode 100644
index 00000000000..427bae1ca14
--- /dev/null
+++ b/sys/compat/netbsd32/netbsd32_rndpseudo_50.c
@@ -0,0 +1,124 @@
+/* $NetBSD: netbsd32_rndpseudo_50.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Michael Graff <explorer@flame.org> and Thor Lancelot Simon.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_rndpseudo_50.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/file.h>
+
+#include <sys/rnd.h>
+#include <compat/sys/rnd.h>
+
+/*
+ * Convert from rndsource_t to rndsource50_t, for the results from
+ * RNDGETNUM50 and RNDGETNAME50.
+ */
+
+/*
+ * Convert from rndsource_t to rndsource50_32_t, for the results from
+ * RNDGETNUM50_32 and RNDGETNAME50_32.
+ */
+static void
+rndsource_to_rndsource50_32(rndsource_t *r, rndsource50_32_t *r50_32)
+{
+ memset(r50_32, 0, sizeof(*r50_32));
+ strlcpy(r50_32->name, r->name, sizeof(r50_32->name));
+ r50_32->total = r->total;
+ r50_32->type = r->type;
+ r50_32->flags = r->flags;
+}
+
+/*
+ * COMPAT32_50 handling for rnd_ioctl. This is called from rnd_ioctl.
+ *
+ * It also handles the case of (COMPAT_50 && COMPAT_NETBSD32).
+ */
+int
+compat32_50_rnd_ioctl(struct file *fp, u_long cmd, void *addr)
+{
+ int ret = 0;
+
+ switch (cmd) {
+ case RNDGETSRCNUM50_32:
+ {
+ rndstat_t rstbuf = {.start = 0};
+ rndstat50_32_t *rst50_32 = (rndstat50_32_t *)addr;
+ int count;
+
+ if (rst50_32->count > RND_MAXSTATCOUNT50)
+ return (EINVAL);
+
+ rstbuf.start = rst50_32->start;
+ rstbuf.count = rst50_32->count;
+
+ ret = (fp->f_ops->fo_ioctl)(fp, RNDGETSRCNUM, &rstbuf);
+ if (ret != 0)
+ return ret;
+
+ for (count = 0; count < rst50_32->count; count++) {
+ rndsource_to_rndsource50_32(&rstbuf.source[count],
+ &rst50_32->source[count]);
+ }
+ rst50_32->count = rstbuf.count;
+
+ break;
+ }
+
+ case RNDGETSRCNAME50_32:
+ {
+ rndstat_name_t rstnmbuf = {.name[0] = 0};
+ rndstat_name50_32_t *rstnm50_32;
+ rstnm50_32 = (rndstat_name50_32_t *)addr;
+
+ strlcpy(rstnmbuf.name, rstnm50_32->name, sizeof(rstnmbuf.name));
+
+ ret = (fp->f_ops->fo_ioctl)(fp, RNDGETSRCNAME, &rstnmbuf);
+ if (ret != 0)
+ return ret;
+
+ rndsource_to_rndsource50_32(&rstnmbuf.source,
+ &rstnm50_32->source);
+
+ break;
+ }
+
+ default:
+ return ENOTTY;
+ }
+
+ return ret;
+}
diff --git a/sys/compat/netbsd32/netbsd32_syscall.h b/sys/compat/netbsd32/netbsd32_syscall.h
index bc31d573788..7c250c6b723 100644
--- a/sys/compat/netbsd32/netbsd32_syscall.h
+++ b/sys/compat/netbsd32/netbsd32_syscall.h
@@ -1,10 +1,10 @@
-/* $NetBSD: netbsd32_syscall.h,v 1.139 2018/12/24 21:27:37 mrg Exp $ */
+/* $NetBSD: netbsd32_syscall.h,v 1.140 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.124 2018/12/24 21:27:06 mrg Exp
+ * created from NetBSD: syscalls.master,v 1.120.2.19 2018/09/29 04:22:31 pgoyette Exp
*/
#ifndef _NETBSD32_SYS_SYSCALL_H_
@@ -479,15 +479,14 @@
/* syscall: "netbsd32_pwrite" ret: "netbsd32_ssize_t" args: "int" "netbsd32_voidp" "netbsd32_size_t" "int" "netbsd32_off_t" */
#define NETBSD32_SYS_netbsd32_pwrite 174
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* syscall: "compat_30_netbsd32_ntp_gettime" ret: "int" args: "netbsd32_ntptimeval50p_t" */
#define NETBSD32_SYS_compat_30_netbsd32_ntp_gettime 175
+#if defined(NTP) || !defined(_KERNEL_OPT)
/* syscall: "netbsd32_ntp_adjtime" ret: "int" args: "netbsd32_timexp_t" */
#define NETBSD32_SYS_netbsd32_ntp_adjtime 176
#else
- /* 175 is excluded ntp_gettime */
/* 176 is excluded ntp_adjtime */
#endif
/* syscall: "netbsd32_setgid" ret: "int" args: "gid_t" */
@@ -1032,13 +1031,9 @@
/* syscall: "compat_30_netbsd32___fhstat30" ret: "int" args: "netbsd32_fhandlep_t" "netbsd32_stat50p_t" */
#define NETBSD32_SYS_compat_30_netbsd32___fhstat30 392
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* syscall: "compat_50_netbsd32_ntp_gettime" ret: "int" args: "netbsd32_ntptimeval50p_t" */
#define NETBSD32_SYS_compat_50_netbsd32_ntp_gettime 393
-#else
- /* 393 is excluded __ntp_gettime30 */
-#endif
/* syscall: "netbsd32___socket30" ret: "int" args: "int" "int" "int" */
#define NETBSD32_SYS_netbsd32___socket30 394
diff --git a/sys/compat/netbsd32/netbsd32_syscallargs.h b/sys/compat/netbsd32/netbsd32_syscallargs.h
index 2c84a298eed..9f8dbb57382 100644
--- a/sys/compat/netbsd32/netbsd32_syscallargs.h
+++ b/sys/compat/netbsd32/netbsd32_syscallargs.h
@@ -1,10 +1,10 @@
-/* $NetBSD: netbsd32_syscallargs.h,v 1.138 2018/12/24 21:27:37 mrg Exp $ */
+/* $NetBSD: netbsd32_syscallargs.h,v 1.139 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.124 2018/12/24 21:27:06 mrg Exp
+ * created from NetBSD: syscalls.master,v 1.120.2.19 2018/09/29 04:22:31 pgoyette Exp
*/
#ifndef _NETBSD32_SYS_SYSCALLARGS_H_
@@ -908,12 +908,12 @@ struct netbsd32_pwrite_args {
syscallarg(netbsd32_off_t) offset;
};
check_syscall_args(netbsd32_pwrite)
-#if defined(NTP) || !defined(_KERNEL_OPT)
struct compat_30_netbsd32_ntp_gettime_args {
syscallarg(netbsd32_ntptimeval50p_t) ntvp;
};
check_syscall_args(compat_30_netbsd32_ntp_gettime)
+#if defined(NTP) || !defined(_KERNEL_OPT)
struct netbsd32_ntp_adjtime_args {
syscallarg(netbsd32_timexp_t) tp;
@@ -2053,14 +2053,11 @@ struct compat_30_netbsd32___fhstat30_args {
syscallarg(netbsd32_stat50p_t) sb;
};
check_syscall_args(compat_30_netbsd32___fhstat30)
-#if defined(NTP) || !defined(_KERNEL_OPT)
struct compat_50_netbsd32_ntp_gettime_args {
syscallarg(netbsd32_ntptimeval50p_t) ntvp;
};
check_syscall_args(compat_50_netbsd32_ntp_gettime)
-#else
-#endif
struct netbsd32___socket30_args {
syscallarg(int) domain;
@@ -2927,9 +2924,9 @@ int netbsd32_pread(struct lwp *, const struct netbsd32_pread_args *, register_t
int netbsd32_pwrite(struct lwp *, const struct netbsd32_pwrite_args *, register_t *);
-#if defined(NTP) || !defined(_KERNEL_OPT)
int compat_30_netbsd32_ntp_gettime(struct lwp *, const struct compat_30_netbsd32_ntp_gettime_args *, register_t *);
+#if defined(NTP) || !defined(_KERNEL_OPT)
int netbsd32_ntp_adjtime(struct lwp *, const struct netbsd32_ntp_adjtime_args *, register_t *);
#else
@@ -3286,11 +3283,8 @@ int netbsd32___getdents30(struct lwp *, const struct netbsd32___getdents30_args
int compat_30_netbsd32___fhstat30(struct lwp *, const struct compat_30_netbsd32___fhstat30_args *, register_t *);
-#if defined(NTP) || !defined(_KERNEL_OPT)
int compat_50_netbsd32_ntp_gettime(struct lwp *, const struct compat_50_netbsd32_ntp_gettime_args *, register_t *);
-#else
-#endif
int netbsd32___socket30(struct lwp *, const struct netbsd32___socket30_args *, register_t *);
int netbsd32___getfh30(struct lwp *, const struct netbsd32___getfh30_args *, register_t *);
diff --git a/sys/compat/netbsd32/netbsd32_syscalls.c b/sys/compat/netbsd32/netbsd32_syscalls.c
index e0e54bb1efe..7377f3109b9 100644
--- a/sys/compat/netbsd32/netbsd32_syscalls.c
+++ b/sys/compat/netbsd32/netbsd32_syscalls.c
@@ -1,14 +1,14 @@
-/* $NetBSD: netbsd32_syscalls.c,v 1.138 2018/12/24 21:27:37 mrg Exp $ */
+/* $NetBSD: netbsd32_syscalls.c,v 1.139 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.124 2018/12/24 21:27:06 mrg Exp
+ * created from NetBSD: syscalls.master,v 1.120.2.19 2018/09/29 04:22:31 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.138 2018/12/24 21:27:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.139 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)
@@ -203,11 +203,10 @@ const char *const netbsd32_syscallnames[] = {
/* 172 */ "#172 (unimplemented)",
/* 173 */ "netbsd32_pread",
/* 174 */ "netbsd32_pwrite",
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* 175 */ "compat_30_netbsd32_ntp_gettime",
+#if defined(NTP) || !defined(_KERNEL_OPT)
/* 176 */ "netbsd32_ntp_adjtime",
#else
- /* 175 */ "#175 (excluded ntp_gettime)",
/* 176 */ "#176 (excluded ntp_adjtime)",
#endif
/* 177 */ "#177 (unimplemented)",
@@ -426,11 +425,7 @@ const char *const netbsd32_syscallnames[] = {
/* 390 */ "netbsd32___getdents30",
/* 391 */ "#391 (ignored old posix fadvise)",
/* 392 */ "compat_30_netbsd32___fhstat30",
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* 393 */ "compat_50_netbsd32_ntp_gettime",
-#else
- /* 393 */ "#393 (excluded __ntp_gettime30)",
-#endif
/* 394 */ "netbsd32___socket30",
/* 395 */ "netbsd32___getfh30",
/* 396 */ "netbsd32___fhopen40",
@@ -733,11 +728,10 @@ const char *const altnetbsd32_syscallnames[] = {
/* 172 */ NULL, /* unimplemented */
/* 173 */ "pread",
/* 174 */ "pwrite",
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* 175 */ NULL, /* compat_30_netbsd32_ntp_gettime */
+#if defined(NTP) || !defined(_KERNEL_OPT)
/* 176 */ "ntp_adjtime",
#else
- /* 175 */ NULL, /* excluded ntp_gettime */
/* 176 */ NULL, /* excluded ntp_adjtime */
#endif
/* 177 */ NULL, /* unimplemented */
@@ -956,11 +950,7 @@ const char *const altnetbsd32_syscallnames[] = {
/* 390 */ "getdents",
/* 391 */ NULL, /* ignored old posix fadvise */
/* 392 */ NULL, /* compat_30_netbsd32___fhstat30 */
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* 393 */ NULL, /* compat_50_netbsd32_ntp_gettime */
-#else
- /* 393 */ NULL, /* excluded __ntp_gettime30 */
-#endif
/* 394 */ "socket",
/* 395 */ "getfh",
/* 396 */ "fhopen",
diff --git a/sys/compat/netbsd32/netbsd32_syscalls_autoload.c b/sys/compat/netbsd32/netbsd32_syscalls_autoload.c
index 939151a064b..6f6f0d00c63 100644
--- a/sys/compat/netbsd32/netbsd32_syscalls_autoload.c
+++ b/sys/compat/netbsd32/netbsd32_syscalls_autoload.c
@@ -1,34 +1,108 @@
-/* $NetBSD: netbsd32_syscalls_autoload.c,v 1.18 2018/12/24 21:27:37 mrg Exp $ */
+/* $NetBSD: netbsd32_syscalls_autoload.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call autoload table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.124 2018/12/24 21:27:06 mrg Exp
+ * created from NetBSD: syscalls.master,v 1.120.2.19 2018/09/29 04:22:31 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls_autoload.c,v 1.18 2018/12/24 21:27:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls_autoload.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/proc.h>
static struct sc_autoload netbsd32_syscalls_autoload[] = {
+ { NETBSD32_SYS_compat_50_netbsd32_wait4, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_43_netbsd32_ocreat, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_50_netbsd32_mknod, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_20_netbsd32_getfsstat, "compat_netbsd32_20" },
+ { NETBSD32_SYS_compat_43_netbsd32_olseek, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_40_netbsd32_mount, "compat_netbsd32_40" },
{ NETBSD32_SYS_netbsd32_ptrace, "compat_netbsd32_ptrace" },
+ { NETBSD32_SYS_compat_43_netbsd32_stat43, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_lstat43, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_13_sigprocmask13, "compat_netbsd32_13" },
+ { NETBSD32_SYS_compat_13_sigpending13, "compat_netbsd32_13" },
+ { NETBSD32_SYS_compat_13_netbsd32_sigaltstack13, "compat_netbsd32_13" },
+ { NETBSD32_SYS_compat_12_netbsd32_reboot, "compat_netbsd32_12" },
+ { NETBSD32_SYS_compat_43_netbsd32_fstat43, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetkerninfo, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_ogetpagesize, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_12_netbsd32_msync, "compat_netbsd32_12" },
+ { NETBSD32_SYS_compat_43_netbsd32_ommap, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_50_netbsd32_setitimer, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_43_owait, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_12_netbsd32_oswapon, "compat_netbsd32_12" },
+ { NETBSD32_SYS_compat_50_netbsd32_getitimer, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_43_netbsd32_ogethostname, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_osethostname, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_ogetdtablesize, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_50_netbsd32_select, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_30_netbsd32_socket, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_43_netbsd32_oaccept, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_osend, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_orecv, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_13_sigreturn13, "compat_netbsd32_13" },
+ { NETBSD32_SYS_compat_43_netbsd32_osigvec, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_sigblock, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_sigsetmask, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_13_sigsuspend13, "compat_netbsd32_13" },
+ { NETBSD32_SYS_compat_43_netbsd32_osigstack, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_orecvmsg, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_osendmsg, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_50_netbsd32_gettimeofday, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_getrusage, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_settimeofday, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_43_netbsd32_orecvfrom, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_otruncate, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_oftruncate, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_50_netbsd32_utimes, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_adjtime, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetpeername, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_ogethostid, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_sethostid, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetrlimit, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_osetrlimit, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_killpg, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_50_netbsd32_quotactl, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_43_oquota, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetsockname, "compat_netbsd32_43" },
{ NETBSD32_SYS_netbsd32_nfssvc, "compat_netbsd32_nfssrv" },
- { NETBSD32_SYS_compat_10_osemsys, "compat_netbsd32_sysvipc" },
- { NETBSD32_SYS_compat_10_omsgsys, "compat_netbsd32_sysvipc" },
- { NETBSD32_SYS_compat_10_oshmsys, "compat_netbsd32_sysvipc" },
- { NETBSD32_SYS_compat_14_netbsd32___semctl, "compat_netbsd32_sysvipc" },
+ { NETBSD32_SYS_compat_43_netbsd32_ogetdirentries, "compat_netbsd32_43" },
+ { NETBSD32_SYS_compat_20_netbsd32_statfs, "compat_netbsd32_20" },
+ { NETBSD32_SYS_compat_20_netbsd32_fstatfs, "compat_netbsd32_20" },
+ { NETBSD32_SYS_compat_30_netbsd32_getfh, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_09_netbsd32_ogetdomainname, "compat_netbsd32_09" },
+ { NETBSD32_SYS_compat_09_netbsd32_osetdomainname, "compat_netbsd32_09" },
+ { NETBSD32_SYS_compat_09_netbsd32_uname, "compat_netbsd32_09" },
+ { NETBSD32_SYS_compat_10_osemsys, "compat_netbsd32_sysvipc_10" },
+ { NETBSD32_SYS_compat_10_omsgsys, "compat_netbsd32_sysvipc_10" },
+ { NETBSD32_SYS_compat_10_oshmsys, "compat_netbsd32_sysvipc_10" },
+ { NETBSD32_SYS_compat_30_netbsd32_ntp_gettime, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_12_netbsd32_stat12, "compat_netbsd32_12" },
+ { NETBSD32_SYS_compat_12_netbsd32_fstat12, "compat_netbsd32_12" },
+ { NETBSD32_SYS_compat_12_netbsd32_lstat12, "compat_netbsd32_12" },
+ { NETBSD32_SYS_compat_12_netbsd32_getdirentries, "compat_netbsd32_12" },
+ { NETBSD32_SYS_compat_50_netbsd32_futimes, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_14_netbsd32___semctl, "compat_netbsd32_sysvipc_14" },
{ NETBSD32_SYS_netbsd32_semget, "compat_netbsd32_sysvipc" },
{ NETBSD32_SYS_netbsd32_semop, "compat_netbsd32_sysvipc" },
{ NETBSD32_SYS_netbsd32_semconfig, "compat_netbsd32_sysvipc" },
- { NETBSD32_SYS_compat_14_netbsd32_msgctl, "compat_netbsd32_sysvipc" },
+ { NETBSD32_SYS_compat_14_netbsd32_msgctl, "compat_netbsd32_sysvipc_14" },
{ NETBSD32_SYS_netbsd32_msgget, "compat_netbsd32_sysvipc" },
{ NETBSD32_SYS_netbsd32_msgsnd, "compat_netbsd32_sysvipc" },
{ NETBSD32_SYS_netbsd32_msgrcv, "compat_netbsd32_sysvipc" },
{ NETBSD32_SYS_netbsd32_shmat, "compat_netbsd32_sysvipc" },
- { NETBSD32_SYS_compat_14_netbsd32_shmctl, "compat_netbsd32_sysvipc" },
+ { NETBSD32_SYS_compat_14_netbsd32_shmctl, "compat_netbsd32_sysvipc_14" },
{ NETBSD32_SYS_netbsd32_shmdt, "compat_netbsd32_sysvipc" },
{ NETBSD32_SYS_netbsd32_shmget, "compat_netbsd32_sysvipc" },
+ { NETBSD32_SYS_compat_50_netbsd32_clock_gettime, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_clock_settime, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_clock_getres, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_timer_settime, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_timer_gettime, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_nanosleep, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32___sigtimedwait, "compat_netbsd32_50" },
{ NETBSD32_SYS_netbsd32_mq_open, "compat_netbsd32_mqueue" },
{ NETBSD32_SYS_netbsd32_mq_close, "compat_netbsd32_mqueue" },
{ NETBSD32_SYS_netbsd32_mq_unlink, "compat_netbsd32_mqueue" },
@@ -39,11 +113,32 @@ static struct sc_autoload netbsd32_syscalls_autoload[] = {
{ NETBSD32_SYS_netbsd32_mq_receive, "compat_netbsd32_mqueue" },
{ NETBSD32_SYS_compat_50_netbsd32_mq_timedsend, "compat_netbsd32_mqueue" },
{ NETBSD32_SYS_compat_50_netbsd32_mq_timedreceive, "compat_netbsd32_mqueue" },
- { NETBSD32_SYS_compat_50_netbsd32___semctl14, "compat_netbsd32_sysvipc" },
- { NETBSD32_SYS_compat_50_netbsd32___msgctl13, "compat_netbsd32_sysvipc" },
- { NETBSD32_SYS_compat_50_netbsd32___shmctl13, "compat_netbsd32_sysvipc" },
+ { NETBSD32_SYS_compat_30_netbsd32_getdents, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_50_netbsd32_lutimes, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_30_netbsd32___stat13, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_30_netbsd32___fstat13, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_30_netbsd32___lstat13, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_16_netbsd32___sigreturn14, "compat_netbsd32_16" },
+ { NETBSD32_SYS_compat_30_netbsd32_fhopen, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_30_netbsd32_fhstat, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_20_netbsd32_fhstatfs, "compat_netbsd32_20" },
+ { NETBSD32_SYS_compat_50_netbsd32___semctl14, "compat_netbsd32_sysvipc_50" },
+ { NETBSD32_SYS_compat_50_netbsd32___msgctl13, "compat_netbsd32_sysvipc_50" },
+ { NETBSD32_SYS_compat_50_netbsd32___shmctl13, "compat_netbsd32_sysvipc_50" },
+ { NETBSD32_SYS_compat_50_netbsd32__lwp_park, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_kevent, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_30_netbsd32_fhstatvfs1, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_50_netbsd32_pselect, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32_pollts, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32___stat30, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32___fstat30, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32___lstat30, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_30_netbsd32___fhstat30, "compat_netbsd32_30" },
+ { NETBSD32_SYS_compat_50_netbsd32_ntp_gettime, "compat_netbsd32_50" },
+ { NETBSD32_SYS_compat_50_netbsd32___fhstat40, "compat_netbsd32_50" },
{ NETBSD32_SYS_netbsd32___mq_timedsend50, "compat_netbsd32_mqueue" },
{ NETBSD32_SYS_netbsd32___mq_timedreceive50, "compat_netbsd32_mqueue" },
+ { NETBSD32_SYS_compat_60_netbsd32__lwp_park, "compat_netbsd32_60" },
{ NETBSD32_SYS_netbsd32_____semctl50, "compat_netbsd32_sysvipc" },
{ NETBSD32_SYS_netbsd32___shmctl50, "compat_netbsd32_sysvipc" },
{ NETBSD32_SYS_netbsd32___msgctl50, "compat_netbsd32_sysvipc" },
diff --git a/sys/compat/netbsd32/netbsd32_sysent.c b/sys/compat/netbsd32/netbsd32_sysent.c
index 37cb1c9df64..cedaece5152 100644
--- a/sys/compat/netbsd32/netbsd32_sysent.c
+++ b/sys/compat/netbsd32/netbsd32_sysent.c
@@ -1,14 +1,14 @@
-/* $NetBSD: netbsd32_sysent.c,v 1.137 2018/12/24 21:27:37 mrg Exp $ */
+/* $NetBSD: netbsd32_sysent.c,v 1.138 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.124 2018/12/24 21:27:06 mrg Exp
+ * created from NetBSD: syscalls.master,v 1.120.2.19 2018/09/29 04:22:31 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.137 2018/12/24 21:27:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.138 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -113,6 +113,12 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.137 2018/12/24 21:27:37 mrg Ex
#define compat_70(func) sys_nosys
#endif
+#ifdef COMPAT_80
+#define compat_80(func) __CONCAT(compat_80_,func)
+#else
+#define compat_80(func) sys_nosys
+#endif
+
#define s(type) sizeof(type)
#define n(type) (sizeof(type)/sizeof (register32_t))
#define ns(type) .sy_narg = n(type), .sy_argsize = s(type)
@@ -148,11 +154,11 @@ struct sysent netbsd32_sysent[] = {
}, /* 6 = netbsd32_close */
{
ns(struct compat_50_netbsd32_wait4_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_wait4)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 7 = compat_50_netbsd32_wait4 */
{
ns(struct compat_43_netbsd32_ocreat_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_ocreat)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 8 = compat_43_netbsd32_ocreat */
{
ns(struct netbsd32_link_args),
@@ -175,7 +181,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 13 = netbsd32_fchdir */
{
ns(struct compat_50_netbsd32_mknod_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_mknod)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 14 = compat_50_netbsd32_mknod */
{
ns(struct netbsd32_chmod_args),
@@ -191,18 +197,18 @@ struct sysent netbsd32_sysent[] = {
}, /* 17 = netbsd32_break */
{
ns(struct compat_20_netbsd32_getfsstat_args),
- .sy_call = (sy_call_t *)compat_20(netbsd32_getfsstat)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 18 = compat_20_netbsd32_getfsstat */
{
ns(struct compat_43_netbsd32_olseek_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_olseek)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 19 = compat_43_netbsd32_olseek */
{
.sy_call = (sy_call_t *)sys_getpid
}, /* 20 = getpid */
{
ns(struct compat_40_netbsd32_mount_args),
- .sy_call = (sy_call_t *)compat_40(netbsd32_mount)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 21 = compat_40_netbsd32_mount */
{
ns(struct netbsd32_unmount_args),
@@ -267,14 +273,14 @@ struct sysent netbsd32_sysent[] = {
}, /* 37 = netbsd32_kill */
{
ns(struct compat_43_netbsd32_stat43_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_stat43)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 38 = compat_43_netbsd32_stat43 */
{
.sy_call = (sy_call_t *)sys_getppid
}, /* 39 = getppid */
{
ns(struct compat_43_netbsd32_lstat43_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_lstat43)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 40 = compat_43_netbsd32_lstat43 */
{
ns(struct netbsd32_dup_args),
@@ -303,7 +309,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 47 = getgid */
{
ns(struct compat_13_netbsd32_sigprocmask_args),
- .sy_call = (sy_call_t *)compat_13(netbsd32_sigprocmask)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 48 = compat_13_sigprocmask13 */
{
ns(struct netbsd32___getlogin_args),
@@ -318,11 +324,11 @@ struct sysent netbsd32_sysent[] = {
.sy_call = (sy_call_t *)netbsd32_acct
}, /* 51 = netbsd32_acct */
{
- .sy_call = (sy_call_t *)compat_13(sys_sigpending)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 52 = compat_13_sigpending13 */
{
ns(struct compat_13_netbsd32_sigaltstack13_args),
- .sy_call = (sy_call_t *)compat_13(netbsd32_sigaltstack13)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 53 = compat_13_netbsd32_sigaltstack13 */
{
ns(struct netbsd32_ioctl_args),
@@ -330,7 +336,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 54 = netbsd32_ioctl */
{
ns(struct compat_12_netbsd32_reboot_args),
- .sy_call = (sy_call_t *)compat_12(netbsd32_reboot)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 55 = compat_12_netbsd32_reboot */
{
ns(struct netbsd32_revoke_args),
@@ -358,18 +364,18 @@ struct sysent netbsd32_sysent[] = {
}, /* 61 = netbsd32_chroot */
{
ns(struct compat_43_netbsd32_fstat43_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_fstat43)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 62 = compat_43_netbsd32_fstat43 */
{
ns(struct compat_43_netbsd32_ogetkerninfo_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_ogetkerninfo)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 63 = compat_43_netbsd32_ogetkerninfo */
{
- .sy_call = (sy_call_t *)compat_43(sys_getpagesize)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 64 = compat_43_ogetpagesize */
{
ns(struct compat_12_netbsd32_msync_args),
- .sy_call = (sy_call_t *)compat_12(netbsd32_msync)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 65 = compat_12_netbsd32_msync */
{
.sy_call = (sy_call_t *)sys_vfork
@@ -388,7 +394,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 70 = filler */
{
ns(struct compat_43_netbsd32_ommap_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_ommap)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 71 = compat_43_netbsd32_ommap */
{
ns(struct netbsd32_ovadvise_args),
@@ -433,29 +439,29 @@ struct sysent netbsd32_sysent[] = {
}, /* 82 = netbsd32_setpgid */
{
ns(struct compat_50_netbsd32_setitimer_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_setitimer)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 83 = compat_50_netbsd32_setitimer */
{
- .sy_call = (sy_call_t *)compat_43(sys_wait)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 84 = compat_43_owait */
{
ns(struct compat_12_netbsd32_oswapon_args),
- .sy_call = (sy_call_t *)compat_12(netbsd32_oswapon)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 85 = compat_12_netbsd32_oswapon */
{
ns(struct compat_50_netbsd32_getitimer_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_getitimer)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 86 = compat_50_netbsd32_getitimer */
{
ns(struct compat_43_netbsd32_ogethostname_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_ogethostname)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 87 = compat_43_netbsd32_ogethostname */
{
ns(struct compat_43_netbsd32_osethostname_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_osethostname)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 88 = compat_43_netbsd32_osethostname */
{
- .sy_call = (sy_call_t *)compat_43(sys_getdtablesize)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 89 = compat_43_ogetdtablesize */
{
ns(struct netbsd32_dup2_args),
@@ -470,7 +476,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 92 = netbsd32_fcntl */
{
ns(struct compat_50_netbsd32_select_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_select)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 93 = compat_50_netbsd32_select */
{
.sy_call = sys_nosys,
@@ -485,7 +491,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 96 = netbsd32_setpriority */
{
ns(struct compat_30_netbsd32_socket_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32_socket)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 97 = compat_30_netbsd32_socket */
{
ns(struct netbsd32_connect_args),
@@ -493,7 +499,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 98 = netbsd32_connect */
{
ns(struct compat_43_netbsd32_oaccept_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_oaccept)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 99 = compat_43_netbsd32_oaccept */
{
ns(struct netbsd32_getpriority_args),
@@ -501,15 +507,15 @@ struct sysent netbsd32_sysent[] = {
}, /* 100 = netbsd32_getpriority */
{
ns(struct compat_43_netbsd32_osend_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_osend)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 101 = compat_43_netbsd32_osend */
{
ns(struct compat_43_netbsd32_orecv_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_orecv)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 102 = compat_43_netbsd32_orecv */
{
ns(struct compat_13_netbsd32_sigreturn_args),
- .sy_call = (sy_call_t *)compat_13(netbsd32_sigreturn)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 103 = compat_13_sigreturn13 */
{
ns(struct netbsd32_bind_args),
@@ -528,42 +534,42 @@ struct sysent netbsd32_sysent[] = {
}, /* 107 = filler */
{
ns(struct compat_43_netbsd32_osigvec_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_osigvec)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 108 = compat_43_netbsd32_osigvec */
{
ns(struct compat_43_netbsd32_sigblock_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_sigblock)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 109 = compat_43_netbsd32_sigblock */
{
ns(struct compat_43_netbsd32_sigsetmask_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_sigsetmask)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 110 = compat_43_netbsd32_sigsetmask */
{
ns(struct compat_13_netbsd32_sigsuspend_args),
- .sy_call = (sy_call_t *)compat_13(netbsd32_sigsuspend)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 111 = compat_13_sigsuspend13 */
{
ns(struct compat_43_netbsd32_osigstack_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_osigstack)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 112 = compat_43_netbsd32_osigstack */
{
ns(struct compat_43_netbsd32_orecvmsg_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_orecvmsg)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 113 = compat_43_netbsd32_orecvmsg */
{
ns(struct compat_43_netbsd32_osendmsg_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_osendmsg)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 114 = compat_43_netbsd32_osendmsg */
{
.sy_call = sys_nosys,
}, /* 115 = filler */
{
ns(struct compat_50_netbsd32_gettimeofday_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_gettimeofday)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 116 = compat_50_netbsd32_gettimeofday */
{
ns(struct compat_50_netbsd32_getrusage_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_getrusage)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 117 = compat_50_netbsd32_getrusage */
{
ns(struct netbsd32_getsockopt_args),
@@ -582,7 +588,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 121 = netbsd32_writev */
{
ns(struct compat_50_netbsd32_settimeofday_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_settimeofday)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 122 = compat_50_netbsd32_settimeofday */
{
ns(struct netbsd32_fchown_args),
@@ -594,7 +600,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 124 = netbsd32_fchmod */
{
ns(struct compat_43_netbsd32_orecvfrom_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_orecvfrom)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 125 = compat_43_netbsd32_orecvfrom */
{
ns(struct netbsd32_setreuid_args),
@@ -610,11 +616,11 @@ struct sysent netbsd32_sysent[] = {
}, /* 128 = netbsd32_rename */
{
ns(struct compat_43_netbsd32_otruncate_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_otruncate)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 129 = compat_43_netbsd32_otruncate */
{
ns(struct compat_43_netbsd32_oftruncate_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_oftruncate)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 130 = compat_43_netbsd32_oftruncate */
{
ns(struct netbsd32_flock_args),
@@ -646,51 +652,51 @@ struct sysent netbsd32_sysent[] = {
}, /* 137 = netbsd32_rmdir */
{
ns(struct compat_50_netbsd32_utimes_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_utimes)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 138 = compat_50_netbsd32_utimes */
{
.sy_call = sys_nosys,
}, /* 139 = filler */
{
ns(struct compat_50_netbsd32_adjtime_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_adjtime)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 140 = compat_50_netbsd32_adjtime */
{
ns(struct compat_43_netbsd32_ogetpeername_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_ogetpeername)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 141 = compat_43_netbsd32_ogetpeername */
{
- .sy_call = (sy_call_t *)compat_43(sys_gethostid)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 142 = compat_43_ogethostid */
{
ns(struct compat_43_netbsd32_sethostid_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_sethostid)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 143 = compat_43_netbsd32_sethostid */
{
ns(struct compat_43_netbsd32_ogetrlimit_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_ogetrlimit)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 144 = compat_43_netbsd32_ogetrlimit */
{
ns(struct compat_43_netbsd32_osetrlimit_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_osetrlimit)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 145 = compat_43_netbsd32_osetrlimit */
{
ns(struct compat_43_netbsd32_killpg_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_killpg)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 146 = compat_43_netbsd32_killpg */
{
.sy_call = (sy_call_t *)sys_setsid
}, /* 147 = setsid */
{
ns(struct compat_50_netbsd32_quotactl_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_quotactl)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 148 = compat_50_netbsd32_quotactl */
{
- .sy_call = (sy_call_t *)compat_43(sys_quota)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 149 = compat_43_oquota */
{
ns(struct compat_43_netbsd32_ogetsockname_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_ogetsockname)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 150 = compat_43_netbsd32_ogetsockname */
{
.sy_call = sys_nosys,
@@ -710,15 +716,15 @@ struct sysent netbsd32_sysent[] = {
}, /* 155 = netbsd32_nfssvc */
{
ns(struct compat_43_netbsd32_ogetdirentries_args),
- .sy_call = (sy_call_t *)compat_43(netbsd32_ogetdirentries)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 156 = compat_43_netbsd32_ogetdirentries */
{
ns(struct compat_20_netbsd32_statfs_args),
- .sy_call = (sy_call_t *)compat_20(netbsd32_statfs)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 157 = compat_20_netbsd32_statfs */
{
ns(struct compat_20_netbsd32_fstatfs_args),
- .sy_call = (sy_call_t *)compat_20(netbsd32_fstatfs)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 158 = compat_20_netbsd32_fstatfs */
{
.sy_call = sys_nosys,
@@ -728,19 +734,19 @@ struct sysent netbsd32_sysent[] = {
}, /* 160 = filler */
{
ns(struct compat_30_netbsd32_getfh_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32_getfh)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 161 = compat_30_netbsd32_getfh */
{
ns(struct compat_09_netbsd32_ogetdomainname_args),
- .sy_call = (sy_call_t *)compat_09(netbsd32_ogetdomainname)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 162 = compat_09_netbsd32_ogetdomainname */
{
ns(struct compat_09_netbsd32_osetdomainname_args),
- .sy_call = (sy_call_t *)compat_09(netbsd32_osetdomainname)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 163 = compat_09_netbsd32_osetdomainname */
{
ns(struct compat_09_netbsd32_uname_args),
- .sy_call = (sy_call_t *)compat_09(netbsd32_uname)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 164 = compat_09_netbsd32_uname */
{
ns(struct netbsd32_sysarch_args),
@@ -780,11 +786,11 @@ struct sysent netbsd32_sysent[] = {
.sy_flags = SYCALL_NARGS64_VAL(1) | SYCALL_ARG4_64,
.sy_call = (sy_call_t *)netbsd32_pwrite
}, /* 174 = netbsd32_pwrite */
-#if defined(NTP) || !defined(_KERNEL_OPT)
{
ns(struct compat_30_netbsd32_ntp_gettime_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32_ntp_gettime)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 175 = compat_30_netbsd32_ntp_gettime */
+#if defined(NTP) || !defined(_KERNEL_OPT)
{
ns(struct netbsd32_ntp_adjtime_args),
.sy_call = (sy_call_t *)netbsd32_ntp_adjtime
@@ -792,9 +798,6 @@ struct sysent netbsd32_sysent[] = {
#else
{
.sy_call = sys_nosys,
- }, /* 175 = filler */
- {
- .sy_call = sys_nosys,
}, /* 176 = filler */
#endif
{
@@ -835,15 +838,15 @@ struct sysent netbsd32_sysent[] = {
}, /* 187 = filler */
{
ns(struct compat_12_netbsd32_stat12_args),
- .sy_call = (sy_call_t *)compat_12(netbsd32_stat12)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 188 = compat_12_netbsd32_stat12 */
{
ns(struct compat_12_netbsd32_fstat12_args),
- .sy_call = (sy_call_t *)compat_12(netbsd32_fstat12)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 189 = compat_12_netbsd32_fstat12 */
{
ns(struct compat_12_netbsd32_lstat12_args),
- .sy_call = (sy_call_t *)compat_12(netbsd32_lstat12)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 190 = compat_12_netbsd32_lstat12 */
{
ns(struct netbsd32_pathconf_args),
@@ -867,7 +870,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 195 = netbsd32_setrlimit */
{
ns(struct compat_12_netbsd32_getdirentries_args),
- .sy_call = (sy_call_t *)compat_12(netbsd32_getdirentries)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 196 = compat_12_netbsd32_getdirentries */
{
ns(struct netbsd32_mmap_args),
@@ -912,7 +915,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 205 = netbsd32_undelete */
{
ns(struct compat_50_netbsd32_futimes_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_futimes)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 206 = compat_50_netbsd32_futimes */
{
ns(struct netbsd32_getpgid_args),
@@ -1006,15 +1009,15 @@ struct sysent netbsd32_sysent[] = {
}, /* 231 = netbsd32_shmget */
{
ns(struct compat_50_netbsd32_clock_gettime_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_clock_gettime)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 232 = compat_50_netbsd32_clock_gettime */
{
ns(struct compat_50_netbsd32_clock_settime_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_clock_settime)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 233 = compat_50_netbsd32_clock_settime */
{
ns(struct compat_50_netbsd32_clock_getres_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_clock_getres)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 234 = compat_50_netbsd32_clock_getres */
{
ns(struct netbsd32_timer_create_args),
@@ -1026,11 +1029,11 @@ struct sysent netbsd32_sysent[] = {
}, /* 236 = netbsd32_timer_delete */
{
ns(struct compat_50_netbsd32_timer_settime_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_timer_settime)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 237 = compat_50_netbsd32_timer_settime */
{
ns(struct compat_50_netbsd32_timer_gettime_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_timer_gettime)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 238 = compat_50_netbsd32_timer_gettime */
{
ns(struct netbsd32_timer_getoverrun_args),
@@ -1038,7 +1041,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 239 = netbsd32_timer_getoverrun */
{
ns(struct compat_50_netbsd32_nanosleep_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_nanosleep)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 240 = compat_50_netbsd32_nanosleep */
{
ns(struct netbsd32_fdatasync_args),
@@ -1053,7 +1056,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 243 = munlockall */
{
ns(struct compat_50_netbsd32___sigtimedwait_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32___sigtimedwait)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 244 = compat_50_netbsd32___sigtimedwait */
{
ns(struct netbsd32_sigqueueinfo_args),
@@ -1162,7 +1165,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 271 = netbsd32_swapctl */
{
ns(struct compat_30_netbsd32_getdents_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32_getdents)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 272 = compat_30_netbsd32_getdents */
{
ns(struct netbsd32_minherit_args),
@@ -1178,7 +1181,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 275 = netbsd32_lchown */
{
ns(struct compat_50_netbsd32_lutimes_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_lutimes)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 276 = compat_50_netbsd32_lutimes */
{
ns(struct netbsd32___msync13_args),
@@ -1186,15 +1189,15 @@ struct sysent netbsd32_sysent[] = {
}, /* 277 = netbsd32___msync13 */
{
ns(struct compat_30_netbsd32___stat13_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32___stat13)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 278 = compat_30_netbsd32___stat13 */
{
ns(struct compat_30_netbsd32___fstat13_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32___fstat13)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 279 = compat_30_netbsd32___fstat13 */
{
ns(struct compat_30_netbsd32___lstat13_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32___lstat13)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 280 = compat_30_netbsd32___lstat13 */
{
ns(struct netbsd32___sigaltstack14_args),
@@ -1255,7 +1258,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 294 = netbsd32___sigsuspend14 */
{
ns(struct compat_16_netbsd32___sigreturn14_args),
- .sy_call = (sy_call_t *)compat_16(netbsd32___sigreturn14)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 295 = compat_16_netbsd32___sigreturn14 */
{
ns(struct netbsd32___getcwd_args),
@@ -1267,15 +1270,15 @@ struct sysent netbsd32_sysent[] = {
}, /* 297 = netbsd32_fchroot */
{
ns(struct compat_30_netbsd32_fhopen_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32_fhopen)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 298 = compat_30_netbsd32_fhopen */
{
ns(struct compat_30_netbsd32_fhstat_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32_fhstat)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 299 = compat_30_netbsd32_fhstat */
{
ns(struct compat_20_netbsd32_fhstatfs_args),
- .sy_call = (sy_call_t *)compat_20(netbsd32_fhstatfs)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 300 = compat_20_netbsd32_fhstatfs */
{
ns(struct compat_50_netbsd32___semctl14_args),
@@ -1351,7 +1354,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 319 = netbsd32__lwp_detach */
{
ns(struct compat_50_netbsd32__lwp_park_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32__lwp_park)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 320 = compat_50_netbsd32__lwp_park */
{
ns(struct netbsd32__lwp_unpark_args),
@@ -1434,7 +1437,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 344 = kqueue */
{
ns(struct compat_50_netbsd32_kevent_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_kevent)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 345 = compat_50_netbsd32_kevent */
{
ns(struct netbsd32__sched_setparam_args),
@@ -1488,7 +1491,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 358 = netbsd32_fstatvfs1 */
{
ns(struct compat_30_netbsd32_fhstatvfs1_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32_fhstatvfs1)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 359 = compat_30_netbsd32_fhstatvfs1 */
{
ns(struct netbsd32_extattrctl_args),
@@ -1544,11 +1547,11 @@ struct sysent netbsd32_sysent[] = {
}, /* 372 = netbsd32_extattr_list_link */
{
ns(struct compat_50_netbsd32_pselect_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_pselect)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 373 = compat_50_netbsd32_pselect */
{
ns(struct compat_50_netbsd32_pollts_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_pollts)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 374 = compat_50_netbsd32_pollts */
{
ns(struct netbsd32_setxattr_args),
@@ -1600,15 +1603,15 @@ struct sysent netbsd32_sysent[] = {
}, /* 386 = netbsd32_fremovexattr */
{
ns(struct compat_50_netbsd32___stat30_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32___stat30)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 387 = compat_50_netbsd32___stat30 */
{
ns(struct compat_50_netbsd32___fstat30_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32___fstat30)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 388 = compat_50_netbsd32___fstat30 */
{
ns(struct compat_50_netbsd32___lstat30_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32___lstat30)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 389 = compat_50_netbsd32___lstat30 */
{
ns(struct netbsd32___getdents30_args),
@@ -1619,18 +1622,12 @@ struct sysent netbsd32_sysent[] = {
}, /* 391 = filler */
{
ns(struct compat_30_netbsd32___fhstat30_args),
- .sy_call = (sy_call_t *)compat_30(netbsd32___fhstat30)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 392 = compat_30_netbsd32___fhstat30 */
-#if defined(NTP) || !defined(_KERNEL_OPT)
{
ns(struct compat_50_netbsd32_ntp_gettime_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32_ntp_gettime)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 393 = compat_50_netbsd32_ntp_gettime */
-#else
- {
- .sy_call = sys_nosys,
- }, /* 393 = filler */
-#endif
{
ns(struct netbsd32___socket30_args),
.sy_call = (sy_call_t *)netbsd32___socket30
@@ -1649,7 +1646,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 397 = netbsd32___fhstatvfs140 */
{
ns(struct compat_50_netbsd32___fhstat40_args),
- .sy_call = (sy_call_t *)compat_50(netbsd32___fhstat40)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 398 = compat_50_netbsd32___fhstat40 */
{
.sy_call = sys_nosys,
@@ -1782,7 +1779,7 @@ struct sysent netbsd32_sysent[] = {
}, /* 433 = netbsd32___mq_timedreceive50 */
{
ns(struct compat_60_netbsd32__lwp_park_args),
- .sy_call = (sy_call_t *)compat_60(netbsd32__lwp_park)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 434 = compat_60_netbsd32__lwp_park */
{
ns(struct netbsd32___kevent50_args),
@@ -2074,20 +2071,20 @@ struct sysent netbsd32_sysent[] = {
};
const uint32_t netbsd32_sysent_nomodbits[] = {
- 0x04000000, /* syscalls 0- 31 */
- 0x00000000, /* syscalls 32- 63 */
- 0x00000000, /* syscalls 64- 95 */
- 0x00000000, /* syscalls 96-127 */
- 0x08000000, /* syscalls 128-159 */
- 0x00000e00, /* syscalls 160-191 */
- 0xf0000000, /* syscalls 192-223 */
- 0x000000ff, /* syscalls 224-255 */
- 0x000007fe, /* syscalls 256-287 */
- 0x0000e000, /* syscalls 288-319 */
- 0x00000000, /* syscalls 320-351 */
- 0x00000000, /* syscalls 352-383 */
- 0x00000000, /* syscalls 384-415 */
- 0x1c030000, /* syscalls 416-447 */
+ 0x042c4180, /* syscalls 0- 31 */
+ 0xc0b10140, /* syscalls 32- 63 */
+ 0x23f80083, /* syscalls 64- 95 */
+ 0x2437f0ea, /* syscalls 96-127 */
+ 0x7877f406, /* syscalls 128-159 */
+ 0x70008e1e, /* syscalls 160-191 */
+ 0xf0004010, /* syscalls 192-223 */
+ 0x001167ff, /* syscalls 224-255 */
+ 0x01d107fe, /* syscalls 256-287 */
+ 0x0000fc80, /* syscalls 288-319 */
+ 0x02000001, /* syscalls 320-351 */
+ 0x00600080, /* syscalls 352-383 */
+ 0x00004338, /* syscalls 384-415 */
+ 0x1c070000, /* syscalls 416-447 */
0x00000000, /* syscalls 448-479 */
0x00000000, /* syscalls 480-511 */
};
diff --git a/sys/compat/netbsd32/netbsd32_systrace_args.c b/sys/compat/netbsd32/netbsd32_systrace_args.c
index 9c84ceb985b..812c5907fb9 100644
--- a/sys/compat/netbsd32/netbsd32_systrace_args.c
+++ b/sys/compat/netbsd32/netbsd32_systrace_args.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_systrace_args.c,v 1.29 2018/12/24 21:27:37 mrg Exp $ */
+/* $NetBSD: netbsd32_systrace_args.c,v 1.30 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call argument to DTrace register array converstion.
@@ -1246,7 +1246,6 @@ systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_
*n_args = 5;
break;
}
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_gettime */
case 175: {
const struct compat_30_netbsd32_ntp_gettime_args *p = params;
@@ -1254,6 +1253,7 @@ systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_
*n_args = 1;
break;
}
+#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_adjtime */
case 176: {
const struct netbsd32_ntp_adjtime_args *p = params;
@@ -2772,7 +2772,6 @@ systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_
*n_args = 2;
break;
}
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_gettime */
case 393: {
const struct compat_50_netbsd32_ntp_gettime_args *p = params;
@@ -2780,8 +2779,6 @@ systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_
*n_args = 1;
break;
}
-#else
-#endif
/* netbsd32___socket30 */
case 394: {
const struct netbsd32___socket30_args *p = params;
@@ -5511,7 +5508,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_gettime */
case 175:
switch(ndx) {
@@ -5522,6 +5518,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
+#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_adjtime */
case 176:
switch(ndx) {
@@ -8117,7 +8114,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_gettime */
case 393:
switch(ndx) {
@@ -8128,8 +8124,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
-#else
-#endif
/* netbsd32___socket30 */
case 394:
switch(ndx) {
@@ -10137,12 +10131,12 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "netbsd32_ssize_t";
break;
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_gettime */
case 175:
if (ndx == 0 || ndx == 1)
p = "int";
break;
+#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_adjtime */
case 176:
if (ndx == 0 || ndx == 1)
@@ -11006,14 +11000,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
-#if defined(NTP) || !defined(_KERNEL_OPT)
/* netbsd32_ntp_gettime */
case 393:
if (ndx == 0 || ndx == 1)
p = "int";
break;
-#else
-#endif
/* netbsd32___socket30 */
case 394:
if (ndx == 0 || ndx == 1)
diff --git a/sys/compat/netbsd32/netbsd32_time.c b/sys/compat/netbsd32/netbsd32_time.c
index b82bb9c4b7a..bc92ea073af 100644
--- a/sys/compat/netbsd32/netbsd32_time.c
+++ b/sys/compat/netbsd32/netbsd32_time.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_time.c,v 1.50 2018/10/30 14:43:38 riastradh Exp $ */
+/* $NetBSD: netbsd32_time.c,v 1.51 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.50 2018/10/30 14:43:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.51 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.50 2018/10/30 14:43:38 riastradh
#include <sys/resourcevar.h>
#include <sys/dirent.h>
#include <sys/kauth.h>
+#include <sys/compat_stub.h>
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
@@ -63,42 +64,14 @@ netbsd32___ntp_gettime50(struct lwp *l,
struct ntptimeval ntv;
int error = 0;
- if (SCARG_P32(uap, ntvp)) {
- ntp_gettime(&ntv);
-
- memset(&ntv32, 0, sizeof(ntv32));
- ntv32.time.tv_sec = ntv.time.tv_sec;
- ntv32.time.tv_nsec = ntv.time.tv_nsec;
- ntv32.maxerror = (netbsd32_long)ntv.maxerror;
- ntv32.esterror = (netbsd32_long)ntv.esterror;
- ntv32.tai = (netbsd32_long)ntv.tai;
- ntv32.time_state = ntv.time_state;
- error = copyout(&ntv32, SCARG_P32(uap, ntvp), sizeof(ntv32));
- }
- if (!error) {
- *retval = ntp_timestatus();
- }
-
- return (error);
-}
-
-#ifdef COMPAT_50
-int
-compat_50_netbsd32_ntp_gettime(struct lwp *l,
- const struct compat_50_netbsd32_ntp_gettime_args *uap, register_t *retval)
-{
- /* {
- syscallarg(netbsd32_ntptimeval50p_t) ntvp;
- } */
- struct netbsd32_ntptimeval50 ntv32;
- struct ntptimeval ntv;
- int error = 0;
+ if (vec_ntp_gettime == NULL)
+ return EINVAL;
if (SCARG_P32(uap, ntvp)) {
- ntp_gettime(&ntv);
+ (*vec_ntp_gettime)(&ntv);
memset(&ntv32, 0, sizeof(ntv32));
- ntv32.time.tv_sec = (int32_t)ntv.time.tv_sec;
+ ntv32.time.tv_sec = ntv.time.tv_sec;
ntv32.time.tv_nsec = ntv.time.tv_nsec;
ntv32.maxerror = (netbsd32_long)ntv.maxerror;
ntv32.esterror = (netbsd32_long)ntv.esterror;
@@ -107,41 +80,11 @@ compat_50_netbsd32_ntp_gettime(struct lwp *l,
error = copyout(&ntv32, SCARG_P32(uap, ntvp), sizeof(ntv32));
}
if (!error) {
- *retval = ntp_timestatus();
+ *retval = (*vec_ntp_timestatus)();
}
return (error);
}
-#endif
-
-#ifdef COMPAT_30
-int
-compat_30_netbsd32_ntp_gettime(struct lwp *l, const struct compat_30_netbsd32_ntp_gettime_args *uap, register_t *retval)
-{
- /* {
- syscallarg(netbsd32_ntptimevalp_t) ntvp;
- } */
- struct netbsd32_ntptimeval30 ntv32;
- struct ntptimeval ntv;
- int error = 0;
-
- if (SCARG_P32(uap, ntvp)) {
- ntp_gettime(&ntv);
-
- memset(&ntv32, 0, sizeof(ntv32));
- ntv32.time.tv_sec = ntv.time.tv_sec;
- ntv32.time.tv_usec = ntv.time.tv_nsec / 1000;
- ntv32.maxerror = (netbsd32_long)ntv.maxerror;
- ntv32.esterror = (netbsd32_long)ntv.esterror;
- error = copyout(&ntv32, SCARG_P32(uap, ntvp), sizeof(ntv32));
- }
- if (!error) {
- *retval = ntp_timestatus();
- }
-
- return (error);
-}
-#endif
int
netbsd32_ntp_adjtime(struct lwp *l, const struct netbsd32_ntp_adjtime_args *uap, register_t *retval)
@@ -154,6 +97,9 @@ netbsd32_ntp_adjtime(struct lwp *l, const struct netbsd32_ntp_adjtime_args *uap,
int error = 0;
int modes;
+ if (vec_ntp_adjtime1 == NULL)
+ return EINVAL;
+
if ((error = copyin(SCARG_P32(uap, tp), &ntv32, sizeof(ntv32))))
return (error);
@@ -170,12 +116,12 @@ netbsd32_ntp_adjtime(struct lwp *l, const struct netbsd32_ntp_adjtime_args *uap,
NULL)))
return (error);
- ntp_adjtime1(&ntv);
+ (*vec_ntp_adjtime1)(&ntv);
netbsd32_from_timex(&ntv, &ntv32);
error = copyout(&ntv32, SCARG_P32(uap, tp), sizeof(ntv32));
if (!error) {
- *retval = ntp_timestatus();
+ *retval = (*vec_ntp_timestatus)();
}
return error;
}
diff --git a/sys/compat/netbsd32/syscalls.conf b/sys/compat/netbsd32/syscalls.conf
index b8cf12b2470..c3a5374bd94 100644
--- a/sys/compat/netbsd32/syscalls.conf
+++ b/sys/compat/netbsd32/syscalls.conf
@@ -1,4 +1,4 @@
-# $NetBSD: syscalls.conf,v 1.15 2015/12/01 02:20:43 pgoyette Exp $
+# $NetBSD: syscalls.conf,v 1.16 2019/01/27 02:08:40 pgoyette Exp $
sysnames="netbsd32_syscalls.c"
sysnumhdr="netbsd32_syscall.h"
@@ -6,7 +6,7 @@ syssw="netbsd32_sysent.c"
sysarghdr="netbsd32_syscallargs.h"
systrace="netbsd32_systrace_args.c"
sysautoload="netbsd32_syscalls_autoload.c"
-compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70"
+compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80"
libcompatopts=""
switchname="netbsd32_sysent"
diff --git a/sys/compat/netbsd32/syscalls.master b/sys/compat/netbsd32/syscalls.master
index 3eba8f82654..debf66ef04c 100644
--- a/sys/compat/netbsd32/syscalls.master
+++ b/sys/compat/netbsd32/syscalls.master
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.124 2018/12/24 21:27:06 mrg Exp $
+ $NetBSD: syscalls.master,v 1.125 2019/01/27 02:08:40 pgoyette Exp $
; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -70,9 +70,11 @@
5 STD { int|netbsd32||open(netbsd32_charp path, int flags, \
... mode_t mode); }
6 STD { int|netbsd32||close(int fd); }
-7 COMPAT_50 { int|netbsd32||wait4(int pid, netbsd32_intp status, \
+7 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||wait4(int pid, netbsd32_intp status, \
int options, netbsd32_rusage50p_t rusage); }
-8 COMPAT_43 { int|netbsd32||ocreat(netbsd32_charp path, \
+8 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||ocreat(netbsd32_charp path, \
mode_t mode); }
9 STD { int|netbsd32||link(netbsd32_charp path, \
netbsd32_charp link); }
@@ -80,18 +82,22 @@
11 OBSOL execv
12 STD { int|netbsd32||chdir(netbsd32_charp path); }
13 STD { int|netbsd32||fchdir(int fd); }
-14 COMPAT_50 { int|netbsd32||mknod(netbsd32_charp path, mode_t mode, \
+14 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||mknod(netbsd32_charp path, mode_t mode, \
uint32_t dev); }
15 STD { int|netbsd32||chmod(netbsd32_charp path, mode_t mode); }
16 STD { int|netbsd32||chown(netbsd32_charp path, uid_t uid, \
gid_t gid); }
17 STD { int|netbsd32||break(netbsd32_charp nsize); }
-18 COMPAT_20 { int|netbsd32||getfsstat(netbsd32_statfsp_t buf, \
+18 COMPAT_20 MODULAR compat_netbsd32_20 \
+ { int|netbsd32||getfsstat(netbsd32_statfsp_t buf, \
netbsd32_long bufsize, int flags); }
-19 COMPAT_43 { netbsd32_long|netbsd32||olseek(int fd, \
+19 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { netbsd32_long|netbsd32||olseek(int fd, \
netbsd32_long offset, int whence); }
20 NOARGS { pid_t|sys||getpid(void); }
-21 COMPAT_40 { int|netbsd32||mount(netbsd32_charp type, \
+21 COMPAT_40 MODULAR compat_netbsd32_40 \
+ { int|netbsd32||mount(netbsd32_charp type, \
netbsd32_charp path, int flags, \
netbsd32_voidp data); }
22 STD { int|netbsd32||unmount(netbsd32_charp path, \
@@ -124,10 +130,12 @@
netbsd32_u_long flags); }
36 NOARGS { void|sys||sync(void); }
37 STD { int|netbsd32||kill(int pid, int signum); }
-38 COMPAT_43 { int|netbsd32||stat43(netbsd32_charp path, \
+38 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||stat43(netbsd32_charp path, \
netbsd32_stat43p_t ub); }
39 NOARGS { pid_t|sys||getppid(void); }
-40 COMPAT_43 { int|netbsd32||lstat43(netbsd32_charp path, \
+40 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||lstat43(netbsd32_charp path, \
netbsd32_stat43p_t ub); }
41 STD { int|netbsd32||dup(int fd); }
42 NOARGS { int|sys||pipe(void); }
@@ -141,19 +149,23 @@
netbsd32_sigactionp_t nsa, \
netbsd32_sigactionp_t osa); }
47 NOARGS { gid_t|sys||getgid(void); }
-48 COMPAT_13 { int|netbsd32||sigprocmask(int how, \
+48 COMPAT_13 MODULAR compat_netbsd32_13 \
+ { int|netbsd32||sigprocmask(int how, \
int mask); } sigprocmask13
49 STD { int|netbsd32||__getlogin(netbsd32_charp namebuf, \
u_int namelen); }
50 STD { int|netbsd32||setlogin(netbsd32_charp namebuf); }
51 STD { int|netbsd32||acct(netbsd32_charp path); }
-52 COMPAT_13 { int|sys||sigpending(void); } sigpending13
-53 COMPAT_13 { int|netbsd32||sigaltstack13( \
+52 COMPAT_13 MODULAR compat_netbsd32_13 \
+ { int|sys||sigpending(void); } sigpending13
+53 COMPAT_13 MODULAR compat_netbsd32_13 \
+ { int|netbsd32||sigaltstack13( \
netbsd32_sigaltstack13p_t nss, \
netbsd32_sigaltstack13p_t oss); }
54 STD { int|netbsd32||ioctl(int fd, netbsd32_u_long com, \
... netbsd32_voidp data); }
-55 COMPAT_12 { int|netbsd32||reboot(int opt); }
+55 COMPAT_12 MODULAR compat_netbsd32_12 \
+ { int|netbsd32||reboot(int opt); }
56 STD { int|netbsd32||revoke(netbsd32_charp path); }
57 STD { int|netbsd32||symlink(netbsd32_charp path, \
netbsd32_charp link); }
@@ -163,12 +175,16 @@
netbsd32_charpp argp, netbsd32_charpp envp); }
60 STD { mode_t|netbsd32||umask(mode_t newmask); }
61 STD { int|netbsd32||chroot(netbsd32_charp path); }
-62 COMPAT_43 { int|netbsd32||fstat43(int fd, netbsd32_stat43p_t sb); }
-63 COMPAT_43 { int|netbsd32||ogetkerninfo(int op, \
+62 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||fstat43(int fd, netbsd32_stat43p_t sb); }
+63 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||ogetkerninfo(int op, \
netbsd32_charp where, netbsd32_intp size, \
int arg); }
-64 COMPAT_43 { int|sys||getpagesize(void); } ogetpagesize
-65 COMPAT_12 { int|netbsd32||msync(netbsd32_voidp addr, \
+64 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|sys||getpagesize(void); } ogetpagesize
+65 COMPAT_12 MODULAR compat_netbsd32_12 \
+ { int|netbsd32||msync(netbsd32_voidp addr, \
netbsd32_size_t len); }
; XXX COMPAT_??? for 4.4BSD-compatible vfork(2)?
66 NOARGS { int|sys||vfork(void); }
@@ -176,7 +192,8 @@
68 OBSOL vwrite
69 OBSOL sbrk
70 OBSOL sstk
-71 COMPAT_43 { int|netbsd32||ommap(netbsd32_voidp addr, \
+71 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||ommap(netbsd32_voidp addr, \
netbsd32_size_t len, int prot, int flags, int fd, \
netbsd32_long pos); }
72 STD { int|netbsd32||ovadvise(int anom); } vadvise
@@ -196,41 +213,54 @@
netbsd32_gid_tp gidset); }
81 NOARGS { int|sys||getpgrp(void); }
82 STD { int|netbsd32||setpgid(int pid, int pgid); }
-83 COMPAT_50 { int|netbsd32||setitimer(int which, \
+83 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||setitimer(int which, \
netbsd32_itimerval50p_t itv, \
netbsd32_itimerval50p_t oitv); }
-84 COMPAT_43 { int|sys||wait(void); } owait
-85 COMPAT_12 { int|netbsd32||oswapon(netbsd32_charp name); }
-86 COMPAT_50 { int|netbsd32||getitimer(int which, \
+84 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|sys||wait(void); } owait
+85 COMPAT_12 MODULAR compat_netbsd32_12 \
+ { int|netbsd32||oswapon(netbsd32_charp name); }
+86 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||getitimer(int which, \
netbsd32_itimerval50p_t itv); }
-87 COMPAT_43 { int|netbsd32||ogethostname(netbsd32_charp hostname, \
+87 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||ogethostname(netbsd32_charp hostname, \
u_int len); }
-88 COMPAT_43 { int|netbsd32||osethostname(netbsd32_charp hostname, \
+88 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||osethostname(netbsd32_charp hostname, \
u_int len); }
-89 COMPAT_43 { int|sys||getdtablesize(void); } ogetdtablesize
+89 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|sys||getdtablesize(void); } ogetdtablesize
90 STD { int|netbsd32||dup2(int from, int to); }
91 UNIMPL getdopt
92 STD { int|netbsd32||fcntl(int fd, int cmd, \
... netbsd32_voidp arg); }
-93 COMPAT_50 { int|netbsd32||select(int nd, netbsd32_fd_setp_t in, \
+93 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||select(int nd, netbsd32_fd_setp_t in, \
netbsd32_fd_setp_t ou, netbsd32_fd_setp_t ex, \
netbsd32_timeval50p_t tv); }
94 UNIMPL setdopt
95 STD { int|netbsd32||fsync(int fd); }
96 STD { int|netbsd32||setpriority(int which, int who, \
int prio); }
-97 COMPAT_30 { int|netbsd32||socket(int domain, int type, \
+97 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32||socket(int domain, int type, \
int protocol); }
98 STD { int|netbsd32||connect(int s, \
netbsd32_sockaddrp_t name, int namelen); }
-99 COMPAT_43 { int|netbsd32||oaccept(int s, netbsd32_voidp name, \
+99 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||oaccept(int s, netbsd32_voidp name, \
netbsd32_intp anamelen); }
100 STD { int|netbsd32||getpriority(int which, int who); }
-101 COMPAT_43 { int|netbsd32||osend(int s, netbsd32_voidp buf, \
+101 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||osend(int s, netbsd32_voidp buf, \
int len, int flags); }
-102 COMPAT_43 { int|netbsd32||orecv(int s, netbsd32_voidp buf, \
+102 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||orecv(int s, netbsd32_voidp buf, \
int len, int flags); }
-103 COMPAT_13 { int|netbsd32||sigreturn( \
+103 COMPAT_13 MODULAR compat_netbsd32_13 \
+ { int|netbsd32||sigreturn( \
netbsd32_sigcontextp_t sigcntxp); } sigreturn13
104 STD { int|netbsd32||bind(int s, netbsd32_sockaddrp_t name, \
int namelen); }
@@ -238,21 +268,30 @@
netbsd32_voidp val, int valsize); }
106 STD { int|netbsd32||listen(int s, int backlog); }
107 OBSOL vtimes
-108 COMPAT_43 { int|netbsd32||osigvec(int signum, \
+108 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||osigvec(int signum, \
netbsd32_sigvecp_t nsv, netbsd32_sigvecp_t osv); }
-109 COMPAT_43 { int|netbsd32||sigblock(int mask); }
-110 COMPAT_43 { int|netbsd32||sigsetmask(int mask); }
-111 COMPAT_13 { int|netbsd32||sigsuspend(int mask); } sigsuspend13
-112 COMPAT_43 { int|netbsd32||osigstack(netbsd32_sigstackp_t nss, \
+109 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||sigblock(int mask); }
+110 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||sigsetmask(int mask); }
+111 COMPAT_13 MODULAR compat_netbsd32_13 \
+ { int|netbsd32||sigsuspend(int mask); } sigsuspend13
+112 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||osigstack(netbsd32_sigstackp_t nss, \
netbsd32_sigstackp_t oss); }
-113 COMPAT_43 { int|netbsd32||orecvmsg(int s, \
+113 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||orecvmsg(int s, \
netbsd32_omsghdrp_t msg, int flags); }
-114 COMPAT_43 { int|netbsd32||osendmsg(int s, netbsd32_voidp msg, \
+114 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||osendmsg(int s, netbsd32_voidp msg, \
int flags); }
115 OBSOL vtrace
-116 COMPAT_50 { int|netbsd32||gettimeofday(netbsd32_timeval50p_t tp, \
+116 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||gettimeofday(netbsd32_timeval50p_t tp, \
netbsd32_timezonep_t tzp); }
-117 COMPAT_50 { int|netbsd32||getrusage(int who, \
+117 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||getrusage(int who, \
netbsd32_rusage50p_t rusage); }
118 STD { int|netbsd32||getsockopt(int s, int level, int name, \
netbsd32_voidp val, netbsd32_intp avalsize); }
@@ -261,20 +300,24 @@
netbsd32_iovecp_t iovp, int iovcnt); }
121 STD { netbsd32_ssize_t|netbsd32||writev(int fd, \
netbsd32_iovecp_t iovp, int iovcnt); }
-122 COMPAT_50 { int|netbsd32||settimeofday(netbsd32_timeval50p_t tv, \
+122 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||settimeofday(netbsd32_timeval50p_t tv, \
netbsd32_timezonep_t tzp); }
123 STD { int|netbsd32||fchown(int fd, uid_t uid, gid_t gid); }
124 STD { int|netbsd32||fchmod(int fd, mode_t mode); }
-125 COMPAT_43 { int|netbsd32||orecvfrom(int s, netbsd32_voidp buf, \
+125 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||orecvfrom(int s, netbsd32_voidp buf, \
netbsd32_size_t len, int flags, \
netbsd32_voidp from, netbsd32_intp fromlenaddr); }
126 STD { int|netbsd32||setreuid(uid_t ruid, uid_t euid); }
127 STD { int|netbsd32||setregid(gid_t rgid, gid_t egid); }
128 STD { int|netbsd32||rename(netbsd32_charp from, \
netbsd32_charp to); }
-129 COMPAT_43 { int|netbsd32||otruncate(netbsd32_charp path, \
+129 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||otruncate(netbsd32_charp path, \
netbsd32_long length); }
-130 COMPAT_43 { int|netbsd32||oftruncate(int fd, \
+130 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||oftruncate(int fd, \
netbsd32_long length); }
131 STD { int|netbsd32||flock(int fd, int how); }
132 STD { int|netbsd32||mkfifo(netbsd32_charp path, \
@@ -288,25 +331,36 @@
136 STD { int|netbsd32||mkdir(netbsd32_charp path, \
mode_t mode); }
137 STD { int|netbsd32||rmdir(netbsd32_charp path); }
-138 COMPAT_50 { int|netbsd32||utimes(netbsd32_charp path, \
+138 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||utimes(netbsd32_charp path, \
netbsd32_timeval50p_t tptr); }
139 OBSOL 4.2 sigreturn
-140 COMPAT_50 { int|netbsd32||adjtime(netbsd32_timeval50p_t delta, \
+140 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||adjtime(netbsd32_timeval50p_t delta, \
netbsd32_timeval50p_t olddelta); }
-141 COMPAT_43 { int|netbsd32||ogetpeername(int fdes, \
+141 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||ogetpeername(int fdes, \
netbsd32_voidp asa, netbsd32_intp alen); }
-142 COMPAT_43 { int32_t|sys||gethostid(void); } ogethostid
-143 COMPAT_43 { int|netbsd32||sethostid(int32_t hostid); }
-144 COMPAT_43 { int|netbsd32||ogetrlimit(int which, \
+142 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int32_t|sys||gethostid(void); } ogethostid
+143 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||sethostid(int32_t hostid); }
+144 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||ogetrlimit(int which, \
netbsd32_orlimitp_t rlp); }
-145 COMPAT_43 { int|netbsd32||osetrlimit(int which, \
+145 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||osetrlimit(int which, \
netbsd32_orlimitp_t rlp); }
-146 COMPAT_43 { int|netbsd32||killpg(int pgid, int signum); }
+146 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||killpg(int pgid, int signum); }
147 NOARGS { int|sys||setsid(void); }
-148 COMPAT_50 { int|netbsd32||quotactl(netbsd32_charp path, int cmd, \
+148 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||quotactl(netbsd32_charp path, int cmd, \
int uid, netbsd32_voidp arg); }
-149 COMPAT_43 { int|sys||quota(void); } oquota
-150 COMPAT_43 { int|netbsd32||ogetsockname(int fdec, \
+149 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|sys||quota(void); } oquota
+150 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||ogetsockname(int fdec, \
netbsd32_voidp asa, netbsd32_intp alen); }
; Syscalls 151-180 inclusive are reserved for vendor-specific
@@ -319,33 +373,40 @@
154 UNIMPL
155 STD MODULAR compat_netbsd32_nfssrv \
{ int|netbsd32||nfssvc(int flag, netbsd32_voidp argp); }
-156 COMPAT_43 { int|netbsd32||ogetdirentries(int fd, \
+156 COMPAT_43 MODULAR compat_netbsd32_43 \
+ { int|netbsd32||ogetdirentries(int fd, \
netbsd32_charp buf, u_int count, \
netbsd32_longp basep); }
-157 COMPAT_20 { int|netbsd32||statfs(netbsd32_charp path, \
+157 COMPAT_20 MODULAR compat_netbsd32_20 \
+ { int|netbsd32||statfs(netbsd32_charp path, \
netbsd32_statfsp_t buf); }
-158 COMPAT_20 { int|netbsd32||fstatfs(int fd, \
+158 COMPAT_20 MODULAR compat_netbsd32_20 \
+ { int|netbsd32||fstatfs(int fd, \
netbsd32_statfsp_t buf); }
159 UNIMPL
160 UNIMPL
-161 COMPAT_30 { int|netbsd32||getfh(netbsd32_charp fname, \
+161 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32||getfh(netbsd32_charp fname, \
netbsd32_compat_30_fhandlep_t fhp); }
-162 COMPAT_09 { int|netbsd32||ogetdomainname( \
+162 COMPAT_09 MODULAR compat_netbsd32_09 \
+ { int|netbsd32||ogetdomainname( \
netbsd32_charp domainname, int len); }
-163 COMPAT_09 { int|netbsd32||osetdomainname( \
+163 COMPAT_09 MODULAR compat_netbsd32_09 \
+ { int|netbsd32||osetdomainname( \
netbsd32_charp domainname, int len); }
-164 COMPAT_09 { int|netbsd32||uname(netbsd32_outsnamep_t name); }
+164 COMPAT_09 MODULAR compat_netbsd32_09 \
+ { int|netbsd32||uname(netbsd32_outsnamep_t name); }
165 STD { int|netbsd32||sysarch(int op, netbsd32_voidp parms); }
166 UNIMPL
167 UNIMPL
168 UNIMPL
-169 COMPAT_10 MODULAR compat_netbsd32_sysvipc \
+169 COMPAT_10 MODULAR compat_netbsd32_sysvipc_10 \
{ int|netbsd32||semsys(int which, int a2, int a3, \
int a4, int a5); } osemsys
-170 COMPAT_10 MODULAR compat_netbsd32_sysvipc \
+170 COMPAT_10 MODULAR compat_netbsd32_sysvipc_10 \
{ int|netbsd32||msgsys(int which, int a2, int a3, \
int a4, int a5, int a6); } omsgsys
-171 COMPAT_10 MODULAR compat_netbsd32_sysvipc \
+171 COMPAT_10 MODULAR compat_netbsd32_sysvipc_10 \
{ int|netbsd32||shmsys(int which, int a2, int a3, \
int a4); } oshmsys
172 UNIMPL
@@ -355,12 +416,12 @@
174 STD { netbsd32_ssize_t|netbsd32||pwrite(int fd, \
netbsd32_voidp buf, netbsd32_size_t nbyte, \
int PAD, netbsd32_off_t offset); }
-#if defined(NTP) || !defined(_KERNEL_OPT)
-175 COMPAT_30 { int|netbsd32||ntp_gettime( \
+175 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32||ntp_gettime( \
netbsd32_ntptimeval50p_t ntvp); }
+#if defined(NTP) || !defined(_KERNEL_OPT)
176 STD { int|netbsd32||ntp_adjtime(netbsd32_timexp_t tp); }
#else
-175 EXCL ntp_gettime
176 EXCL ntp_adjtime
#endif
177 UNIMPL
@@ -376,10 +437,13 @@
185 EXCL netbsd32_lfs_markv
186 EXCL netbsd32_lfs_segclean
187 EXCL netbsd32_lfs_segwait
-188 COMPAT_12 { int|netbsd32||stat12(netbsd32_charp path, \
+188 COMPAT_12 MODULAR compat_netbsd32_12 \
+ { int|netbsd32||stat12(netbsd32_charp path, \
netbsd32_stat12p_t ub); }
-189 COMPAT_12 { int|netbsd32||fstat12(int fd, netbsd32_stat12p_t sb); }
-190 COMPAT_12 { int|netbsd32||lstat12(netbsd32_charp path, \
+189 COMPAT_12 MODULAR compat_netbsd32_12 \
+ { int|netbsd32||fstat12(int fd, netbsd32_stat12p_t sb); }
+190 COMPAT_12 MODULAR compat_netbsd32_12 \
+ { int|netbsd32||lstat12(netbsd32_charp path, \
netbsd32_stat12p_t ub); }
191 STD { netbsd32_long|netbsd32||pathconf(netbsd32_charp path, \
int name); }
@@ -390,7 +454,8 @@
netbsd32_rlimitp_t rlp); }
195 STD { int|netbsd32||setrlimit(int which, \
netbsd32_rlimitp_t rlp); }
-196 COMPAT_12 { int|netbsd32||getdirentries(int fd, \
+196 COMPAT_12 MODULAR compat_netbsd32_12 \
+ { int|netbsd32||getdirentries(int fd, \
netbsd32_charp buf, u_int count, \
netbsd32_longp basep); }
197 STD { netbsd32_voidp|netbsd32||mmap(netbsd32_voidp addr, \
@@ -413,7 +478,8 @@
204 STD { int|netbsd32||munlock(netbsd32_voidp addr, \
netbsd32_size_t len); }
205 STD { int|netbsd32||undelete(netbsd32_charp path); }
-206 COMPAT_50 { int|netbsd32||futimes(int fd, \
+206 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||futimes(int fd, \
netbsd32_timeval50p_t tptr); }
207 STD { int|netbsd32||getpgid(pid_t pid); }
208 STD { int|netbsd32||reboot(int opt, \
@@ -432,7 +498,7 @@
218 UNIMPL
219 UNIMPL
; System calls 220-300 are reserved for use by NetBSD
-220 COMPAT_14 MODULAR compat_netbsd32_sysvipc \
+220 COMPAT_14 MODULAR compat_netbsd32_sysvipc_14 \
{ int|netbsd32||__semctl(int semid, int semnum, \
int cmd, netbsd32_semunu_t arg); }
221 STD MODULAR compat_netbsd32_sysvipc \
@@ -443,7 +509,7 @@
netbsd32_sembufp_t sops, netbsd32_size_t nsops); }
223 STD MODULAR compat_netbsd32_sysvipc \
{ int|netbsd32||semconfig(int flag); }
-224 COMPAT_14 MODULAR compat_netbsd32_sysvipc \
+224 COMPAT_14 MODULAR compat_netbsd32_sysvipc_14 \
{ int|netbsd32||msgctl(int msqid, int cmd, \
netbsd32_msqid_ds14p_t buf); }
225 STD MODULAR compat_netbsd32_sysvipc \
@@ -458,7 +524,7 @@
228 STD MODULAR compat_netbsd32_sysvipc \
{ netbsd32_voidp|netbsd32||shmat(int shmid, \
netbsd32_voidp shmaddr, int shmflg); }
-229 COMPAT_14 MODULAR compat_netbsd32_sysvipc \
+229 COMPAT_14 MODULAR compat_netbsd32_sysvipc_14 \
{ int|netbsd32||shmctl(int shmid, int cmd, \
netbsd32_shmid_dsp_t buf); }
230 STD MODULAR compat_netbsd32_sysvipc \
@@ -466,13 +532,16 @@
231 STD MODULAR compat_netbsd32_sysvipc \
{ int|netbsd32||shmget(netbsd32_key_t key, \
netbsd32_size_t size, int shmflg); }
-232 COMPAT_50 { int|netbsd32||clock_gettime( \
+232 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||clock_gettime( \
netbsd32_clockid_t clock_id, \
netbsd32_timespec50p_t tp); }
-233 COMPAT_50 { int|netbsd32||clock_settime( \
+233 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||clock_settime( \
netbsd32_clockid_t clock_id, \
netbsd32_timespec50p_t tp); }
-234 COMPAT_50 { int|netbsd32||clock_getres( \
+234 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||clock_getres( \
netbsd32_clockid_t clock_id, \
netbsd32_timespec50p_t tp); }
235 STD { int|netbsd32||timer_create( \
@@ -480,23 +549,27 @@
netbsd32_sigeventp_t evp, \
netbsd32_timerp_t timerid); }
236 STD { int|netbsd32||timer_delete(netbsd32_timer_t timerid); }
-237 COMPAT_50 { int|netbsd32||timer_settime(netbsd32_timer_t timerid, \
+237 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||timer_settime(netbsd32_timer_t timerid, \
int flags, \
netbsd32_itimerspec50p_t value, \
netbsd32_itimerspec50p_t ovalue); }
-238 COMPAT_50 { int|netbsd32||timer_gettime(netbsd32_timer_t timerid, \
+238 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||timer_gettime(netbsd32_timer_t timerid, \
netbsd32_itimerspec50p_t value); }
239 STD { int|netbsd32||timer_getoverrun( \
netbsd32_timer_t timerid); }
;
; Syscalls 240-269 are reserved for other IEEE Std1003.1b syscalls
;
-240 COMPAT_50 { int|netbsd32||nanosleep(netbsd32_timespec50p_t rqtp, \
+240 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||nanosleep(netbsd32_timespec50p_t rqtp, \
netbsd32_timespec50p_t rmtp); }
241 STD { int|netbsd32||fdatasync(int fd); }
242 STD { int|netbsd32||mlockall(int flags); }
243 NOARGS { int|sys||munlockall(void); }
-244 COMPAT_50 { int|netbsd32||__sigtimedwait(netbsd32_sigsetp_t set, \
+244 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||__sigtimedwait(netbsd32_sigsetp_t set, \
netbsd32_siginfop_t info, \
netbsd32_timespec50p_t timeout); }
245 STD { int|netbsd32||sigqueueinfo(pid_t pid, \
@@ -562,7 +635,8 @@
netbsd32_charp to); }
271 STD { int|netbsd32||swapctl(int cmd, netbsd32_voidp arg, \
int misc); }
-272 COMPAT_30 { int|netbsd32||getdents(int fd, netbsd32_charp buf, \
+272 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32||getdents(int fd, netbsd32_charp buf, \
netbsd32_size_t count); }
273 STD { int|netbsd32||minherit(netbsd32_voidp addr, \
netbsd32_size_t len, int inherit); }
@@ -570,15 +644,19 @@
mode_t mode); }
275 STD { int|netbsd32||lchown(netbsd32_charp path, uid_t uid, \
gid_t gid); }
-276 COMPAT_50 { int|netbsd32||lutimes(netbsd32_charp path, \
+276 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||lutimes(netbsd32_charp path, \
netbsd32_timeval50p_t tptr); }
277 STD { int|netbsd32|13|msync(netbsd32_voidp addr, \
netbsd32_size_t len, int flags); }
-278 COMPAT_30 { int|netbsd32|13|stat(netbsd32_charp path, \
+278 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32|13|stat(netbsd32_charp path, \
netbsd32_stat13p_t ub); }
-279 COMPAT_30 { int|netbsd32|13|fstat(int fd, \
+279 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32|13|fstat(int fd, \
netbsd32_stat13p_t sb); }
-280 COMPAT_30 { int|netbsd32|13|lstat(netbsd32_charp path, \
+280 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32|13|lstat(netbsd32_charp path, \
netbsd32_stat13p_t ub); }
281 STD { int|netbsd32|14|sigaltstack(\
netbsd32_sigaltstackp_t nss, \
@@ -609,24 +687,28 @@
netbsd32_sigsetp_t set, \
netbsd32_sigsetp_t oset); }
294 STD { int|netbsd32|14|sigsuspend(netbsd32_sigsetp_t set); }
-295 COMPAT_16 { int|netbsd32|14|sigreturn( \
+295 COMPAT_16 MODULAR compat_netbsd32_16 \
+ { int|netbsd32|14|sigreturn( \
netbsd32_sigcontextp_t sigcntxp); }
296 STD { int|netbsd32||__getcwd(netbsd32_charp bufp, \
netbsd32_size_t length); }
297 STD { int|netbsd32||fchroot(int fd); }
-298 COMPAT_30 { int|netbsd32||fhopen(netbsd32_fhandlep_t fhp, \
+298 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32||fhopen(netbsd32_fhandlep_t fhp, \
int flags); }
-299 COMPAT_30 { int|netbsd32||fhstat(netbsd32_fhandlep_t fhp, \
+299 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32||fhstat(netbsd32_fhandlep_t fhp, \
netbsd32_stat13p_t sb); }
-300 COMPAT_20 { int|netbsd32||fhstatfs(netbsd32_fhandlep_t fhp, \
+300 COMPAT_20 MODULAR compat_netbsd32_20 \
+ { int|netbsd32||fhstatfs(netbsd32_fhandlep_t fhp, \
netbsd32_stat50p_t buf); }
-301 COMPAT_50 MODULAR compat_netbsd32_sysvipc \
+301 COMPAT_50 MODULAR compat_netbsd32_sysvipc_50 \
{ int|netbsd32|14|semctl(int semid, int semnum, \
int cmd, ... netbsd32_semun50p_t arg); }
-302 COMPAT_50 MODULAR compat_netbsd32_sysvipc \
+302 COMPAT_50 MODULAR compat_netbsd32_sysvipc_50 \
{ int|netbsd32|13|msgctl(int msqid, int cmd, \
netbsd32_msqid_ds50p_t buf); }
-303 COMPAT_50 MODULAR compat_netbsd32_sysvipc \
+303 COMPAT_50 MODULAR compat_netbsd32_sysvipc_50 \
{ int|netbsd32|13|shmctl(int shmid, int cmd, \
netbsd32_shmid_ds50p_t buf); }
304 STD { int|netbsd32||lchflags(netbsd32_charp path, \
@@ -649,7 +731,8 @@
317 STD { void|netbsd32||_lwp_setprivate(netbsd32_voidp ptr); }
318 STD { int|netbsd32||_lwp_kill(lwpid_t target, int signo); }
319 STD { int|netbsd32||_lwp_detach(lwpid_t target); }
-320 COMPAT_50 { int|netbsd32||_lwp_park(netbsd32_timespec50p_t ts, \
+320 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||_lwp_park(netbsd32_timespec50p_t ts, \
lwpid_t unpark, netbsd32_voidp hint, \
netbsd32_voidp unparkhint); }
321 STD { int|netbsd32||_lwp_unpark(lwpid_t target, \
@@ -686,7 +769,8 @@
343 STD { int|netbsd32||rasctl(netbsd32_voidp addr, \
netbsd32_size_t len, int op); }
344 NOARGS { int|sys||kqueue(void); }
-345 COMPAT_50 { int|netbsd32||kevent(int fd, \
+345 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||kevent(int fd, \
netbsd32_keventp_t changelist, \
netbsd32_size_t nchanges, \
netbsd32_keventp_t eventlist, \
@@ -718,7 +802,8 @@
netbsd32_statvfsp_t buf, int flags); }
358 STD { int|netbsd32||fstatvfs1(int fd, \
netbsd32_statvfsp_t buf, int flags); }
-359 COMPAT_30 { int|netbsd32||fhstatvfs1(netbsd32_fhandlep_t fhp, \
+359 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32||fhstatvfs1(netbsd32_fhandlep_t fhp, \
netbsd32_statvfsp_t buf, int flags); }
360 STD { int|netbsd32||extattrctl(netbsd32_charp path, \
int cmd, netbsd32_charp filename, \
@@ -758,11 +843,13 @@
372 STD { int|netbsd32||extattr_list_link(netbsd32_charp path, \
int attrnamespace, netbsd32_voidp data, \
netbsd32_size_t nbytes); }
-373 COMPAT_50 { int|netbsd32||pselect(int nd, netbsd32_fd_setp_t in, \
+373 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||pselect(int nd, netbsd32_fd_setp_t in, \
netbsd32_fd_setp_t ou, netbsd32_fd_setp_t ex, \
netbsd32_timespec50p_t ts, \
netbsd32_sigsetp_t mask); }
-374 COMPAT_50 { int|netbsd32||pollts(netbsd32_pollfdp_t fds, \
+374 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||pollts(netbsd32_pollfdp_t fds, \
u_int nfds, netbsd32_timespec50p_t ts, \
netbsd32_sigsetp_t mask); }
375 STD { int|netbsd32||setxattr(netbsd32_charp path, \
@@ -795,24 +882,25 @@
netbsd32_charp name); }
386 STD { int|netbsd32||fremovexattr(int fd, \
netbsd32_charp name); }
-387 COMPAT_50 { int|netbsd32|30|stat(netbsd32_charp path, \
+387 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32|30|stat(netbsd32_charp path, \
netbsd32_stat50p_t ub); }
-388 COMPAT_50 { int|netbsd32|30|fstat(int fd, \
+388 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32|30|fstat(int fd, \
netbsd32_stat50p_t sb); }
-389 COMPAT_50 { int|netbsd32|30|lstat( \
+389 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32|30|lstat( \
netbsd32_charp path, netbsd32_stat50p_t ub); }
390 STD { int|netbsd32|30|getdents(int fd, \
netbsd32_charp buf, netbsd32_size_t count); }
391 IGNORED old posix fadvise
-392 COMPAT_30 { int|netbsd32|30|fhstat( \
+392 COMPAT_30 MODULAR compat_netbsd32_30 \
+ { int|netbsd32|30|fhstat( \
netbsd32_fhandlep_t fhp, \
netbsd32_stat50p_t sb); }
-#if defined(NTP) || !defined(_KERNEL_OPT)
-393 COMPAT_50 { int|netbsd32||ntp_gettime( \
+393 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32||ntp_gettime( \
netbsd32_ntptimeval50p_t ntvp); }
-#else
-393 EXCL __ntp_gettime30
-#endif
394 STD { int|netbsd32|30|socket(int domain, int type, \
int protocol); }
395 STD { int|netbsd32|30|getfh(netbsd32_charp fname, \
@@ -822,7 +910,8 @@
397 STD { int|netbsd32|40|fhstatvfs1( \
netbsd32_pointer_t fhp, netbsd32_size_t fh_size,\
netbsd32_statvfsp_t buf, int flags); }
-398 COMPAT_50 { int|netbsd32|40|fhstat( \
+398 COMPAT_50 MODULAR compat_netbsd32_50 \
+ { int|netbsd32|40|fhstat( \
netbsd32_pointer_t fhp, netbsd32_size_t fh_size,\
netbsd32_stat50p_t sb); }
@@ -906,7 +995,8 @@
mqd_t mqdes, netbsd32_charp msg_ptr, \
netbsd32_size_t msg_len, netbsd32_uintp msg_prio, \
const netbsd32_timespecp_t abs_timeout); }
-434 COMPAT_60 { int|netbsd32||_lwp_park( \
+434 COMPAT_60 MODULAR compat_netbsd32_60 \
+ { int|netbsd32||_lwp_park( \
const netbsd32_timespecp_t ts, \
lwpid_t unpark, const netbsd32_voidp hint, \
const netbsd32_voidp unparkhint); }
diff --git a/sys/compat/osf1/osf1_mod.c b/sys/compat/osf1/osf1_mod.c
index 4f30a330d83..d0541aec8e8 100644
--- a/sys/compat/osf1/osf1_mod.c
+++ b/sys/compat/osf1/osf1_mod.c
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_mod.c,v 1.5 2017/02/12 21:02:20 chs Exp $ */
+/* $NetBSD: osf1_mod.c,v 1.6 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_mod.c,v 1.5 2017/02/12 21:02:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_mod.c,v 1.6 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/module.h>
@@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: osf1_mod.c,v 1.5 2017/02/12 21:02:20 chs Exp $");
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_exec.h>
-MODULE(MODULE_CLASS_EXEC, compat_osf1, "compat,exec_ecoff");
+MODULE(MODULE_CLASS_EXEC, compat_osf1, "compat,compat_util,exec_ecoff");
#define OSF1_ARGLEN \
(OSF1_MAX_AUX_ENTRIES * sizeof (struct osf1_auxv) + \
diff --git a/sys/compat/sunos/files.sunos b/sys/compat/sunos/files.sunos
index 2362e10a6b2..8bef52f52a9 100644
--- a/sys/compat/sunos/files.sunos
+++ b/sys/compat/sunos/files.sunos
@@ -1,4 +1,4 @@
-# $NetBSD: files.sunos,v 1.9 2014/11/17 01:01:58 uebayasi Exp $
+# $NetBSD: files.sunos,v 1.10 2019/01/27 02:08:40 pgoyette Exp $
#
# Config file description for machine-independent SunOS compat code.
# Included by ports that need it.
@@ -6,7 +6,7 @@
# ports should define any machine-specific files they need in their
# own file lists.
-define compat_sunos
+define compat_sunos : compat_netbsd,exec_aout
file compat/sunos/sunos_exec.c compat_sunos & !compat_netbsd32
file compat/sunos/sunos_exec_aout.c compat_sunos & exec_aout & !compat_netbsd32
file compat/sunos/sunos_sysent.c compat_sunos & !compat_netbsd32
diff --git a/sys/compat/sunos/sunos_mod.c b/sys/compat/sunos/sunos_mod.c
index 487ddc6c58a..1a5a4404182 100644
--- a/sys/compat/sunos/sunos_mod.c
+++ b/sys/compat/sunos/sunos_mod.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sunos_mod.c,v 1.3 2014/03/07 01:33:44 christos Exp $ */
+/* $NetBSD: sunos_mod.c,v 1.4 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,19 +30,20 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos_mod.c,v 1.3 2014/03/07 01:33:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_mod.c,v 1.4 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/module.h>
#include <sys/exec.h>
#include <sys/exec_aout.h>
#include <sys/signalvar.h>
+#include <sys/compat_stub.h>
#include <machine/sunos_machdep.h>
#include <compat/sunos/sunos_exec.h>
-MODULE(MODULE_CLASS_EXEC, compat_sunos, "compat,exec_aout");
+MODULE(MODULE_CLASS_EXEC, compat_sunos, "compat,compat_util,exec_aout");
static struct execsw sunos_execsw = {
.es_hdrsz = SUNOS_AOUT_HDR_SIZE,
@@ -60,14 +61,25 @@ static struct execsw sunos_execsw = {
};
static int
+get_sunos_emul(const struct emul **e)
+{
+
+ *e = &emul_sunos;
+ return 0;
+}
+
+static int
compat_sunos_modcmd(modcmd_t cmd, void *arg)
{
switch (cmd) {
case MODULE_CMD_INIT:
+ MODULE_SET_HOOK(get_emul_sunos_hook, "sun_emul",
+ get_sunos_emul);
return exec_add(&sunos_execsw, 1);
case MODULE_CMD_FINI:
+ MODULE_UNSET_HOOK(get_emul_sunos_hook);
return exec_remove(&sunos_execsw, 1);
default:
diff --git a/sys/compat/sunos/sunos_syscall.h b/sys/compat/sunos/sunos_syscall.h
index c2131f83d1b..a9b4937ec54 100644
--- a/sys/compat/sunos/sunos_syscall.h
+++ b/sys/compat/sunos/sunos_syscall.h
@@ -1,10 +1,10 @@
-/* $NetBSD: sunos_syscall.h,v 1.97 2018/08/10 21:47:15 pgoyette Exp $ */
+/* $NetBSD: sunos_syscall.h,v 1.98 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.80 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.80.2.2 2018/09/29 02:29:42 pgoyette Exp
*/
#ifndef _SUNOS_SYS_SYSCALL_H_
@@ -381,12 +381,15 @@
/* syscall: "getfh" ret: "int" args: "char *" "fhandle_t *" */
#define SUNOS_SYS_getfh 161
+#ifdef COMPAT_09
/* syscall: "getdomainname" ret: "int" args: "char *" "int" */
#define SUNOS_SYS_getdomainname 162
/* syscall: "setdomainname" ret: "int" args: "char *" "int" */
#define SUNOS_SYS_setdomainname 163
+#else
+#endif
/* syscall: "quotactl" ret: "int" args: "int" "char *" "int" "void *" */
#define SUNOS_SYS_quotactl 165
@@ -399,19 +402,19 @@
/* syscall: "ustat" ret: "int" args: "int" "struct sunos_ustat *" */
#define SUNOS_SYS_ustat 168
-#ifdef SYSVSEM
+#if defined(SYSVSEM) && defined(COMPAT_10)
/* syscall: "semsys" ret: "int" args: "int" "int" "int" "int" "int" */
#define SUNOS_SYS_semsys 169
#else
#endif
-#ifdef SYSVMSG
+#if defined(SYSVMSG) && defined(COMPAT_10)
/* syscall: "msgsys" ret: "int" args: "int" "int" "int" "int" "int" "int" */
#define SUNOS_SYS_msgsys 170
#else
#endif
-#ifdef SYSVSHM
+#if defined(SYSVSHM) && defined(COMPAT_10)
/* syscall: "shmsys" ret: "int" args: "int" "int" "int" "int" */
#define SUNOS_SYS_shmsys 171
diff --git a/sys/compat/sunos/sunos_syscallargs.h b/sys/compat/sunos/sunos_syscallargs.h
index 18f638474a1..bc55dcf59fd 100644
--- a/sys/compat/sunos/sunos_syscallargs.h
+++ b/sys/compat/sunos/sunos_syscallargs.h
@@ -1,10 +1,10 @@
-/* $NetBSD: sunos_syscallargs.h,v 1.81 2018/08/10 21:47:15 pgoyette Exp $ */
+/* $NetBSD: sunos_syscallargs.h,v 1.82 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.80 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.80.2.2 2018/09/29 02:29:42 pgoyette Exp
*/
#ifndef _SUNOS_SYS_SYSCALLARGS_H_
@@ -369,10 +369,13 @@ struct sunos_sys_unmount_args {
check_syscall_args(sunos_sys_unmount)
struct compat_30_sys_getfh_args;
+#ifdef COMPAT_09
struct compat_09_sys_getdomainname_args;
struct compat_09_sys_setdomainname_args;
+#else
+#endif
struct sunos_sys_quotactl_args {
syscallarg(int) cmd;
@@ -401,17 +404,17 @@ struct sunos_sys_ustat_args {
syscallarg(struct sunos_ustat *) buf;
};
check_syscall_args(sunos_sys_ustat)
-#ifdef SYSVSEM
+#if defined(SYSVSEM) && defined(COMPAT_10)
struct compat_10_sys_semsys_args;
#else
#endif
-#ifdef SYSVMSG
+#if defined(SYSVMSG) && defined(COMPAT_10)
struct compat_10_sys_msgsys_args;
#else
#endif
-#ifdef SYSVSHM
+#if defined(SYSVSHM) && defined(COMPAT_10)
struct compat_10_sys_shmsys_args;
#else
@@ -698,10 +701,13 @@ int async_daemon(struct lwp *, const void *, register_t *);
int compat_30_sys_getfh(struct lwp *, const struct compat_30_sys_getfh_args *, register_t *);
+#ifdef COMPAT_09
int compat_09_sys_getdomainname(struct lwp *, const struct compat_09_sys_getdomainname_args *, register_t *);
int compat_09_sys_setdomainname(struct lwp *, const struct compat_09_sys_setdomainname_args *, register_t *);
+#else
+#endif
int sunos_sys_quotactl(struct lwp *, const struct sunos_sys_quotactl_args *, register_t *);
int sunos_sys_exportfs(struct lwp *, const struct sunos_sys_exportfs_args *, register_t *);
@@ -710,17 +716,17 @@ int sunos_sys_mount(struct lwp *, const struct sunos_sys_mount_args *, register_
int sunos_sys_ustat(struct lwp *, const struct sunos_sys_ustat_args *, register_t *);
-#ifdef SYSVSEM
+#if defined(SYSVSEM) && defined(COMPAT_10)
int compat_10_sys_semsys(struct lwp *, const struct compat_10_sys_semsys_args *, register_t *);
#else
#endif
-#ifdef SYSVMSG
+#if defined(SYSVMSG) && defined(COMPAT_10)
int compat_10_sys_msgsys(struct lwp *, const struct compat_10_sys_msgsys_args *, register_t *);
#else
#endif
-#ifdef SYSVSHM
+#if defined(SYSVSHM) && defined(COMPAT_10)
int compat_10_sys_shmsys(struct lwp *, const struct compat_10_sys_shmsys_args *, register_t *);
#else
diff --git a/sys/compat/sunos/sunos_syscalls.c b/sys/compat/sunos/sunos_syscalls.c
index e4bd39fca08..0f70f8ee327 100644
--- a/sys/compat/sunos/sunos_syscalls.c
+++ b/sys/compat/sunos/sunos_syscalls.c
@@ -1,14 +1,14 @@
-/* $NetBSD: sunos_syscalls.c,v 1.96 2018/08/10 21:47:15 pgoyette Exp $ */
+/* $NetBSD: sunos_syscalls.c,v 1.97 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.80 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.80.2.2 2018/09/29 02:29:42 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos_syscalls.c,v 1.96 2018/08/10 21:47:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_syscalls.c,v 1.97 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)
@@ -190,24 +190,29 @@ const char *const sunos_syscallnames[] = {
/* 159 */ "unmount",
/* 160 */ "async_daemon",
/* 161 */ "getfh",
+#ifdef COMPAT_09
/* 162 */ "getdomainname",
/* 163 */ "setdomainname",
+#else
+ /* 162 */ "#162 (unimplemented compat_09_sys_getdomainname)",
+ /* 163 */ "#163 (unimplemented compat_09_sys_setdomainname)",
+#endif
/* 164 */ "#164 (unimplemented rtschedule)",
/* 165 */ "quotactl",
/* 166 */ "exportfs",
/* 167 */ "mount",
/* 168 */ "ustat",
-#ifdef SYSVSEM
+#if defined(SYSVSEM) && defined(COMPAT_10)
/* 169 */ "semsys",
#else
/* 169 */ "#169 (unimplemented semsys)",
#endif
-#ifdef SYSVMSG
+#if defined(SYSVMSG) && defined(COMPAT_10)
/* 170 */ "msgsys",
#else
/* 170 */ "#170 (unimplemented msgsys)",
#endif
-#ifdef SYSVSHM
+#if defined(SYSVSHM) && defined(COMPAT_10)
/* 171 */ "shmsys",
#else
/* 171 */ "#171 (unimplemented shmsys)",
@@ -463,24 +468,29 @@ const char *const altsunos_syscallnames[] = {
/* 159 */ NULL, /* unmount */
/* 160 */ "daemon",
/* 161 */ NULL, /* getfh */
+#ifdef COMPAT_09
/* 162 */ NULL, /* getdomainname */
/* 163 */ NULL, /* setdomainname */
+#else
+ /* 162 */ NULL, /* unimplemented compat_09_sys_getdomainname */
+ /* 163 */ NULL, /* unimplemented compat_09_sys_setdomainname */
+#endif
/* 164 */ NULL, /* unimplemented rtschedule */
/* 165 */ NULL, /* quotactl */
/* 166 */ NULL, /* exportfs */
/* 167 */ NULL, /* mount */
/* 168 */ NULL, /* ustat */
-#ifdef SYSVSEM
+#if defined(SYSVSEM) && defined(COMPAT_10)
/* 169 */ NULL, /* semsys */
#else
/* 169 */ NULL, /* unimplemented semsys */
#endif
-#ifdef SYSVMSG
+#if defined(SYSVMSG) && defined(COMPAT_10)
/* 170 */ NULL, /* msgsys */
#else
/* 170 */ NULL, /* unimplemented msgsys */
#endif
-#ifdef SYSVSHM
+#if defined(SYSVSHM) && defined(COMPAT_10)
/* 171 */ NULL, /* shmsys */
#else
/* 171 */ NULL, /* unimplemented shmsys */
diff --git a/sys/compat/sunos/sunos_sysent.c b/sys/compat/sunos/sunos_sysent.c
index 9d854461cd2..a7c6d394d61 100644
--- a/sys/compat/sunos/sunos_sysent.c
+++ b/sys/compat/sunos/sunos_sysent.c
@@ -1,14 +1,14 @@
-/* $NetBSD: sunos_sysent.c,v 1.92 2018/08/10 21:47:15 pgoyette Exp $ */
+/* $NetBSD: sunos_sysent.c,v 1.93 2019/01/27 02:08:40 pgoyette Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.80 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.80.2.2 2018/09/29 02:29:42 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos_sysent.c,v 1.92 2018/08/10 21:47:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_sysent.c,v 1.93 2019/01/27 02:08:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -699,6 +699,7 @@ struct sysent sunos_sysent[] = {
.sy_flags = SYCALL_ARG_PTR,
.sy_call = (sy_call_t *)compat_30_sys_getfh
}, /* 161 = getfh */
+#ifdef COMPAT_09
{
ns(struct compat_09_sys_getdomainname_args),
.sy_flags = SYCALL_ARG_PTR,
@@ -709,6 +710,14 @@ struct sysent sunos_sysent[] = {
.sy_flags = SYCALL_ARG_PTR,
.sy_call = (sy_call_t *)compat_09_sys_setdomainname
}, /* 163 = setdomainname */
+#else
+ {
+ .sy_call = sys_nosys,
+ }, /* 162 = filler */
+ {
+ .sy_call = sys_nosys,
+ }, /* 163 = filler */
+#endif
{
.sy_call = sys_nosys,
}, /* 164 = filler */
@@ -732,7 +741,7 @@ struct sysent sunos_sysent[] = {
.sy_flags = SYCALL_ARG_PTR,
.sy_call = (sy_call_t *)sunos_sys_ustat
}, /* 168 = ustat */
-#ifdef SYSVSEM
+#if defined(SYSVSEM) && defined(COMPAT_10)
{
ns(struct compat_10_sys_semsys_args),
.sy_call = (sy_call_t *)compat_10_sys_semsys
@@ -742,7 +751,7 @@ struct sysent sunos_sysent[] = {
.sy_call = sys_nosys,
}, /* 169 = filler */
#endif
-#ifdef SYSVMSG
+#if defined(SYSVMSG) && defined(COMPAT_10)
{
ns(struct compat_10_sys_msgsys_args),
.sy_call = (sy_call_t *)compat_10_sys_msgsys
@@ -752,7 +761,7 @@ struct sysent sunos_sysent[] = {
.sy_call = sys_nosys,
}, /* 170 = filler */
#endif
-#ifdef SYSVSHM
+#if defined(SYSVSHM) && defined(COMPAT_10)
{
ns(struct compat_10_sys_shmsys_args),
.sy_call = (sy_call_t *)compat_10_sys_shmsys
diff --git a/sys/compat/sunos/syscalls.master b/sys/compat/sunos/syscalls.master
index 1cf1bdc4819..c4655806f68 100644
--- a/sys/compat/sunos/syscalls.master
+++ b/sys/compat/sunos/syscalls.master
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.80 2018/01/06 16:41:23 kamil Exp $
+ $NetBSD: syscalls.master,v 1.81 2019/01/27 02:08:40 pgoyette Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -259,10 +259,15 @@
159 STD { int|sunos_sys||unmount(char *path); }
160 NOARGS { int|async||daemon(void); }
161 NOARGS { int|compat_30_sys||getfh(char *fname, fhandle_t *fhp); }
+#ifdef COMPAT_09
162 NOARGS { int|compat_09_sys||getdomainname(char *domainname, \
int len); }
163 NOARGS { int|compat_09_sys||setdomainname(char *domainname, \
int len); }
+#else
+162 UNIMPL compat_09_sys_getdomainname
+163 UNIMPL compat_09_sys_setdomainname
+#endif
164 UNIMPL rtschedule
165 STD { int|sunos_sys||quotactl(int cmd, char *special, \
int uid, void *addr); }
@@ -271,19 +276,19 @@
int flags, void *data); }
168 STD { int|sunos_sys||ustat(int dev, \
struct sunos_ustat *buf); }
-#ifdef SYSVSEM
+#if defined(SYSVSEM) && defined(COMPAT_10)
169 NOARGS { int|compat_10_sys||semsys(int which, int a2, int a3, \
int a4, int a5); }
#else
169 UNIMPL semsys
#endif
-#ifdef SYSVMSG
+#if defined(SYSVMSG) && defined(COMPAT_10)
170 NOARGS { int|compat_10_sys||msgsys(int which, int a2, int a3, \
int a4, int a5, int a6); }
#else
170 UNIMPL msgsys
#endif
-#ifdef SYSVSHM
+#if defined(SYSVSHM) && defined(COMPAT_10)
171 NOARGS { int|compat_10_sys||shmsys(int which, int a2, int a3, \
int a4); }
#else
diff --git a/sys/compat/sunos32/files.sunos32 b/sys/compat/sunos32/files.sunos32
index 4f345474f67..163c2421388 100644
--- a/sys/compat/sunos32/files.sunos32
+++ b/sys/compat/sunos32/files.sunos32
@@ -1,4 +1,4 @@
-# $NetBSD: files.sunos32,v 1.3 2014/11/17 01:01:58 uebayasi Exp $
+# $NetBSD: files.sunos32,v 1.4 2019/01/27 02:08:40 pgoyette Exp $
#
# Config file description for machine-independent SunOS compat code for
# 64-bit kernel. Included by ports that need it.
@@ -7,7 +7,7 @@
# own file lists.
# XXX compat_sunos32
-define compat_sunos
+#define compat_sunos
file compat/sunos32/sunos32_exec.c compat_sunos & compat_netbsd32
file compat/sunos32/sunos32_exec_aout.c compat_sunos & compat_netbsd32
file compat/sunos32/sunos32_misc.c compat_sunos & compat_netbsd32
diff --git a/sys/compat/sunos32/sunos32_mod.c b/sys/compat/sunos32/sunos32_mod.c
index ba7dd12698c..647cbbd880d 100644
--- a/sys/compat/sunos32/sunos32_mod.c
+++ b/sys/compat/sunos32/sunos32_mod.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sunos32_mod.c,v 1.3 2014/03/07 01:33:44 christos Exp $ */
+/* $NetBSD: sunos32_mod.c,v 1.4 2019/01/27 02:08:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,13 +30,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos32_mod.c,v 1.3 2014/03/07 01:33:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos32_mod.c,v 1.4 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/module.h>
#include <sys/exec.h>
#include <sys/exec_aout.h>
#include <sys/signalvar.h>
+#include <sys/compat_stub.h>
#include <machine/sunos_machdep.h>
@@ -44,7 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: sunos32_mod.c,v 1.3 2014/03/07 01:33:44 christos Exp
#include <compat/netbsd32/netbsd32_exec.h>
-MODULE(MODULE_CLASS_EXEC, compat_sunos, "compat,compat_netbsd32,exec_aout");
+MODULE(MODULE_CLASS_EXEC, compat_sunos,
+ "compat,compat_util,compat_netbsd32,exec_aout");
static struct execsw sunos_execsw = {
.es_hdrsz = SUNOS32_AOUT_HDR_SIZE,
@@ -62,14 +64,25 @@ static struct execsw sunos_execsw = {
};
static int
+get_sunos_emul(const struct emul **e)
+{
+
+ *e = &emul_sunos;
+ return 0;
+}
+
+static int
compat_sunos_modcmd(modcmd_t cmd, void *arg)
{
-
+
switch (cmd) {
case MODULE_CMD_INIT:
+ MODULE_SET_HOOK(get_emul_sunos_hook, "sun_emul",
+ get_sunos_emul);
return exec_add(&sunos_execsw, 1);
-
+
case MODULE_CMD_FINI:
+ MODULE_UNSET_HOOK(get_emul_sunos_hook);
return exec_remove(&sunos_execsw, 1);
default:
diff --git a/sys/compat/sys/clockctl.h b/sys/compat/sys/clockctl.h
index 315e632c7de..a4d54473eb0 100644
--- a/sys/compat/sys/clockctl.h
+++ b/sys/compat/sys/clockctl.h
@@ -1,4 +1,4 @@
-/* $NetBSD: clockctl.h,v 1.4 2015/09/06 06:00:59 dholland Exp $ */
+/* $NetBSD: clockctl.h,v 1.5 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -70,6 +70,9 @@ struct clockctl50_ntp_adjtime {
#ifdef _KERNEL
struct lwp;
int compat50_clockctlioctl(dev_t, u_long, void *, int, struct lwp *);
+
+void clockctl_50_init(void);
+void clockctl_50_fini(void);
#endif
#endif /* _COMPAT_SYS_CLOCKCTL_H_ */
diff --git a/sys/compat/sys/cpuio.h b/sys/compat/sys/cpuio.h
index b76ba4f06ac..6c967ee7cd7 100644
--- a/sys/compat/sys/cpuio.h
+++ b/sys/compat/sys/cpuio.h
@@ -1,4 +1,36 @@
-/* $NetBSD: cpuio.h,v 1.8 2018/03/18 04:10:39 christos Exp $ */
+/* $NetBSD: cpuio.h,v 1.9 2019/01/27 02:08:41 pgoyette Exp $ */
+
+#ifndef _SYS_COMPAT_CPUIO_H_
+#define _SYS_COMPAT_CPUIO_H_
+
+/*-
+ * Copyright (c) 2018 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 _SYS_COMPAT_CPUIO_H_
#define _SYS_COMPAT_CPUIO_H_
diff --git a/sys/compat/sys/rnd.h b/sys/compat/sys/rnd.h
index 76e45b4a7f0..06cbe8d8696 100644
--- a/sys/compat/sys/rnd.h
+++ b/sys/compat/sys/rnd.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rnd.h,v 1.4 2015/04/14 12:19:57 riastradh Exp $ */
+/* $NetBSD: rnd.h,v 1.5 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 1997,2011 The NetBSD Foundation, Inc.
@@ -137,6 +137,7 @@ typedef struct {
*/
#ifdef _KERNEL
int compat_50_rnd_ioctl(struct file *, u_long, void *);
+int compat32_50_rnd_ioctl(struct file *, u_long, void *);
#endif
#define RNDGETSRCNUM50 _IOWR('R', 102, rndstat50_t)
diff --git a/sys/compat/sys/socket.h b/sys/compat/sys/socket.h
index 13f8b5858ac..4ea5136cfe8 100644
--- a/sys/compat/sys/socket.h
+++ b/sys/compat/sys/socket.h
@@ -1,4 +1,4 @@
-/* $NetBSD: socket.h,v 1.16 2018/12/19 13:57:52 maxv Exp $ */
+/* $NetBSD: socket.h,v 1.17 2019/01/27 02:08:41 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
@@ -105,6 +105,9 @@ int compat_ifioctl(struct socket *, u_long, u_long, void *, struct lwp *);
int compat43_set_accrights(struct msghdr *, void *, int);
struct mbuf * compat_70_unp_addsockcred(struct lwp *, struct mbuf *);
+
+void uipc_usrreq_70_init(void);
+void uipc_usrreq_70_fini(void);
__END_DECLS
#else
int __socket30(int, int, int);
diff --git a/sys/compat/sys/sockio.h b/sys/compat/sys/sockio.h
index a3ff7159abb..014795203b5 100644
--- a/sys/compat/sys/sockio.h
+++ b/sys/compat/sys/sockio.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sockio.h,v 1.12 2018/04/15 22:13:36 pgoyette Exp $ */
+/* $NetBSD: sockio.h,v 1.13 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
@@ -181,16 +181,4 @@ struct oifdatareq {
(oi)->ifi_lastchange.tv_usec * 1000; \
} while (/*CONSTCOND*/0)
-#ifdef _KERNEL
-
-extern int (*vec_compat_ifconf)(struct lwp *, u_long, void *);
-extern int (*vec_compat_ifdatareq)(struct lwp *, u_long, void *);
-
-void uipc_syscalls_40_init(void);
-void uipc_syscalls_40_fini(void);
-void uipc_syscalls_50_init(void);
-void uipc_syscalls_50_fini(void);
-
-#endif
-
#endif /* _COMPAT_SYS_SOCKIO_H_ */
diff --git a/sys/compat/sys/ttycom.h b/sys/compat/sys/ttycom.h
index a535f0a6534..5dfee0356b2 100644
--- a/sys/compat/sys/ttycom.h
+++ b/sys/compat/sys/ttycom.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ttycom.h,v 1.2 2012/10/19 17:16:55 apb Exp $ */
+/* $NetBSD: ttycom.h,v 1.3 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@ struct compat_60_ptmget {
#define COMPAT_60_TIOCPTSNAME _IOR('t', 72, struct compat_60_ptmget)
#ifdef _KERNEL
-int compat_60_ttioctl(struct tty *, u_long, void *, int, struct lwp *);
+int compat_60_ttioctl(dev_t, u_long, void *, int, struct lwp *);
int compat_60_ptmioctl(dev_t, u_long, void *, int, struct lwp *);
#endif
diff --git a/sys/compat/ultrix/files.ultrix b/sys/compat/ultrix/files.ultrix
index 9e4ca170522..2c913cd1062 100644
--- a/sys/compat/ultrix/files.ultrix
+++ b/sys/compat/ultrix/files.ultrix
@@ -1,4 +1,4 @@
-# $NetBSD: files.ultrix,v 1.6 2014/11/17 01:01:58 uebayasi Exp $
+# $NetBSD: files.ultrix,v 1.7 2019/01/27 02:08:41 pgoyette Exp $
#
# Config file description for machine-independent Ultrix compat code.
# Included by ports that need it.
@@ -6,7 +6,7 @@
# ports should define any machine-specific files they need in their
# own file lists.
-define compat_ultrix
+define compat_ultrix : compat_netbsd
file compat/ultrix/ultrix_exec_ecoff.c compat_ultrix & exec_ecoff
file compat/ultrix/ultrix_pathname.c compat_ultrix
file compat/ultrix/ultrix_ioctl.c compat_ultrix
diff --git a/sys/compat/ultrix/syscalls.master b/sys/compat/ultrix/syscalls.master
index 8dad7f64e74..1f9351ce8b9 100644
--- a/sys/compat/ultrix/syscalls.master
+++ b/sys/compat/ultrix/syscalls.master
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.56 2018/01/06 16:41:23 kamil Exp $
+ $NetBSD: syscalls.master,v 1.57 2019/01/27 02:08:41 pgoyette Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -255,10 +255,15 @@
162 UNIMPL umount
163 UNIMPL async_daemon
164 NOARGS { int|compat_30_sys||getfh(char *fname, fhandle_t *fhp); }
+#if defined(COMPAT_09)
165 NOARGS { int|compat_09_sys||getdomainname(char *domainname, \
int len); }
166 NOARGS { int|compat_09_sys||setdomainname(char *domainname, \
int len); }
+#else
+165 UNIMPL compat_09_sys_getdomainname
+166 UNIMPL compat_09_sys_setdomainname
+#endif
167 UNIMPL
168 STD { int|ultrix_sys||quotactl(int cmd, char *special, \
int uid, void *addr); }
diff --git a/sys/compat/ultrix/ultrix_syscall.h b/sys/compat/ultrix/ultrix_syscall.h
index 7f318b97a99..d6a48f99e79 100644
--- a/sys/compat/ultrix/ultrix_syscall.h
+++ b/sys/compat/ultrix/ultrix_syscall.h
@@ -1,10 +1,10 @@
-/* $NetBSD: ultrix_syscall.h,v 1.73 2018/08/10 21:47:16 pgoyette Exp $ */
+/* $NetBSD: ultrix_syscall.h,v 1.74 2019/01/27 02:08:41 pgoyette Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.56 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.56.2.1 2018/09/29 01:45:05 pgoyette Exp
*/
#ifndef _ULTRIX_SYS_SYSCALL_H_
@@ -387,12 +387,15 @@
/* syscall: "getfh" ret: "int" args: "char *" "fhandle_t *" */
#define ULTRIX_SYS_getfh 164
+#if defined(COMPAT_09)
/* syscall: "getdomainname" ret: "int" args: "char *" "int" */
#define ULTRIX_SYS_getdomainname 165
/* syscall: "setdomainname" ret: "int" args: "char *" "int" */
#define ULTRIX_SYS_setdomainname 166
+#else
+#endif
/* syscall: "quotactl" ret: "int" args: "int" "char *" "int" "void *" */
#define ULTRIX_SYS_quotactl 168
diff --git a/sys/compat/ultrix/ultrix_syscallargs.h b/sys/compat/ultrix/ultrix_syscallargs.h
index a28b569332c..18372c9dc59 100644
--- a/sys/compat/ultrix/ultrix_syscallargs.h
+++ b/sys/compat/ultrix/ultrix_syscallargs.h
@@ -1,10 +1,10 @@
-/* $NetBSD: ultrix_syscallargs.h,v 1.68 2018/08/10 21:47:16 pgoyette Exp $ */
+/* $NetBSD: ultrix_syscallargs.h,v 1.69 2019/01/27 02:08:41 pgoyette Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.56 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.56.2.1 2018/09/29 01:45:05 pgoyette Exp
*/
#ifndef _ULTRIX_SYS_SYSCALLARGS_H_
@@ -357,10 +357,13 @@ struct ultrix_sys_fstatfs_args {
check_syscall_args(ultrix_sys_fstatfs)
struct compat_30_sys_getfh_args;
+#if defined(COMPAT_09)
struct compat_09_sys_getdomainname_args;
struct compat_09_sys_setdomainname_args;
+#else
+#endif
struct ultrix_sys_quotactl_args {
syscallarg(int) cmd;
@@ -675,10 +678,13 @@ int ultrix_sys_fstatfs(struct lwp *, const struct ultrix_sys_fstatfs_args *, reg
int compat_30_sys_getfh(struct lwp *, const struct compat_30_sys_getfh_args *, register_t *);
+#if defined(COMPAT_09)
int compat_09_sys_getdomainname(struct lwp *, const struct compat_09_sys_getdomainname_args *, register_t *);
int compat_09_sys_setdomainname(struct lwp *, const struct compat_09_sys_setdomainname_args *, register_t *);
+#else
+#endif
int ultrix_sys_quotactl(struct lwp *, const struct ultrix_sys_quotactl_args *, register_t *);
int ultrix_sys_exportfs(struct lwp *, const struct ultrix_sys_exportfs_args *, register_t *);
diff --git a/sys/compat/ultrix/ultrix_syscalls.c b/sys/compat/ultrix/ultrix_syscalls.c
index 650a8c53f97..85d4eecdeac 100644
--- a/sys/compat/ultrix/ultrix_syscalls.c
+++ b/sys/compat/ultrix/ultrix_syscalls.c
@@ -1,14 +1,14 @@
-/* $NetBSD: ultrix_syscalls.c,v 1.72 2018/08/10 21:47:16 pgoyette Exp $ */
+/* $NetBSD: ultrix_syscalls.c,v 1.73 2019/01/27 02:08:41 pgoyette Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.56 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.56.2.1 2018/09/29 01:45:05 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ultrix_syscalls.c,v 1.72 2018/08/10 21:47:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ultrix_syscalls.c,v 1.73 2019/01/27 02:08:41 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include <sys/param.h>
@@ -193,8 +193,13 @@ const char *const ultrix_syscallnames[] = {
/* 162 */ "#162 (unimplemented umount)",
/* 163 */ "#163 (unimplemented async_daemon)",
/* 164 */ "getfh",
+#if defined(COMPAT_09)
/* 165 */ "getdomainname",
/* 166 */ "setdomainname",
+#else
+ /* 165 */ "#165 (unimplemented compat_09_sys_getdomainname)",
+ /* 166 */ "#166 (unimplemented compat_09_sys_setdomainname)",
+#endif
/* 167 */ "#167 (unimplemented)",
/* 168 */ "quotactl",
/* 169 */ "exportfs",
@@ -715,8 +720,13 @@ const char *const altultrix_syscallnames[] = {
/* 162 */ NULL, /* unimplemented umount */
/* 163 */ NULL, /* unimplemented async_daemon */
/* 164 */ NULL, /* getfh */
+#if defined(COMPAT_09)
/* 165 */ NULL, /* getdomainname */
/* 166 */ NULL, /* setdomainname */
+#else
+ /* 165 */ NULL, /* unimplemented compat_09_sys_getdomainname */
+ /* 166 */ NULL, /* unimplemented compat_09_sys_setdomainname */
+#endif
/* 167 */ NULL, /* unimplemented */
/* 168 */ NULL, /* quotactl */
/* 169 */ NULL, /* exportfs */
diff --git a/sys/compat/ultrix/ultrix_sysent.c b/sys/compat/ultrix/ultrix_sysent.c
index 2d70cc83520..98e26bfda09 100644
--- a/sys/compat/ultrix/ultrix_sysent.c
+++ b/sys/compat/ultrix/ultrix_sysent.c
@@ -1,14 +1,14 @@
-/* $NetBSD: ultrix_sysent.c,v 1.75 2018/08/10 21:47:16 pgoyette Exp $ */
+/* $NetBSD: ultrix_sysent.c,v 1.76 2019/01/27 02:08:41 pgoyette Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.56 2018/01/06 16:41:23 kamil Exp
+ * created from NetBSD: syscalls.master,v 1.56.2.1 2018/09/29 01:45:05 pgoyette Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ultrix_sysent.c,v 1.75 2018/08/10 21:47:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ultrix_sysent.c,v 1.76 2019/01/27 02:08:41 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -706,6 +706,7 @@ struct sysent ultrix_sysent[] = {
.sy_flags = SYCALL_ARG_PTR,
.sy_call = (sy_call_t *)compat_30_sys_getfh
}, /* 164 = getfh */
+#if defined(COMPAT_09)
{
ns(struct compat_09_sys_getdomainname_args),
.sy_flags = SYCALL_ARG_PTR,
@@ -716,6 +717,14 @@ struct sysent ultrix_sysent[] = {
.sy_flags = SYCALL_ARG_PTR,
.sy_call = (sy_call_t *)compat_09_sys_setdomainname
}, /* 166 = setdomainname */
+#else
+ {
+ .sy_call = sys_nosys,
+ }, /* 165 = filler */
+ {
+ .sy_call = sys_nosys,
+ }, /* 166 = filler */
+#endif
{
.sy_call = sys_nosys,
}, /* 167 = filler */