summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/aarch64/aarch64/aarch64_machdep.c4
-rw-r--r--sys/arch/aarch64/aarch64/bus_space.c4
-rw-r--r--sys/arch/aarch64/aarch64/db_disasm.c4
-rw-r--r--sys/arch/aarch64/aarch64/db_interface.c4
-rw-r--r--sys/arch/aarch64/aarch64/db_machdep.c4
-rw-r--r--sys/arch/aarch64/aarch64/db_trace.c4
-rw-r--r--sys/arch/aarch64/aarch64/idle_machdep.S3
-rw-r--r--sys/arch/aarch64/aarch64/locore.S5
-rw-r--r--sys/arch/aarch64/aarch64/netbsd32_machdep.c20
-rw-r--r--sys/arch/aarch64/aarch64/netbsd32_machdep_13.c (renamed from sys/compat/common/if_43.h)30
-rw-r--r--sys/arch/aarch64/aarch64/netbsd32_machdep_16.c50
-rw-r--r--sys/arch/aarch64/aarch64/trap.c7
-rw-r--r--sys/arch/aarch64/conf/files.aarch644
-rw-r--r--sys/arch/algor/algor/netbsd32_machdep.c59
-rw-r--r--sys/arch/algor/algor/netbsd32_machdep_16.c59
-rw-r--r--sys/arch/alpha/conf/GENERIC6
-rw-r--r--sys/arch/amd64/amd64/machdep.c4
-rw-r--r--sys/arch/amd64/amd64/netbsd32_machdep.c250
-rw-r--r--sys/arch/amd64/amd64/netbsd32_machdep_13.c160
-rw-r--r--sys/arch/amd64/amd64/netbsd32_machdep_16.c262
-rw-r--r--sys/arch/amd64/amd64/trap.c9
-rw-r--r--sys/arch/amd64/conf/NOCOMPAT38
-rw-r--r--sys/arch/amd64/conf/files.amd644
-rw-r--r--sys/arch/amiga/stand/loadkmap/din/Makefile3
-rw-r--r--sys/arch/arm/arm32/arm11_pmc.c4
-rw-r--r--sys/arch/arm/arm32/arm32_boot.c4
-rw-r--r--sys/arch/arm/arm32/cortex_pmc.c4
-rw-r--r--sys/arch/arm/arm32/cpu.c4
-rw-r--r--sys/arch/arm/arm32/netbsd32_machdep.c42
-rw-r--r--sys/arch/arm/arm32/netbsd32_machdep_13.c89
-rw-r--r--sys/arch/arm/arm32/netbsd32_machdep_16.c90
-rw-r--r--sys/arch/arm/conf/files.arm7
-rw-r--r--sys/arch/arm/include/asm.h31
-rw-r--r--sys/arch/arm/samsung/exynos_platform.c9
-rw-r--r--sys/arch/arm/sunxi/sunxi_hdmi.c4
-rw-r--r--sys/arch/arm/vfp/vfp_init.c4
-rw-r--r--sys/arch/evbarm/conf/files.generic2
-rw-r--r--sys/arch/evbarm/conf/files.generic642
-rw-r--r--sys/arch/i386/stand/Makefile.inc7
-rw-r--r--sys/arch/i386/stand/genprom/Makefile4
-rw-r--r--sys/arch/i386/stand/misc/Makefile4
-rw-r--r--sys/arch/macppc/stand/bootxx/Makefile6
-rw-r--r--sys/arch/mips/cavium/dev/octeon_fpa.c6
-rw-r--r--sys/arch/mips/conf/files.mips13
-rw-r--r--sys/arch/mips/mips/netbsd32_machdep.c181
-rw-r--r--sys/arch/mips/mips/netbsd32_machdep_13.c99
-rw-r--r--sys/arch/mips/mips/netbsd32_machdep_16.c110
-rw-r--r--sys/arch/sparc/fpu/fpu.c22
-rw-r--r--sys/arch/sparc64/conf/files.sparc6410
-rw-r--r--sys/arch/sparc64/sparc64/netbsd32_machdep.c378
-rw-r--r--sys/arch/sparc64/sparc64/netbsd32_machdep_13.c183
-rw-r--r--sys/arch/sparc64/sparc64/netbsd32_machdep_16.c363
-rw-r--r--sys/arch/x68k/stand/aout2hux/Makefile4
-rw-r--r--sys/arch/x86/x86/cpu_ucode.c6
-rw-r--r--sys/arch/x86/x86/cpu_ucode_amd.c6
-rw-r--r--sys/arch/x86/x86/cpu_ucode_intel.c6
-rw-r--r--sys/arch/x86/x86/spectre.c6
-rw-r--r--sys/arch/xen/conf/files.xen4
-rw-r--r--sys/arch/xen/x86/xen_ipi.c8
-rw-r--r--sys/arch/xen/x86/xen_shm_machdep.c4
-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.h42
-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
-rw-r--r--sys/conf/Makefile.kern.inc16
-rw-r--r--sys/conf/compat_netbsd80.config9
-rw-r--r--sys/conf/files13
-rw-r--r--sys/conf/std7
-rw-r--r--sys/ddb/db_panic.c4
-rw-r--r--sys/dev/acpi/acpi_pci.c4
-rw-r--r--sys/dev/ata/ld_ataraid.c4
-rw-r--r--sys/dev/bio.c50
-rw-r--r--sys/dev/ccd.c16
-rw-r--r--sys/dev/clockctl.c100
-rw-r--r--sys/dev/fdt/fdt_subr.c6
-rw-r--r--sys/dev/gpio/gpio.c4
-rw-r--r--sys/dev/i2c/i2c.c4
-rw-r--r--sys/dev/ic/ne2000.c4
-rw-r--r--sys/dev/marvell/com_mv.c4
-rw-r--r--sys/dev/pci/ahcisata_pci.c8
-rw-r--r--sys/dev/pci/if_msk.c4
-rw-r--r--sys/dev/pci/if_ne_pci.c4
-rw-r--r--sys/dev/pci/mpii.c4
-rw-r--r--sys/dev/pci/ppb.c8
-rw-r--r--sys/dev/pci/virtio_pci.c5
-rw-r--r--sys/dev/raidframe/rf_compat50.c59
-rw-r--r--sys/dev/raidframe/rf_compat50.h4
-rw-r--r--sys/dev/raidframe/rf_compat50_mod.h39
-rw-r--r--sys/dev/raidframe/rf_compat80.c81
-rw-r--r--sys/dev/raidframe/rf_compat80_mod.h44
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c92
-rw-r--r--sys/dev/sysmon/sysmon_power.c19
-rw-r--r--sys/dev/usb/if_bwfm_usb.c4
-rw-r--r--sys/dev/usb/if_smsc.c4
-rw-r--r--sys/dev/usb/if_umb.c4
-rw-r--r--sys/dev/usb/ugen.c21
-rw-r--r--sys/dev/usb/uhid.c17
-rw-r--r--sys/dev/usb/usb.c120
-rw-r--r--sys/dev/usb/usb_subr.c78
-rw-r--r--sys/dev/usb/usbdi.h12
-rw-r--r--sys/dev/usb/usbdivar.h3
-rw-r--r--sys/dev/usb/usbroothub.c4
-rw-r--r--sys/dev/vnd.c75
-rw-r--r--sys/dev/wscons/files.wscons3
-rw-r--r--sys/dev/wscons/wsevent.c45
-rw-r--r--sys/dev/wscons/wsevent_50.c160
-rw-r--r--sys/dev/wscons/wsevent_50.h38
-rw-r--r--sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.c4
-rw-r--r--sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c4
-rw-r--r--sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c4
-rw-r--r--sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fbcon.c4
-rw-r--r--sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fence.c4
-rw-r--r--sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c4
-rw-r--r--sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c4
-rw-r--r--sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nvc0_fence.c4
-rw-r--r--sys/external/bsd/drm2/i915drm/files.i915drmkms4
-rw-r--r--sys/external/bsd/drm2/include/linux/atomic.h2
-rw-r--r--sys/external/bsd/drm2/nouveau/files.nouveau4
-rw-r--r--sys/external/bsd/drm2/radeon/files.radeon4
-rw-r--r--sys/external/bsd/gnu-efi/dist/lib/print.c3
-rw-r--r--sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/stm32-pinfunc.h8
-rw-r--r--sys/fs/puffs/files.puffs4
-rw-r--r--sys/fs/puffs/puffs_compat.c31
-rw-r--r--sys/fs/puffs/puffs_msgif.c29
-rw-r--r--sys/fs/puffs/puffs_sys.h11
-rw-r--r--sys/kern/compat_stub.c259
-rw-r--r--sys/kern/exec_script.c8
-rw-r--r--sys/kern/files.kern6
-rw-r--r--sys/kern/init_sysent.c18
-rw-r--r--sys/kern/kern_module.c175
-rw-r--r--sys/kern/kern_module_vfs.c8
-rw-r--r--sys/kern/kern_proc.c43
-rw-r--r--sys/kern/kern_rndq.c24
-rw-r--r--sys/kern/kern_stub.c7
-rw-r--r--sys/kern/kern_subr.c4
-rw-r--r--sys/kern/subr_emul.c146
-rw-r--r--sys/kern/subr_syscall_stats.c4
-rw-r--r--sys/kern/sys_module.c121
-rw-r--r--sys/kern/syscalls.conf4
-rw-r--r--sys/kern/syscalls.master264
-rw-r--r--sys/kern/syscalls_autoload.c217
-rw-r--r--sys/kern/sysv_ipc.c49
-rw-r--r--sys/kern/tty.c28
-rw-r--r--sys/kern/tty_ptm.c13
-rw-r--r--sys/kern/uipc_usrreq.c54
-rw-r--r--sys/kern/vfs_syscalls.c22
-rw-r--r--sys/modules/Makefile39
-rw-r--r--sys/modules/arch/x86/amd64-xen/bsd.amd64-xen.mk4
-rw-r--r--sys/modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk4
-rw-r--r--sys/modules/clockctl/Makefile4
-rw-r--r--sys/modules/compat/Makefile14
-rw-r--r--sys/modules/compat_09/Makefile16
-rw-r--r--sys/modules/compat_10/Makefile16
-rw-r--r--sys/modules/compat_12/Makefile17
-rw-r--r--sys/modules/compat_13/Makefile21
-rw-r--r--sys/modules/compat_14/Makefile16
-rw-r--r--sys/modules/compat_16/Makefile15
-rw-r--r--sys/modules/compat_20/Makefile15
-rw-r--r--sys/modules/compat_30/Makefile16
-rw-r--r--sys/modules/compat_40/Makefile18
-rw-r--r--sys/modules/compat_43/Makefile15
-rw-r--r--sys/modules/compat_50/Makefile34
-rw-r--r--sys/modules/compat_60/Makefile21
-rw-r--r--sys/modules/compat_70/Makefile13
-rw-r--r--sys/modules/compat_80/Makefile14
-rw-r--r--sys/modules/compat_crypto_50/Makefile12
-rw-r--r--sys/modules/compat_netbsd32/Makefile45
-rw-r--r--sys/modules/compat_netbsd32_09/Makefile17
-rw-r--r--sys/modules/compat_netbsd32_12/Makefile17
-rw-r--r--sys/modules/compat_netbsd32_13/Makefile26
-rw-r--r--sys/modules/compat_netbsd32_16/Makefile28
-rw-r--r--sys/modules/compat_netbsd32_20/Makefile16
-rw-r--r--sys/modules/compat_netbsd32_30/Makefile17
-rw-r--r--sys/modules/compat_netbsd32_40/Makefile15
-rw-r--r--sys/modules/compat_netbsd32_43/Makefile15
-rw-r--r--sys/modules/compat_netbsd32_50/Makefile16
-rw-r--r--sys/modules/compat_netbsd32_60/Makefile15
-rw-r--r--sys/modules/compat_netbsd32_80/Makefile15
-rw-r--r--sys/modules/compat_netbsd32_sysvipc/Makefile5
-rw-r--r--sys/modules/compat_netbsd32_sysvipc_10/Makefile17
-rw-r--r--sys/modules/compat_netbsd32_sysvipc_14/Makefile17
-rw-r--r--sys/modules/compat_netbsd32_sysvipc_50/Makefile17
-rw-r--r--sys/modules/compat_raid_50/Makefile11
-rw-r--r--sys/modules/compat_raid_80/Makefile12
-rw-r--r--sys/modules/compat_sysctl_09_43/Makefile13
-rw-r--r--sys/modules/compat_sysv_10/Makefile21
-rw-r--r--sys/modules/compat_sysv_14/Makefile19
-rw-r--r--sys/modules/compat_sysv_50/Makefile18
-rw-r--r--sys/modules/compat_util/Makefile11
-rw-r--r--sys/modules/crypto/Makefile4
-rw-r--r--sys/modules/sysv_ipc/Makefile11
-rw-r--r--sys/modules/vnd/Makefile4
-rw-r--r--sys/net/if.c63
-rw-r--r--sys/net/if_spppsubr.c54
-rw-r--r--sys/net/rtsock.c1693
-rw-r--r--sys/net/rtsock_shared.c1677
-rw-r--r--sys/net80211/ieee80211_ioctl.c50
-rw-r--r--sys/net80211/ieee80211_ioctl.h6
-rw-r--r--sys/netipsec/ipsec.c4
-rw-r--r--sys/netipsec/ipsec_input.c4
-rw-r--r--sys/netipsec/key.c4
-rw-r--r--sys/netipsec/key_debug.c4
-rw-r--r--sys/netipsec/keysock.c4
-rw-r--r--sys/netipsec/xform_ah.c4
-rw-r--r--sys/netipsec/xform_esp.c4
-rw-r--r--sys/netipsec/xform_ipcomp.c4
-rw-r--r--sys/netipsec/xform_ipip.c4
-rw-r--r--sys/netipsec/xform_tcp.c4
-rw-r--r--sys/opencrypto/cryptodev.c21
-rw-r--r--sys/opencrypto/files.opencrypto4
-rw-r--r--sys/opencrypto/ocryptodev.c52
-rw-r--r--sys/opencrypto/ocryptodev.h8
-rw-r--r--sys/rump/dev/lib/libnetsmb/netsmb_user.c4
-rw-r--r--sys/rump/dev/lib/libpci/rumpdev_bus_dma.c4
-rw-r--r--sys/rump/dev/lib/libpci/rumpdev_bus_space.c4
-rw-r--r--sys/rump/dev/lib/libscsipi/scsipi_component.c7
-rw-r--r--sys/rump/dev/lib/libucom/ucom_at_usb.c7
-rw-r--r--sys/rump/dev/lib/libugenhc/ugenhc_user.c4
-rw-r--r--sys/rump/dev/lib/libulpt/ulpt_at_usb.c7
-rw-r--r--sys/rump/dev/lib/libumass/umass_component.c7
-rw-r--r--sys/rump/dev/lib/libwscons/wscons_component.c7
-rw-r--r--sys/rump/kern/lib/libsys_cygwin/rump_cygwin_compat.c4
-rw-r--r--sys/rump/kern/lib/libsys_cygwin/sys_cygwin_component.c7
-rw-r--r--sys/rump/kern/lib/libsys_linux/linux_rump.c7
-rw-r--r--sys/rump/kern/lib/libsys_linux/sys_linux_component.c7
-rw-r--r--sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c4
-rw-r--r--sys/rump/kern/lib/libsys_sunos/sys_sunos_component.c7
-rw-r--r--sys/rump/librump/rumpkern/Makefile.rumpkern3
-rw-r--r--sys/rump/librump/rumpkern/arch/generic/rump_generic_directmap.c4
-rw-r--r--sys/rump/librump/rumpkern/rump_syscalls.c25
-rw-r--r--sys/rump/net/lib/libpppoe/Makefile2
-rw-r--r--sys/rump/net/lib/libshmif/shmif_user.c4
-rw-r--r--sys/rump/net/lib/libsockin/sockin_user.c4
-rw-r--r--sys/rump/net/lib/libvirtif/virtif_user.c4
-rw-r--r--sys/sys/compat_stub.h320
-rw-r--r--sys/sys/exec.h8
-rw-r--r--sys/sys/module.h44
-rw-r--r--sys/sys/module_hook.h150
-rw-r--r--sys/sys/param.h4
-rw-r--r--sys/sys/tty.h7
-rw-r--r--sys/uvm/uvm_swap.c6
396 files changed, 14683 insertions, 5036 deletions
diff --git a/sys/arch/aarch64/aarch64/aarch64_machdep.c b/sys/arch/aarch64/aarch64/aarch64_machdep.c
index 70988fd55d4..217d9c96294 100644
--- a/sys/arch/aarch64/aarch64/aarch64_machdep.c
+++ b/sys/arch/aarch64/aarch64/aarch64_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.27 2019/01/18 07:05:36 skrll Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.28 2019/01/27 02:08:36 pgoyette Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.27 2019/01/18 07:05:36 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.28 2019/01/27 02:08:36 pgoyette Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
diff --git a/sys/arch/aarch64/aarch64/bus_space.c b/sys/arch/aarch64/aarch64/bus_space.c
index 452d99be0db..2e2951d9cf0 100644
--- a/sys/arch/aarch64/aarch64/bus_space.c
+++ b/sys/arch/aarch64/aarch64/bus_space.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.7 2018/11/19 10:45:47 jmcneill Exp $ */
+/* $NetBSD: bus_space.c,v 1.8 2019/01/27 02:08:36 pgoyette Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.7 2018/11/19 10:45:47 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.8 2019/01/27 02:08:36 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/arch/aarch64/aarch64/db_disasm.c b/sys/arch/aarch64/aarch64/db_disasm.c
index 99c740afa71..4a393f245c2 100644
--- a/sys/arch/aarch64/aarch64/db_disasm.c
+++ b/sys/arch/aarch64/aarch64/db_disasm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.5 2018/10/12 01:28:57 ryo Exp $ */
+/* $NetBSD: db_disasm.c,v 1.6 2019/01/27 02:08:36 pgoyette Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.5 2018/10/12 01:28:57 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.6 2019/01/27 02:08:36 pgoyette Exp $");
#include <sys/param.h>
#include <machine/db_machdep.h>
diff --git a/sys/arch/aarch64/aarch64/db_interface.c b/sys/arch/aarch64/aarch64/db_interface.c
index a1c25aa467f..9c81d504329 100644
--- a/sys/arch/aarch64/aarch64/db_interface.c
+++ b/sys/arch/aarch64/aarch64/db_interface.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.6 2018/09/15 23:03:27 ryo Exp $ */
+/* $NetBSD: db_interface.c,v 1.7 2019/01/27 02:08:36 pgoyette Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.6 2018/09/15 23:03:27 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.7 2019/01/27 02:08:36 pgoyette Exp $");
#include <sys/param.h>
#include <sys/types.h>
diff --git a/sys/arch/aarch64/aarch64/db_machdep.c b/sys/arch/aarch64/aarch64/db_machdep.c
index b76b8f9d15c..2cfeb592b49 100644
--- a/sys/arch/aarch64/aarch64/db_machdep.c
+++ b/sys/arch/aarch64/aarch64/db_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.13 2018/12/27 09:55:27 mrg Exp $ */
+/* $NetBSD: db_machdep.c,v 1.14 2019/01/27 02:08:36 pgoyette Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.13 2018/12/27 09:55:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.14 2019/01/27 02:08:36 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd32.h"
diff --git a/sys/arch/aarch64/aarch64/db_trace.c b/sys/arch/aarch64/aarch64/db_trace.c
index 3916262a088..cda725858fc 100644
--- a/sys/arch/aarch64/aarch64/db_trace.c
+++ b/sys/arch/aarch64/aarch64/db_trace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.7 2018/12/27 09:55:27 mrg Exp $ */
+/* $NetBSD: db_trace.c,v 1.8 2019/01/27 02:08:36 pgoyette Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.7 2018/12/27 09:55:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.8 2019/01/27 02:08:36 pgoyette Exp $");
#include <sys/param.h>
#include <sys/proc.h>
diff --git a/sys/arch/aarch64/aarch64/idle_machdep.S b/sys/arch/aarch64/aarch64/idle_machdep.S
index fbe0549449b..bcea1a14919 100644
--- a/sys/arch/aarch64/aarch64/idle_machdep.S
+++ b/sys/arch/aarch64/aarch64/idle_machdep.S
@@ -1,4 +1,4 @@
-/* $NetBSD: idle_machdep.S,v 1.3 2018/12/12 11:14:51 ryo Exp $ */
+/* $NetBSD: idle_machdep.S,v 1.4 2019/01/27 02:08:36 pgoyette Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -35,7 +35,6 @@
#include "opt_arm_intr_impl.h"
#include "opt_ddb.h"
-RCSID("$NetBSD: idle_machdep.S,v 1.3 2018/12/12 11:14:51 ryo Exp $");
#ifdef ARM_INTR_IMPL
#include ARM_INTR_IMPL
diff --git a/sys/arch/aarch64/aarch64/locore.S b/sys/arch/aarch64/aarch64/locore.S
index 9351224ada1..d292079f00c 100644
--- a/sys/arch/aarch64/aarch64/locore.S
+++ b/sys/arch/aarch64/aarch64/locore.S
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.32 2018/12/13 10:44:25 ryo Exp $ */
+/* $NetBSD: locore.S,v 1.33 2019/01/27 02:08:36 pgoyette Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@@ -39,7 +39,7 @@
#include <aarch64/hypervisor.h>
#include "assym.h"
-RCSID("$NetBSD: locore.S,v 1.32 2018/12/13 10:44:25 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.33 2019/01/27 02:08:36 pgoyette Exp $")
/*#define DEBUG_LOCORE /* debug print */
@@ -548,7 +548,6 @@ ENTRY_NP(uartputs)
ret
END(uartputs)
-
/*
* print x0 in 16 widths hexadecimal.
*
diff --git a/sys/arch/aarch64/aarch64/netbsd32_machdep.c b/sys/arch/aarch64/aarch64/netbsd32_machdep.c
index 72ff8667adb..f4265cbd605 100644
--- a/sys/arch/aarch64/aarch64/netbsd32_machdep.c
+++ b/sys/arch/aarch64/aarch64/netbsd32_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.3 2018/11/27 14:09:53 maxv Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.4 2019/01/27 02:08:36 pgoyette Exp $ */
/*
* Copyright (c) 2018 Ryo Shimizu <ryo@nerv.org>
@@ -27,9 +27,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.3 2018/11/27 14:09:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.4 2019/01/27 02:08:36 pgoyette Exp $");
+#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
+#endif
#include <sys/param.h>
#include <sys/core.h>
@@ -537,3 +539,17 @@ netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t sz,
else
return VM_DEFAULT_ADDRESS32_BOTTOMUP(base, sz);
}
+
+void
+netbsd32_machdep_md_init(void)
+{
+
+ /* nothing to do */
+}
+
+void
+netbsd32_machdep_md_fini(void)
+{
+
+ /* nothing to do */
+}
diff --git a/sys/compat/common/if_43.h b/sys/arch/aarch64/aarch64/netbsd32_machdep_13.c
index e21c954681b..04d84e726f1 100644
--- a/sys/compat/common/if_43.h
+++ b/sys/arch/aarch64/aarch64/netbsd32_machdep_13.c
@@ -1,7 +1,5 @@
-/* $NetBSD: if_43.h,v 1.1 2016/11/05 23:30:22 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 +27,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _COMPAT_IF_43_H_
-#define _COMPAT_IF_43_H_
+#include <sys/cdefs.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 *);
+__KERNEL_RCSID(1, "$NetBSD: netbsd32_machdep_13.c,v 1.2 2019/01/27 02:08:36 pgoyette Exp $");
-void if_43_init(void);
-void if_43_fini(void);
+#if defined (_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
#endif
-#endif /* !_COMPAT_IF_43_H_ */
+void
+netbsd32_machdep_md_13_init(void)
+{
+
+ /* nothing to do */
+}
+
+void
+netbsd32_machdep_md_13_fini(void)
+{
+
+ /* nothing to do */
+}
diff --git a/sys/arch/aarch64/aarch64/netbsd32_machdep_16.c b/sys/arch/aarch64/aarch64/netbsd32_machdep_16.c
new file mode 100644
index 00000000000..7fc0edcfd5f
--- /dev/null
+++ b/sys/arch/aarch64/aarch64/netbsd32_machdep_16.c
@@ -0,0 +1,50 @@
+/*-
+ * 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(1, "$NetBSD: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:36 pgoyette Exp $");
+
+#if defined (_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+void
+netbsd32_machdep_md_16_init(void)
+{
+
+ /* nothing to do */
+}
+
+void
+netbsd32_machdep_md_16_fini(void)
+{
+
+ /* nothing to do */
+}
diff --git a/sys/arch/aarch64/aarch64/trap.c b/sys/arch/aarch64/aarch64/trap.c
index ecef639781d..934494047ba 100644
--- a/sys/arch/aarch64/aarch64/trap.c
+++ b/sys/arch/aarch64/aarch64/trap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.14 2018/12/13 10:44:25 ryo Exp $ */
+/* $NetBSD: trap.c,v 1.15 2019/01/27 02:08:36 pgoyette Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,10 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.14 2018/12/13 10:44:25 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.15 2019/01/27 02:08:36 pgoyette Exp $");
+
+#include "opt_arm_intr_impl.h"
+#include "opt_compat_netbsd32.h"
#include "opt_arm_intr_impl.h"
#include "opt_compat_netbsd32.h"
diff --git a/sys/arch/aarch64/conf/files.aarch64 b/sys/arch/aarch64/conf/files.aarch64
index 553d3a0f284..a7beee3b252 100644
--- a/sys/arch/aarch64/conf/files.aarch64
+++ b/sys/arch/aarch64/conf/files.aarch64
@@ -1,4 +1,4 @@
-# $NetBSD: files.aarch64,v 1.12 2018/12/05 22:42:27 jmcneill Exp $
+# $NetBSD: files.aarch64,v 1.13 2019/01/27 02:08:36 pgoyette Exp $
defflag opt_cpuoptions.h AARCH64_ALIGNMENT_CHECK
defflag opt_cpuoptions.h AARCH64_EL0_STACK_ALIGNMENT_CHECK
@@ -127,8 +127,6 @@ file arch/aarch64/aarch64/efi_machdep.c efi_runtime
include "compat/netbsd32/files.netbsd32"
file arch/aarch64/aarch64/netbsd32_machdep.c compat_netbsd32
file arch/aarch64/aarch64/netbsd32_syscall.c compat_netbsd32
-#file arch/aarch64/aarch32/compat_13_machdep.c compat_13 & compat_netbsd32
-#file arch/aarch64/aarch32/compat_16_machdep.c compat_16 & compat_netbsd32
# Linux binary compatibility (COMPAT_LINUX)
#include "compat/ossaudio/files.ossaudio"
diff --git a/sys/arch/algor/algor/netbsd32_machdep.c b/sys/arch/algor/algor/netbsd32_machdep.c
new file mode 100644
index 00000000000..f80c1f1609c
--- /dev/null
+++ b/sys/arch/algor/algor/netbsd32_machdep.c
@@ -0,0 +1,59 @@
+/* $NetBSD: netbsd32_machdep.c,v 1.2 2019/01/27 02:08:36 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Frank van der Linden 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: netbsd32_machdep.c,v 1.2 2019/01/27 02:08:36 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <compat/netbsd32/netbsd32.h>
+
+void
+netbsd32_machdep_md_init(void)
+{
+
+ /* nothing to do */
+}
+
+void
+netbsd32_machdep_md_fini(void)
+{
+
+ /* nothing to do */
+}
diff --git a/sys/arch/algor/algor/netbsd32_machdep_16.c b/sys/arch/algor/algor/netbsd32_machdep_16.c
new file mode 100644
index 00000000000..59a2b4d0b51
--- /dev/null
+++ b/sys/arch/algor/algor/netbsd32_machdep_16.c
@@ -0,0 +1,59 @@
+/* $NetBSD: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:36 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Frank van der Linden 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: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:36 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <compat/netbsd32/netbsd32.h>
+
+void
+netbsd32_machdep_md_16_init(void)
+{
+
+ /* nothing to do */
+}
+
+void
+netbsd32_machdep_md_16_fini(void)
+{
+
+ /* nothing to do */
+}
diff --git a/sys/arch/alpha/conf/GENERIC b/sys/arch/alpha/conf/GENERIC
index 66c0fbba613..21997e6d956 100644
--- a/sys/arch/alpha/conf/GENERIC
+++ b/sys/arch/alpha/conf/GENERIC
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.386 2018/09/06 05:36:49 maxv Exp $
+# $NetBSD: GENERIC,v 1.387 2019/01/27 02:08:37 pgoyette Exp $
#
# This machine description file is used to generate the default NetBSD
# kernel.
@@ -19,7 +19,7 @@ include "arch/alpha/conf/std.alpha"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-ident "GENERIC-$Revision: 1.386 $"
+ident "GENERIC-$Revision: 1.387 $"
maxusers 32
@@ -127,7 +127,7 @@ options PPP_FILTER # Active filter support for PPP (requires bpf)
#options ALTQ_WFQ # Weighted Fair Queueing
# Binary compatibility with previous versions of NetBSD.
-include "conf/compat_netbsd10.config"
+include "conf/compat_netbsd09.config"
# OSF/1 binary compatibility
options COMPAT_OSF1
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index b4d9b9a364f..47ea8786359 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.323 2018/12/10 15:08:23 maxv Exp $ */
+/* $NetBSD: machdep.c,v 1.324 2019/01/27 02:08:37 pgoyette Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.323 2018/12/10 15:08:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.324 2019/01/27 02:08:37 pgoyette Exp $");
#include "opt_modular.h"
#include "opt_user_ldt.h"
diff --git a/sys/arch/amd64/amd64/netbsd32_machdep.c b/sys/arch/amd64/amd64/netbsd32_machdep.c
index d62bce406d0..88d0afd805c 100644
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.117 2018/11/27 14:09:53 maxv Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.118 2019/01/27 02:08:37 pgoyette Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,10 +36,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.117 2018/11/27 14:09:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.118 2019/01/27 02:08:37 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
#include "opt_coredump.h"
#include "opt_execfmt.h"
#include "opt_user_ldt.h"
@@ -61,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.117 2018/11/27 14:09:53 maxv
#include <sys/ras.h>
#include <sys/ptrace.h>
#include <sys/kauth.h>
+#include <sys/compat_stub.h>
#include <x86/fpu.h>
#include <x86/dbregs.h>
@@ -101,7 +103,12 @@ static int x86_64_set_mtrr32(struct lwp *, void *, register_t *);
#define x86_64_set_mtrr32(x, y, z) ENOSYS
#endif
-static int check_sigcontext32(struct lwp *, const struct netbsd32_sigcontext *);
+int check_sigcontext32(struct lwp *, const struct netbsd32_sigcontext *);
+
+void netbsd32_buildcontext(struct lwp *l, struct trapframe *tf, void *fp,
+ sig_t catcher, int onstack);
+
+int netbsd32_sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
#ifdef EXEC_AOUT
/*
@@ -160,7 +167,7 @@ netbsd32_setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
tf->tf_ss = LSEL(LUDATA32_SEL, SEL_UPL);
}
-static void
+void
netbsd32_buildcontext(struct lwp *l, struct trapframe *tf, void *fp,
sig_t catcher, int onstack)
{
@@ -197,98 +204,7 @@ netbsd32_buildcontext(struct lwp *l, struct trapframe *tf, void *fp,
}
}
-#ifdef COMPAT_16
-static void
-netbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
-{
- struct lwp *l = curlwp;
- struct proc *p = l->l_proc;
- struct trapframe *tf;
- int sig = ksi->ksi_signo;
- sig_t catcher = SIGACTION(p, sig).sa_handler;
- struct netbsd32_sigframe_sigcontext *fp, frame;
- int onstack, error;
- struct sigacts *ps = p->p_sigacts;
-
- tf = l->l_md.md_regs;
-
- /* Do we need to jump onto the signal stack? */
- onstack =
- (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
- (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
-
- /* Allocate space for the signal handler context. */
- if (onstack)
- fp = (struct netbsd32_sigframe_sigcontext *)
- ((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size);
- else
- fp = (struct netbsd32_sigframe_sigcontext *)tf->tf_rsp;
- fp--;
-
- memset(&frame, 0, sizeof(frame));
-
- /* Build stack frame for signal trampoline. */
- switch (ps->sa_sigdesc[sig].sd_vers) {
- case 0:
- frame.sf_ra = (uint32_t)(u_long)p->p_sigctx.ps_sigcode;
- break;
- case 1:
- frame.sf_ra = (uint32_t)(u_long)ps->sa_sigdesc[sig].sd_tramp;
- break;
- default:
- /* Don't know what trampoline version; kill it. */
- sigexit(l, SIGILL);
- }
- frame.sf_signum = sig;
- frame.sf_code = ksi->ksi_trap;
- frame.sf_scp = (uint32_t)(u_long)&fp->sf_sc;
-
- frame.sf_sc.sc_ds = tf->tf_ds & 0xFFFF;
- frame.sf_sc.sc_es = tf->tf_es & 0xFFFF;
- frame.sf_sc.sc_fs = tf->tf_fs & 0xFFFF;
- frame.sf_sc.sc_gs = tf->tf_gs & 0xFFFF;
-
- frame.sf_sc.sc_eflags = tf->tf_rflags;
- frame.sf_sc.sc_edi = tf->tf_rdi;
- frame.sf_sc.sc_esi = tf->tf_rsi;
- frame.sf_sc.sc_ebp = tf->tf_rbp;
- frame.sf_sc.sc_ebx = tf->tf_rbx;
- frame.sf_sc.sc_edx = tf->tf_rdx;
- frame.sf_sc.sc_ecx = tf->tf_rcx;
- frame.sf_sc.sc_eax = tf->tf_rax;
- frame.sf_sc.sc_eip = tf->tf_rip;
- frame.sf_sc.sc_cs = tf->tf_cs & 0xFFFF;
- frame.sf_sc.sc_esp = tf->tf_rsp;
- frame.sf_sc.sc_ss = tf->tf_ss & 0xFFFF;
- frame.sf_sc.sc_trapno = tf->tf_trapno;
- frame.sf_sc.sc_err = tf->tf_err;
-
- /* Save signal stack. */
- frame.sf_sc.sc_onstack = l->l_sigstk.ss_flags & SS_ONSTACK;
-
- /* Save signal mask. */
- frame.sf_sc.sc_mask = *mask;
-
- sendsig_reset(l, sig);
-
- mutex_exit(p->p_lock);
- error = copyout(&frame, fp, sizeof(frame));
- mutex_enter(p->p_lock);
-
- if (error != 0) {
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
- sigexit(l, SIGILL);
- /* NOTREACHED */
- }
-
- netbsd32_buildcontext(l, tf, fp, catcher, onstack);
-}
-#endif
-
-static void
+int
netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
{
struct lwp *l = curlwp;
@@ -354,79 +270,20 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
}
netbsd32_buildcontext(l, tf, fp, catcher, onstack);
+
+ return 0;
}
+struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
+
void
netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
-#ifdef COMPAT_16
- if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2)
- netbsd32_sendsig_sigcontext(ksi, mask);
- else
-#endif
- netbsd32_sendsig_siginfo(ksi, mask);
-}
-int
-compat_16_netbsd32___sigreturn14(struct lwp *l, const struct compat_16_netbsd32___sigreturn14_args *uap, register_t *retval)
-{
- /* {
- syscallarg(netbsd32_sigcontextp_t) sigcntxp;
- } */
- struct netbsd32_sigcontext *scp, context;
- struct proc *p = l->l_proc;
- struct trapframe *tf;
- int error;
-
- /*
- * The trampoline code hands us the context.
- * It is unsafe to keep track of it ourselves, in the event that a
- * program jumps out of a signal handler.
- */
- scp = NETBSD32PTR64(SCARG(uap, sigcntxp));
- if (copyin(scp, &context, sizeof(*scp)) != 0)
- return (EFAULT);
-
- /*
- * Check for security violations.
- */
- error = check_sigcontext32(l, &context);
- if (error != 0)
- return error;
-
- /* Restore register context. */
- tf = l->l_md.md_regs;
- tf->tf_ds = context.sc_ds & 0xFFFF;
- tf->tf_es = context.sc_es & 0xFFFF;
- cpu_fsgs_reload(l, context.sc_fs, context.sc_gs);
- tf->tf_rflags = context.sc_eflags;
- tf->tf_rdi = context.sc_edi;
- tf->tf_rsi = context.sc_esi;
- tf->tf_rbp = context.sc_ebp;
- tf->tf_rbx = context.sc_ebx;
- tf->tf_rdx = context.sc_edx;
- tf->tf_rcx = context.sc_ecx;
- tf->tf_rax = context.sc_eax;
-
- tf->tf_rip = context.sc_eip;
- tf->tf_cs = context.sc_cs & 0xFFFF;
- tf->tf_rsp = context.sc_esp;
- tf->tf_ss = context.sc_ss & 0xFFFF;
-
- mutex_enter(p->p_lock);
- /* Restore signal stack. */
- if (context.sc_onstack & SS_ONSTACK)
- l->l_sigstk.ss_flags |= SS_ONSTACK;
- else
- l->l_sigstk.ss_flags &= ~SS_ONSTACK;
- /* Restore signal mask. */
- (void) sigprocmask1(l, SIG_SETMASK, &context.sc_mask, 0);
- mutex_exit(p->p_lock);
-
- return (EJUSTRETURN);
+ MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook, (ksi, mask),
+ netbsd32_sendsig_siginfo(ksi, mask));
}
-
#ifdef COREDUMP
/*
* Dump the machine specific segment at the start of a core dump.
@@ -1025,7 +882,7 @@ startlwp32(void *arg)
* These functions perform the needed checks.
*/
-static int
+int
check_sigcontext32(struct lwp *l, const struct netbsd32_sigcontext *scp)
{
struct pmap *pmap = l->l_proc->p_vmspace->vm_map.pmap;
@@ -1113,66 +970,23 @@ netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t sz,
return VM_DEFAULT_ADDRESS32_BOTTOMUP(base, sz);
}
-#ifdef COMPAT_13
-int
-compat_13_netbsd32_sigreturn(struct lwp *l, const struct compat_13_netbsd32_sigreturn_args *uap, register_t *retval)
+static const char *
+netbsd32_machine32(void)
{
- /* {
- syscallarg(struct netbsd32_sigcontext13 *) sigcntxp;
- } */
- struct proc *p = l->l_proc;
- struct netbsd32_sigcontext13 *scp, context;
- struct trapframe *tf;
- sigset_t mask;
- int error;
- /*
- * The trampoline code hands us the context.
- * It is unsafe to keep track of it ourselves, in the event that a
- * program jumps out of a signal handler.
- */
- scp = (struct netbsd32_sigcontext13 *)NETBSD32PTR64(SCARG(uap, sigcntxp));
- if (copyin((void *)scp, &context, sizeof(*scp)) != 0)
- return (EFAULT);
-
- /* Restore register context. */
- tf = l->l_md.md_regs;
+ return machine32;
+}
- /*
- * Check for security violations.
- */
- error = check_sigcontext32(l, (const struct netbsd32_sigcontext *)&context);
- if (error != 0)
- return error;
+void
+netbsd32_machdep_md_init(void)
+{
- tf->tf_gs = context.sc_gs & 0xFFFF;
- tf->tf_fs = context.sc_fs & 0xFFFF;
- tf->tf_es = context.sc_es & 0xFFFF;
- tf->tf_ds = context.sc_ds & 0xFFFF;
- tf->tf_rflags = context.sc_eflags;
- tf->tf_rdi = context.sc_edi;
- tf->tf_rsi = context.sc_esi;
- tf->tf_rbp = context.sc_ebp;
- tf->tf_rbx = context.sc_ebx;
- tf->tf_rdx = context.sc_edx;
- tf->tf_rcx = context.sc_ecx;
- tf->tf_rax = context.sc_eax;
- tf->tf_rip = context.sc_eip;
- tf->tf_cs = context.sc_cs & 0xFFFF;
- tf->tf_rsp = context.sc_esp;
- tf->tf_ss = context.sc_ss & 0xFFFF;
+ MODULE_SET_HOOK(netbsd32_machine32_hook, "mach32", netbsd32_machine32);
+}
- mutex_enter(p->p_lock);
- /* Restore signal stack. */
- if (context.sc_onstack & SS_ONSTACK)
- l->l_sigstk.ss_flags |= SS_ONSTACK;
- else
- l->l_sigstk.ss_flags &= ~SS_ONSTACK;
- /* Restore signal mask. */
- native_sigset13_to_sigset((sigset13_t *)&context.sc_mask, &mask);
- (void) sigprocmask1(l, SIG_SETMASK, &mask, 0);
- mutex_exit(p->p_lock);
+void
+netbsd32_machdep_md_fini(void)
+{
- return (EJUSTRETURN);
+ MODULE_UNSET_HOOK(netbsd32_machine32_hook);
}
-#endif
diff --git a/sys/arch/amd64/amd64/netbsd32_machdep_13.c b/sys/arch/amd64/amd64/netbsd32_machdep_13.c
new file mode 100644
index 00000000000..fa0159971e9
--- /dev/null
+++ b/sys/arch/amd64/amd64/netbsd32_machdep_13.c
@@ -0,0 +1,160 @@
+/* $NetBSD: netbsd32_machdep_13.c,v 1.2 2019/01/27 02:08:37 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Frank van der Linden 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: netbsd32_machdep_13.c,v 1.2 2019/01/27 02:08:37 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_coredump.h"
+#include "opt_execfmt.h"
+#include "opt_user_ldt.h"
+#include "opt_mtrr.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/exec.h>
+#include <sys/exec_aout.h>
+#include <sys/kmem.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/signalvar.h>
+#include <sys/systm.h>
+#include <sys/core.h>
+#include <sys/mount.h>
+#include <sys/buf.h>
+#include <sys/vnode.h>
+#include <sys/ras.h>
+#include <sys/ptrace.h>
+#include <sys/kauth.h>
+
+#include <x86/fpu.h>
+#include <x86/dbregs.h>
+#include <machine/frame.h>
+#include <machine/reg.h>
+#include <machine/vmparam.h>
+#ifdef MTRR
+#include <machine/mtrr.h>
+#endif
+#include <machine/netbsd32_machdep.h>
+#include <machine/sysarch.h>
+#include <machine/userret.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_exec.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+
+#include <compat/sys/signal.h>
+#include <compat/sys/signalvar.h>
+
+int check_sigcontext32(struct lwp *, const struct netbsd32_sigcontext *);
+
+int
+compat_13_netbsd32_sigreturn(struct lwp *l, const struct compat_13_netbsd32_sigreturn_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(struct netbsd32_sigcontext13 *) sigcntxp;
+ } */
+ struct proc *p = l->l_proc;
+ struct netbsd32_sigcontext13 *scp, context;
+ struct trapframe *tf;
+ sigset_t mask;
+ int error;
+
+ /*
+ * The trampoline code hands us the context.
+ * It is unsafe to keep track of it ourselves, in the event that a
+ * program jumps out of a signal handler.
+ */
+ scp = (struct netbsd32_sigcontext13 *)NETBSD32PTR64(SCARG(uap, sigcntxp));
+ if (copyin((void *)scp, &context, sizeof(*scp)) != 0)
+ return (EFAULT);
+
+ /* Restore register context. */
+ tf = l->l_md.md_regs;
+
+ /*
+ * Check for security violations.
+ */
+ error = check_sigcontext32(l, (const struct netbsd32_sigcontext *)&context);
+ if (error != 0)
+ return error;
+
+ tf->tf_gs = context.sc_gs & 0xFFFF;
+ tf->tf_fs = context.sc_fs & 0xFFFF;
+ tf->tf_es = context.sc_es & 0xFFFF;
+ tf->tf_ds = context.sc_ds & 0xFFFF;
+ tf->tf_rflags = context.sc_eflags;
+ tf->tf_rdi = context.sc_edi;
+ tf->tf_rsi = context.sc_esi;
+ tf->tf_rbp = context.sc_ebp;
+ tf->tf_rbx = context.sc_ebx;
+ tf->tf_rdx = context.sc_edx;
+ tf->tf_rcx = context.sc_ecx;
+ tf->tf_rax = context.sc_eax;
+ tf->tf_rip = context.sc_eip;
+ tf->tf_cs = context.sc_cs & 0xFFFF;
+ tf->tf_rsp = context.sc_esp;
+ tf->tf_ss = context.sc_ss & 0xFFFF;
+
+ mutex_enter(p->p_lock);
+ /* Restore signal stack. */
+ if (context.sc_onstack & SS_ONSTACK)
+ l->l_sigstk.ss_flags |= SS_ONSTACK;
+ else
+ l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+ /* Restore signal mask. */
+ native_sigset13_to_sigset((sigset13_t *)&context.sc_mask, &mask);
+ (void) sigprocmask1(l, SIG_SETMASK, &mask, 0);
+ mutex_exit(p->p_lock);
+
+ return (EJUSTRETURN);
+}
+
+void
+netbsd32_machdep_md_13_init(void)
+{
+
+ /* Nothing to do */
+}
+
+void
+netbsd32_machdep_md_13_fini(void)
+{
+
+ /* Nothing to do */
+}
diff --git a/sys/arch/amd64/amd64/netbsd32_machdep_16.c b/sys/arch/amd64/amd64/netbsd32_machdep_16.c
new file mode 100644
index 00000000000..02457e49ff1
--- /dev/null
+++ b/sys/arch/amd64/amd64/netbsd32_machdep_16.c
@@ -0,0 +1,262 @@
+/* $NetBSD: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:37 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Frank van der Linden 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: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:37 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_coredump.h"
+#include "opt_execfmt.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/exec.h>
+#include <sys/exec_aout.h>
+#include <sys/kmem.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/signalvar.h>
+#include <sys/systm.h>
+#include <sys/core.h>
+#include <sys/mount.h>
+#include <sys/buf.h>
+#include <sys/vnode.h>
+#include <sys/ras.h>
+#include <sys/ptrace.h>
+#include <sys/kauth.h>
+#include <sys/module_hook.h>
+
+#include <x86/fpu.h>
+#include <x86/dbregs.h>
+#include <machine/frame.h>
+#include <machine/reg.h>
+#include <machine/vmparam.h>
+#include <machine/netbsd32_machdep.h>
+#include <machine/sysarch.h>
+#include <machine/userret.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_exec.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+
+#include <compat/sys/signal.h>
+#include <compat/sys/signalvar.h>
+
+void netbsd32_buildcontext(struct lwp *, struct trapframe *, void *,
+ sig_t, int);
+
+void netbsd32_sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
+
+int check_sigcontext32(struct lwp *, const struct netbsd32_sigcontext *);
+
+void netbsd32_sendsig_16(const ksiginfo_t *, const sigset_t *);
+
+extern struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
+
+static void
+netbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
+{
+ struct lwp *l = curlwp;
+ struct proc *p = l->l_proc;
+ struct trapframe *tf;
+ int sig = ksi->ksi_signo;
+ sig_t catcher = SIGACTION(p, sig).sa_handler;
+ struct netbsd32_sigframe_sigcontext *fp, frame;
+ int onstack, error;
+ struct sigacts *ps = p->p_sigacts;
+
+ tf = l->l_md.md_regs;
+
+ /* Do we need to jump onto the signal stack? */
+ onstack =
+ (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
+ (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
+
+ /* Allocate space for the signal handler context. */
+ if (onstack)
+ fp = (struct netbsd32_sigframe_sigcontext *)
+ ((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size);
+ else
+ fp = (struct netbsd32_sigframe_sigcontext *)tf->tf_rsp;
+ fp--;
+
+ memset(&frame, 0, sizeof(frame));
+
+ /* Build stack frame for signal trampoline. */
+ switch (ps->sa_sigdesc[sig].sd_vers) {
+ case 0:
+ frame.sf_ra = (uint32_t)(u_long)p->p_sigctx.ps_sigcode;
+ break;
+ case 1:
+ frame.sf_ra = (uint32_t)(u_long)ps->sa_sigdesc[sig].sd_tramp;
+ break;
+ default:
+ /* Don't know what trampoline version; kill it. */
+ sigexit(l, SIGILL);
+ }
+ frame.sf_signum = sig;
+ frame.sf_code = ksi->ksi_trap;
+ frame.sf_scp = (uint32_t)(u_long)&fp->sf_sc;
+
+ frame.sf_sc.sc_ds = tf->tf_ds & 0xFFFF;
+ frame.sf_sc.sc_es = tf->tf_es & 0xFFFF;
+ frame.sf_sc.sc_fs = tf->tf_fs & 0xFFFF;
+ frame.sf_sc.sc_gs = tf->tf_gs & 0xFFFF;
+
+ frame.sf_sc.sc_eflags = tf->tf_rflags;
+ frame.sf_sc.sc_edi = tf->tf_rdi;
+ frame.sf_sc.sc_esi = tf->tf_rsi;
+ frame.sf_sc.sc_ebp = tf->tf_rbp;
+ frame.sf_sc.sc_ebx = tf->tf_rbx;
+ frame.sf_sc.sc_edx = tf->tf_rdx;
+ frame.sf_sc.sc_ecx = tf->tf_rcx;
+ frame.sf_sc.sc_eax = tf->tf_rax;
+ frame.sf_sc.sc_eip = tf->tf_rip;
+ frame.sf_sc.sc_cs = tf->tf_cs & 0xFFFF;
+ frame.sf_sc.sc_esp = tf->tf_rsp;
+ frame.sf_sc.sc_ss = tf->tf_ss & 0xFFFF;
+ frame.sf_sc.sc_trapno = tf->tf_trapno;
+ frame.sf_sc.sc_err = tf->tf_err;
+
+ /* Save signal stack. */
+ frame.sf_sc.sc_onstack = l->l_sigstk.ss_flags & SS_ONSTACK;
+
+ /* Save signal mask. */
+ frame.sf_sc.sc_mask = *mask;
+
+ sendsig_reset(l, sig);
+
+ mutex_exit(p->p_lock);
+ error = copyout(&frame, fp, sizeof(frame));
+ mutex_enter(p->p_lock);
+
+ if (error != 0) {
+ /*
+ * Process has trashed its stack; give it an illegal
+ * instruction to halt it in its tracks.
+ */
+ sigexit(l, SIGILL);
+ /* NOTREACHED */
+ }
+
+ netbsd32_buildcontext(l, tf, fp, catcher, onstack);
+}
+
+void
+netbsd32_sendsig_16(const ksiginfo_t *ksi, const sigset_t *mask)
+{
+ if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2)
+ netbsd32_sendsig_sigcontext(ksi, mask);
+ else
+ netbsd32_sendsig_siginfo(ksi, mask);
+}
+
+int
+compat_16_netbsd32___sigreturn14(struct lwp *l,
+ const struct compat_16_netbsd32___sigreturn14_args *uap,
+ register_t *retval)
+{
+ /* {
+ syscallarg(netbsd32_sigcontextp_t) sigcntxp;
+ } */
+ struct netbsd32_sigcontext *scp, context;
+ struct proc *p = l->l_proc;
+ struct trapframe *tf;
+ int error;
+
+ /*
+ * The trampoline code hands us the context.
+ * It is unsafe to keep track of it ourselves, in the event that a
+ * program jumps out of a signal handler.
+ */
+ scp = NETBSD32PTR64(SCARG(uap, sigcntxp));
+ if (copyin(scp, &context, sizeof(*scp)) != 0)
+ return (EFAULT);
+
+ /*
+ * Check for security violations.
+ */
+ error = check_sigcontext32(l, &context);
+ if (error != 0)
+ return error;
+
+ /* Restore register context. */
+ tf = l->l_md.md_regs;
+ tf->tf_ds = context.sc_ds & 0xFFFF;
+ tf->tf_es = context.sc_es & 0xFFFF;
+ cpu_fsgs_reload(l, context.sc_fs, context.sc_gs);
+ tf->tf_rflags = context.sc_eflags;
+ tf->tf_rdi = context.sc_edi;
+ tf->tf_rsi = context.sc_esi;
+ tf->tf_rbp = context.sc_ebp;
+ tf->tf_rbx = context.sc_ebx;
+ tf->tf_rdx = context.sc_edx;
+ tf->tf_rcx = context.sc_ecx;
+ tf->tf_rax = context.sc_eax;
+
+ tf->tf_rip = context.sc_eip;
+ tf->tf_cs = context.sc_cs & 0xFFFF;
+ tf->tf_rsp = context.sc_esp;
+ tf->tf_ss = context.sc_ss & 0xFFFF;
+
+ mutex_enter(p->p_lock);
+ /* Restore signal stack. */
+ if (context.sc_onstack & SS_ONSTACK)
+ l->l_sigstk.ss_flags |= SS_ONSTACK;
+ else
+ l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+ /* Restore signal mask. */
+ (void) sigprocmask1(l, SIG_SETMASK, &context.sc_mask, 0);
+ mutex_exit(p->p_lock);
+
+ return (EJUSTRETURN);
+}
+
+void
+netbsd32_machdep_md_16_init(void)
+{
+
+ MODULE_SET_HOOK(netbsd32_sendsig_hook, "nb32_16", netbsd32_sendsig_16);
+}
+
+void
+netbsd32_machdep_md_16_fini(void)
+{
+
+ MODULE_UNSET_HOOK(netbsd32_sendsig_hook);
+}
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index f1cb39209b7..438268663ad 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.114 2018/07/26 09:29:08 maxv Exp $ */
+/* $NetBSD: trap.c,v 1.115 2019/01/27 02:08:37 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.114 2018/07/26 09:29:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.115 2019/01/27 02:08:37 pgoyette Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -351,6 +351,11 @@ trap(struct trapframe *frame)
case T_PROTFLT|T_USER: /* protection fault */
#if defined(COMPAT_NETBSD32) && defined(COMPAT_10)
+
+/*
+ * XXX This code currently not included in loadable module; it is
+ * only included in built-in modules.
+ */
{
static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
const size_t sz = sizeof(lcall);
diff --git a/sys/arch/amd64/conf/NOCOMPAT b/sys/arch/amd64/conf/NOCOMPAT
new file mode 100644
index 00000000000..d4fc96db5ad
--- /dev/null
+++ b/sys/arch/amd64/conf/NOCOMPAT
@@ -0,0 +1,38 @@
+include "arch/amd64/conf/GENERIC"
+
+#ident "NOCOMPAT-$Revision: 1.2 $"
+
+no options SYSVMSG # System V-like message queues
+no options SYSVSEM # System V-like semaphores
+no options SYSVSHM # System V-like memory sharing
+
+no options COMPAT_43
+no options COMPAT_44
+no options COMPAT_BSDPTY
+
+# We only to use ``no options COMPAT_15'' because only COMPAT_15 is
+# explicitly enabled. (The others are pulled in by statements in
+# sys/conf/files)
+
+#no options COMPAT_09
+#no options COMPAT_10
+#no options COMPAT_11
+#no options COMPAT_12
+#no options COMPAT_13
+#no options COMPAT_14
+no options COMPAT_15
+#no options COMPAT_16
+#no options COMPAT_20
+#no options COMPAT_30
+#no options COMPAT_40
+#no options COMPAT_50
+#no options COMPAT_60
+#no options COMPAT_70
+#no options COMPAT_80
+
+no options COMPAT_OSSAUDIO
+no options COMPAT_NETBSD32
+no options COMPAT_LINUX
+no options COMPAT_LINUX32 # requires COMPAT_LINUX and COMPAT_NETBSD32
+ # and COMPAT_50 (or older)
+no options EXEC_ELF32 # requires COMPAT_NETBSD32
diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64
index 5778f547280..ecbf38810cf 100644
--- a/sys/arch/amd64/conf/files.amd64
+++ b/sys/arch/amd64/conf/files.amd64
@@ -1,4 +1,4 @@
-# $NetBSD: files.amd64,v 1.110 2018/12/22 07:45:58 cherry Exp $
+# $NetBSD: files.amd64,v 1.111 2019/01/27 02:08:37 pgoyette Exp $
#
# new style config file for amd64 architecture
#
@@ -145,6 +145,8 @@ file arch/amd64/amd64/compat_16_machdep.c compat_16
# NetBSD/i386 32-bit binary compatibility (COMPAT_NETBSD32)
include "compat/netbsd32/files.netbsd32"
file arch/amd64/amd64/netbsd32_machdep.c compat_netbsd32
+file arch/amd64/amd64/netbsd32_machdep_13.c compat_netbsd32 & compat_13
+file arch/amd64/amd64/netbsd32_machdep_16.c compat_netbsd32 & compat_16
file arch/amd64/amd64/netbsd32_sigcode.S compat_netbsd32 & compat_16
file arch/amd64/amd64/netbsd32_syscall.c compat_netbsd32
diff --git a/sys/arch/amiga/stand/loadkmap/din/Makefile b/sys/arch/amiga/stand/loadkmap/din/Makefile
index 4240d108e53..4b63e934371 100644
--- a/sys/arch/amiga/stand/loadkmap/din/Makefile
+++ b/sys/arch/amiga/stand/loadkmap/din/Makefile
@@ -1,4 +1,5 @@
-# $NetBSD: Makefile,v 1.10 2018/05/04 00:33:48 christos Exp $
+# $NetBSD: Makefile,v 1.11 2019/01/27 02:08:37 pgoyette Exp $
+
HOSTPROG= din-kbdmap
diff --git a/sys/arch/arm/arm32/arm11_pmc.c b/sys/arch/arm/arm32/arm11_pmc.c
index d51f8958c7e..9a42847cbe0 100644
--- a/sys/arch/arm/arm32/arm11_pmc.c
+++ b/sys/arch/arm/arm32/arm11_pmc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: arm11_pmc.c,v 1.5 2018/07/12 10:46:42 maxv Exp $ */
+/* $NetBSD: arm11_pmc.c,v 1.6 2019/01/27 02:08:37 pgoyette Exp $ */
/* Copyright (c) 2007 Microsoft
* All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm11_pmc.c,v 1.5 2018/07/12 10:46:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm11_pmc.c,v 1.6 2019/01/27 02:08:37 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/arch/arm/arm32/arm32_boot.c b/sys/arch/arm/arm32/arm32_boot.c
index 37611865c22..3e697c3a151 100644
--- a/sys/arch/arm/arm32/arm32_boot.c
+++ b/sys/arch/arm/arm32/arm32_boot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_boot.c,v 1.31 2019/01/25 18:31:44 skrll Exp $ */
+/* $NetBSD: arm32_boot.c,v 1.32 2019/01/27 02:08:37 pgoyette Exp $ */
/*
* Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved.
@@ -122,7 +122,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.31 2019/01/25 18:31:44 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.32 2019/01/27 02:08:37 pgoyette Exp $");
#include "opt_arm_debug.h"
#include "opt_cputypes.h"
diff --git a/sys/arch/arm/arm32/cortex_pmc.c b/sys/arch/arm/arm32/cortex_pmc.c
index b90fe544d17..514b8990acc 100644
--- a/sys/arch/arm/arm32/cortex_pmc.c
+++ b/sys/arch/arm/arm32/cortex_pmc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cortex_pmc.c,v 1.6 2018/07/12 10:46:42 maxv Exp $ */
+/* $NetBSD: cortex_pmc.c,v 1.7 2019/01/27 02:08:37 pgoyette Exp $ */
/* Copyright (c) 2007 Microsoft
* All rights reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-/* __KERNEL_RCSID(0, "$NetBSD: cortex_pmc.c,v 1.6 2018/07/12 10:46:42 maxv Exp $"); */
+/* __KERNEL_RCSID(0, "$NetBSD: cortex_pmc.c,v 1.7 2019/01/27 02:08:37 pgoyette Exp $"); */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/arch/arm/arm32/cpu.c b/sys/arch/arm/arm32/cpu.c
index b57e34bfa9b..996ef13538b 100644
--- a/sys/arch/arm/arm32/cpu.c
+++ b/sys/arch/arm/arm32/cpu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.127 2019/01/25 18:31:44 skrll Exp $ */
+/* $NetBSD: cpu.c,v 1.128 2019/01/27 02:08:37 pgoyette Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.127 2019/01/25 18:31:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.128 2019/01/27 02:08:37 pgoyette Exp $");
#include <sys/param.h>
#include <sys/conf.h>
diff --git a/sys/arch/arm/arm32/netbsd32_machdep.c b/sys/arch/arm/arm32/netbsd32_machdep.c
index 66e6f8c370f..f1f49096976 100644
--- a/sys/arch/arm/arm32/netbsd32_machdep.c
+++ b/sys/arch/arm/arm32/netbsd32_machdep.c
@@ -29,9 +29,13 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: netbsd32_machdep.c,v 1.7 2015/11/26 13:15:34 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: netbsd32_machdep.c,v 1.8 2019/01/27 02:08:37 pgoyette Exp $");
+#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
+#include "opt_coredump.h"
+#endif
#include <sys/param.h>
#include <sys/core.h>
@@ -102,31 +106,17 @@ netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t sz,
return VM_DEFAULT_ADDRESS_BOTTOMUP(base, sz);
}
-
-#ifdef COMPAT_13
-int
-compat_13_netbsd32_sigreturn(struct lwp *l,
- const struct compat_13_netbsd32_sigreturn_args *uap,
- register_t *retval)
-{
- struct compat_13_sys_sigreturn_args ua;
-
- NETBSD32TOP_UAP(sigcntxp, struct sigcontext13 *);
-
- return compat_13_sys_sigreturn(l, &ua, retval);
+void
+netbsd32_machdep_md_init(void)
+{
+
+ /* nothing to do */
}
-#endif
-
-#ifdef COMPAT_16
-int
-compat_16_netbsd32___sigreturn14(struct lwp *l,
- const struct compat_16_netbsd32___sigreturn14_args *uap,
- register_t *retval)
+
+void
+netbsd32_machdep_md_fini(void)
{
- struct compat_16_sys___sigreturn14_args ua;
-
- NETBSD32TOP_UAP(sigcntxp, struct sigcontext *);
-
- return compat_16_sys___sigreturn14(l, &ua, retval);
+
+ /* nothing to do */
}
-#endif
+
diff --git a/sys/arch/arm/arm32/netbsd32_machdep_13.c b/sys/arch/arm/arm32/netbsd32_machdep_13.c
new file mode 100644
index 00000000000..ef2a4e1bad8
--- /dev/null
+++ b/sys/arch/arm/arm32/netbsd32_machdep_13.c
@@ -0,0 +1,89 @@
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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(1, "$NetBSD: netbsd32_machdep_13.c,v 1.2 2019/01/27 02:08:37 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
+#include "opt_coredump.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/core.h>
+#include <sys/exec.h>
+#include <sys/lwp.h>
+#include <sys/signalvar.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_exec.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+
+#ifdef COMPAT_13
+int
+compat_13_netbsd32_sigreturn(struct lwp *l,
+ const struct compat_13_netbsd32_sigreturn_args *uap,
+ register_t *retval)
+{
+ struct compat_13_sys_sigreturn_args ua;
+
+ NETBSD32TOP_UAP(sigcntxp, struct sigcontext13 *);
+
+ return compat_13_sys_sigreturn(l, &ua, retval);
+}
+
+static struct syscall_package compat_arm32_netbsd32_13_syscalls[] = {
+ { NETBSD32_SYS_compat_13_sigreturn13, 0,
+ (sy_call_t *)compat_13_netbsd32_sigreturn },
+ { 0, 0, NULL }
+};
+
+void
+netbsd32_machdep_md_13_init(void)
+{
+
+ (void)syscall_establish(&emul_netbsd32,
+ compat_arm32_netbsd32_13_syscalls);
+}
+
+void
+netbsd32_machdep_md_13_fini(void)
+{
+
+ (void)syscall_disestablish(&emul_netbsd32,
+ compat_arm32_netbsd32_13_syscalls);
+}
+#endif
diff --git a/sys/arch/arm/arm32/netbsd32_machdep_16.c b/sys/arch/arm/arm32/netbsd32_machdep_16.c
new file mode 100644
index 00000000000..716ead7a285
--- /dev/null
+++ b/sys/arch/arm/arm32/netbsd32_machdep_16.c
@@ -0,0 +1,90 @@
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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(1, "$NetBSD: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:37 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
+#include "opt_coredump.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/core.h>
+#include <sys/exec.h>
+#include <sys/lwp.h>
+#include <sys/signalvar.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_exec.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+
+#ifdef COMPAT_16
+
+int
+compat_16_netbsd32___sigreturn14(struct lwp *l,
+ const struct compat_16_netbsd32___sigreturn14_args *uap,
+ register_t *retval)
+{
+ struct compat_16_sys___sigreturn14_args ua;
+
+ NETBSD32TOP_UAP(sigcntxp, struct sigcontext *);
+
+ return compat_16_sys___sigreturn14(l, &ua, retval);
+}
+
+static struct syscall_package compat_arm32_netbsd32_16_syscalls[] = {
+ { NETBSD32_SYS_compat_16_netbsd32___sigreturn14, 0,
+ (sy_call_t *)compat_16_netbsd32___sigreturn14 },
+ { 0, 0, NULL }
+};
+
+void
+netbsd32_machdep_md_16_init(void)
+{
+
+ (void)syscall_establish(&emul_netbsd32,
+ compat_arm32_netbsd32_16_syscalls);
+}
+
+void
+netbsd32_machdep_md_16_fini(void)
+{
+
+ (void)syscall_disestablish(&emul_netbsd32,
+ compat_arm32_netbsd32_16_syscalls);
+}
+#endif
diff --git a/sys/arch/arm/conf/files.arm b/sys/arch/arm/conf/files.arm
index d59da28cd63..f9572f3c1ff 100644
--- a/sys/arch/arm/conf/files.arm
+++ b/sys/arch/arm/conf/files.arm
@@ -1,4 +1,4 @@
-# $NetBSD: files.arm,v 1.147 2018/12/05 21:43:33 jmcneill Exp $
+# $NetBSD: files.arm,v 1.148 2019/01/27 02:08:37 pgoyette Exp $
# temporary define to allow easy moving to ../arch/arm/arm32
defflag ARM32
@@ -241,6 +241,11 @@ file arch/arm/arm32/bcopy_page.S arm32
#
include "compat/netbsd32/files.netbsd32"
file arch/arm/arm32/netbsd32_machdep.c arm32 & compat_netbsd32
+file arch/arm/arm32/netbsd32_machdep_16.c arm32 & compat_netbsd32 &
+ compat_16
+file arch/arm/arm32/netbsd32_machdep_13.c arm32 & compat_netbsd32 &
+ compat_13
+
# Linux binary compatibility (COMPAT_LINUX)
include "compat/ossaudio/files.ossaudio"
diff --git a/sys/arch/arm/include/asm.h b/sys/arch/arm/include/asm.h
index d1841ef537d..12f7d1322d5 100644
--- a/sys/arch/arm/include/asm.h
+++ b/sys/arch/arm/include/asm.h
@@ -1,4 +1,33 @@
-/* $NetBSD: asm.h,v 1.28 2018/04/01 04:35:04 ryo Exp $ */
+/* $NetBSD: asm.h,v 1.29 2019/01/27 02:08:37 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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) 2014 The NetBSD Foundation, Inc.
diff --git a/sys/arch/arm/samsung/exynos_platform.c b/sys/arch/arm/samsung/exynos_platform.c
index 7a8e882b4ae..4dff636d3b3 100644
--- a/sys/arch/arm/samsung/exynos_platform.c
+++ b/sys/arch/arm/samsung/exynos_platform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.22 2019/01/04 15:57:03 jmcneill Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.23 2019/01/27 02:08:37 pgoyette Exp $ */
/*-
* Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca>
@@ -35,7 +35,12 @@
#include "ukbd.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.22 2019/01/04 15:57:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.23 2019/01/27 02:08:37 pgoyette Exp $");
+
+/* XXXJDM
+ * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
+ */
+#define EXYNOS5422_DISABLE_CA7_CLUSTER
/* XXXJDM
* Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
diff --git a/sys/arch/arm/sunxi/sunxi_hdmi.c b/sys/arch/arm/sunxi/sunxi_hdmi.c
index 953231be17a..48b0c6cd9bb 100644
--- a/sys/arch/arm/sunxi/sunxi_hdmi.c
+++ b/sys/arch/arm/sunxi/sunxi_hdmi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_hdmi.c,v 1.5 2018/09/03 16:29:24 riastradh Exp $ */
+/* $NetBSD: sunxi_hdmi.c,v 1.6 2019/01/27 02:08:37 pgoyette Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill@invisible.ca>
@@ -29,7 +29,7 @@
#include "opt_ddb.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmi.c,v 1.5 2018/09/03 16:29:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmi.c,v 1.6 2019/01/27 02:08:37 pgoyette Exp $");
#include <sys/param.h>
#include <sys/bus.h>
diff --git a/sys/arch/arm/vfp/vfp_init.c b/sys/arch/arm/vfp/vfp_init.c
index bc296981cc8..62bc8f6020d 100644
--- a/sys/arch/arm/vfp/vfp_init.c
+++ b/sys/arch/arm/vfp/vfp_init.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfp_init.c,v 1.59 2018/08/15 06:00:02 skrll Exp $ */
+/* $NetBSD: vfp_init.c,v 1.60 2019/01/27 02:08:37 pgoyette Exp $ */
/*
* Copyright (c) 2008 ARM Ltd
@@ -32,7 +32,7 @@
#include "opt_cputypes.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.59 2018/08/15 06:00:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.60 2019/01/27 02:08:37 pgoyette Exp $");
#include <sys/param.h>
#include <sys/types.h>
diff --git a/sys/arch/evbarm/conf/files.generic b/sys/arch/evbarm/conf/files.generic
index c020a821a55..4c03a2bbc02 100644
--- a/sys/arch/evbarm/conf/files.generic
+++ b/sys/arch/evbarm/conf/files.generic
@@ -1,4 +1,4 @@
-# $NetBSD: files.generic,v 1.5 2019/01/19 20:56:03 jmcneill Exp $
+# $NetBSD: files.generic,v 1.6 2019/01/27 02:08:38 pgoyette Exp $
#
# A generic (aarch32) kernel configuration info
#
diff --git a/sys/arch/evbarm/conf/files.generic64 b/sys/arch/evbarm/conf/files.generic64
index 0d06c636dc9..afed6199174 100644
--- a/sys/arch/evbarm/conf/files.generic64
+++ b/sys/arch/evbarm/conf/files.generic64
@@ -1,4 +1,4 @@
-# $NetBSD: files.generic64,v 1.9 2018/10/21 00:56:44 jmcneill Exp $
+# $NetBSD: files.generic64,v 1.10 2019/01/27 02:08:38 pgoyette Exp $
#
# A generic (aarch64) kernel configuration info
#
diff --git a/sys/arch/i386/stand/Makefile.inc b/sys/arch/i386/stand/Makefile.inc
index c3e0569ddba..256a0d73614 100644
--- a/sys/arch/i386/stand/Makefile.inc
+++ b/sys/arch/i386/stand/Makefile.inc
@@ -1,4 +1,9 @@
-# $NetBSD: Makefile.inc,v 1.16 2018/07/25 23:45:32 kamil Exp $
+# $NetBSD: Makefile.inc,v 1.17 2019/01/27 02:08:38 pgoyette Exp $
+
+NOLIBCSANITIZER=
+NOSANITIZER=
+NOPIE=
+NOMAN=
NOLIBCSANITIZER=
NOSANITIZER=
diff --git a/sys/arch/i386/stand/genprom/Makefile b/sys/arch/i386/stand/genprom/Makefile
index 0cfbe653f96..d1f18356a01 100644
--- a/sys/arch/i386/stand/genprom/Makefile
+++ b/sys/arch/i386/stand/genprom/Makefile
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.8 2018/05/01 20:15:12 christos Exp $
+# $NetBSD: Makefile,v 1.9 2019/01/27 02:08:38 pgoyette Exp $
+
+.include <bsd.hostinit.mk>
.include <bsd.hostinit.mk>
diff --git a/sys/arch/i386/stand/misc/Makefile b/sys/arch/i386/stand/misc/Makefile
index 2cdf8ae2df8..4b6a0f8b662 100644
--- a/sys/arch/i386/stand/misc/Makefile
+++ b/sys/arch/i386/stand/misc/Makefile
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.9 2018/06/26 10:15:36 martin Exp $
+# $NetBSD: Makefile,v 1.10 2019/01/27 02:08:38 pgoyette Exp $
+
+.include <bsd.hostinit.mk>
.include <bsd.hostinit.mk>
diff --git a/sys/arch/macppc/stand/bootxx/Makefile b/sys/arch/macppc/stand/bootxx/Makefile
index 007fe5afde4..800d97bc226 100644
--- a/sys/arch/macppc/stand/bootxx/Makefile
+++ b/sys/arch/macppc/stand/bootxx/Makefile
@@ -1,4 +1,8 @@
-# $NetBSD: Makefile,v 1.19 2018/12/30 01:54:13 christos Exp $
+# $NetBSD: Makefile,v 1.20 2019/01/27 02:08:38 pgoyette Exp $
+
+NOLIBCSANITIZER=
+NOSANITIZER=
+NOPIE=
NOLIBCSANITIZER=
NOSANITIZER=
diff --git a/sys/arch/mips/cavium/dev/octeon_fpa.c b/sys/arch/mips/cavium/dev/octeon_fpa.c
index a9753a16d00..7fb02ff2ae6 100644
--- a/sys/arch/mips/cavium/dev/octeon_fpa.c
+++ b/sys/arch/mips/cavium/dev/octeon_fpa.c
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_fpa.c,v 1.2 2018/10/04 15:21:23 skrll Exp $ */
+/* $NetBSD: octeon_fpa.c,v 1.3 2019/01/27 02:08:38 pgoyette Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -29,9 +29,7 @@
#undef FPADEBUG
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.2 2018/10/04 15:21:23 skrll Exp $");
-
-#include "opt_octeon.h"
+__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.3 2019/01/27 02:08:38 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/arch/mips/conf/files.mips b/sys/arch/mips/conf/files.mips
index 8ef1a4e9bd2..42cbdeef36e 100644
--- a/sys/arch/mips/conf/files.mips
+++ b/sys/arch/mips/conf/files.mips
@@ -1,4 +1,4 @@
-# $NetBSD: files.mips,v 1.75 2016/07/11 23:06:53 matt Exp $
+# $NetBSD: files.mips,v 1.76 2019/01/27 02:08:38 pgoyette Exp $
#
defflag opt_cputype.h NOFPU FPEMUL
@@ -91,13 +91,20 @@ file arch/mips/mips/bds_emul.S fpemul
file arch/mips/mips/procfs_machdep.c procfs
+#
+# Compatibility modules
+#
+# Binary compatibility with previous NetBSD releases (COMPAT_XX)
+file arch/mips/mips/compat_13_machdep.c compat_13 | compat_ultrix
+file arch/mips/mips/compat_16_machdep.c compat_16 | compat_ultrix
+
# Binary compatibility with 32bit NetBSD (COMPAT_NETBSD32)
file arch/mips/mips/netbsd32_machdep.c compat_netbsd32
+file arch/mips/mips/netbsd32_machdep_13.c compat_netbsd32 & compat_13
+file arch/mips/mips/netbsd32_machdep_16.c compat_netbsd32 & compat_16
include "compat/netbsd32/files.netbsd32"
# Binary compatibility with previous NetBSD releases (COMPAT_XX)
-file arch/mips/mips/compat_13_machdep.c compat_13 | compat_ultrix
-file arch/mips/mips/compat_16_machdep.c compat_16 | compat_ultrix
# Ultrix Binary Compatibility (COMPAT_ULTRIX)
include "compat/ultrix/files.ultrix"
diff --git a/sys/arch/mips/mips/netbsd32_machdep.c b/sys/arch/mips/mips/netbsd32_machdep.c
index e14a8ad749c..2c56a553da1 100644
--- a/sys/arch/mips/mips/netbsd32_machdep.c
+++ b/sys/arch/mips/mips/netbsd32_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.16 2018/11/27 14:09:54 maxv Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.17 2019/01/27 02:08:38 pgoyette Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.16 2018/11/27 14:09:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.17 2019/01/27 02:08:38 pgoyette Exp $");
#include "opt_compat_netbsd.h"
#include "opt_coredump.h"
@@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.16 2018/11/27 14:09:54 maxv E
#include <sys/signalvar.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
+#include <sys/compat_stub.h>
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_exec.h>
@@ -75,83 +76,7 @@ netbsd32_cpu_upcall
netbsd32_vm_default_addr
#endif
-int
-netbsd32_sysarch(struct lwp *l, const struct netbsd32_sysarch_args *uap,
- register_t *retval)
-{
- /* {
- syscallarg(int) op;
- syscallarg(netbsd32_voidp) parms;
- } */
- struct proc *p = l->l_proc;
- void *parms = SCARG_P32(uap, parms);
- int error = 0;
-
- switch(SCARG(uap, op)) {
- case MIPS_CACHEFLUSH: {
- struct mips_cacheflush_args32 cfua;
-
- error = copyin(parms, &cfua, sizeof(cfua));
- if (error != 0)
- return (error);
- error = mips_user_cacheflush(p, cfua.va, cfua.nbytes,
- cfua.whichcache);
- break;
- }
- case MIPS_CACHECTL: {
- struct mips_cachectl_args32 ccua;
-
- error = copyin(parms, &ccua, sizeof(ccua));
- if (error != 0)
- return (error);
- error = mips_user_cachectl(p, ccua.va, ccua.nbytes, ccua.ctl);
- break;
- }
- default:
- error = ENOSYS;
- break;
- }
- return (error);
-}
-
-#ifdef COMPAT_13
-int
-compat_13_netbsd32_sigreturn(struct lwp *l,
- const struct compat_13_netbsd32_sigreturn_args *uap,
- register_t *retval)
-{
- struct compat_13_sys_sigreturn_args ua;
-
- NETBSD32TOP_UAP(sigcntxp, struct sigcontext13 *);
-
- return compat_13_sys_sigreturn(l, &ua, retval);
-}
-#endif
-
-#ifdef COMPAT_16
-int
-compat_16_netbsd32___sigreturn14(struct lwp *l,
- const struct compat_16_netbsd32___sigreturn14_args *uap,
- register_t *retval)
-{
- struct compat_16_sys___sigreturn14_args ua;
-
- NETBSD32TOP_UAP(sigcntxp, struct sigcontext *);
-
- return compat_16_sys___sigreturn14(l, &ua, retval);
-}
-#endif
-
-vaddr_t
-netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t size,
- int topdown)
-{
- if (topdown)
- return VM_DEFAULT_ADDRESS32_TOPDOWN(base, size);
- else
- return VM_DEFAULT_ADDRESS32_BOTTOMUP(base, size);
-}
-
+int netbsd32_sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
struct sigframe_siginfo32 {
siginfo32_t sf_si;
@@ -161,7 +86,7 @@ struct sigframe_siginfo32 {
/*
* Send a signal to process.
*/
-static void
+int
netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
{
struct lwp * const l = curlwp;
@@ -185,7 +110,7 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
case 0: /* handled by sendsig_sigcontext */
case 1: /* handled by sendsig_sigcontext */
default: /* unknown version */
- printf("sendsig_siginfo: bad version %d\n",
+ printf("%s: bad version %d\n", __func__,
ps->sa_sigdesc[sig].sd_vers);
sigexit(l, SIGILL);
case 2:
@@ -207,7 +132,6 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
cpu_getmcontext32(l, &sf.sf_uc.uc_mcontext, &sf.sf_uc.uc_flags);
error = copyout(&sf, sfp, sfsz);
mutex_enter(p->p_lock);
-
if (error != 0) {
/*
* Process has trashed its stack; give it an illegal
@@ -234,18 +158,58 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
/* Remember that we're now on the signal stack. */
if (onstack)
l->l_sigstk.ss_flags |= SS_ONSTACK;
+
+ return 0;
}
-void
-netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
-{
-#ifdef COMPAT_16
- if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2)
- sendsig_sigcontext(ksi, mask);
- else
-#endif
- netbsd32_sendsig_siginfo(ksi, mask);
-}
+int
+netbsd32_sysarch(struct lwp *l, const struct netbsd32_sysarch_args *uap,
+ register_t *retval)
+{
+ /* {
+ syscallarg(int) op;
+ syscallarg(netbsd32_voidp) parms;
+ } */
+ struct proc *p = l->l_proc;
+ void *parms = SCARG_P32(uap, parms);
+ int error = 0;
+
+ switch(SCARG(uap, op)) {
+ case MIPS_CACHEFLUSH: {
+ struct mips_cacheflush_args32 cfua;
+
+ error = copyin(parms, &cfua, sizeof(cfua));
+ if (error != 0)
+ return (error);
+ error = mips_user_cacheflush(p, cfua.va, cfua.nbytes,
+ cfua.whichcache);
+ break;
+ }
+ case MIPS_CACHECTL: {
+ struct mips_cachectl_args32 ccua;
+
+ error = copyin(parms, &ccua, sizeof(ccua));
+ if (error != 0)
+ return (error);
+ error = mips_user_cachectl(p, ccua.va, ccua.nbytes, ccua.ctl);
+ break;
+ }
+ default:
+ error = ENOSYS;
+ break;
+ }
+ return (error);
+}
+
+vaddr_t
+netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t size,
+ int topdown)
+{
+ if (topdown)
+ return VM_DEFAULT_ADDRESS32_TOPDOWN(base, size);
+ else
+ return VM_DEFAULT_ADDRESS32_BOTTOMUP(base, size);
+}
void
cpu_getmcontext32(struct lwp *l, mcontext32_t *mc32, unsigned int *flagsp)
@@ -343,3 +307,36 @@ cpu_coredump32(struct lwp *l, struct coredump_iostate *iocookie,
chdr->c_cpusize);
}
#endif
+
+struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
+
+void
+netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
+{
+
+ MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook, (ksi, mask),
+ netbsd32_sendsig_siginfo(ksi, mask));
+}
+
+static const char *
+netbsd32_machine32(void)
+{
+
+ return machine32;
+}
+
+void
+netbsd32_machdep_md_init(void)
+{
+
+ MODULE_SET_HOOK(netbsd32_machine32_hook, "mach32", netbsd32_machine32);
+}
+
+void
+netbsd32_machdep_md_fini(void)
+{
+
+ MODULE_UNSET_HOOK(netbsd32_machine32_hook);
+}
+
+
diff --git a/sys/arch/mips/mips/netbsd32_machdep_13.c b/sys/arch/mips/mips/netbsd32_machdep_13.c
new file mode 100644
index 00000000000..ef6f5b1b42f
--- /dev/null
+++ b/sys/arch/mips/mips/netbsd32_machdep_13.c
@@ -0,0 +1,99 @@
+/* $NetBSD: netbsd32_machdep_13.c,v 1.2 2019/01/27 02:08:38 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas <matt@3am-software.com>.
+ *
+ * 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_machdep_13.c,v 1.2 2019/01/27 02:08:38 pgoyette Exp $");
+
+#include "opt_compat_netbsd.h"
+#include "opt_coredump.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/ioctl.h>
+#include <sys/exec.h>
+#include <sys/cpu.h>
+#include <sys/core.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/uio.h>
+#include <sys/kernel.h>
+#include <sys/buf.h>
+#include <sys/signal.h>
+#include <sys/signalvar.h>
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_exec.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+
+#include <mips/cache.h>
+#include <mips/sysarch.h>
+#include <mips/cachectl.h>
+#include <mips/locore.h>
+#include <mips/frame.h>
+#include <mips/regnum.h>
+#include <mips/pcb.h>
+
+#include <uvm/uvm_extern.h>
+
+#if 0
+cpu_coredump32
+netbsd32_cpu_upcall
+netbsd32_vm_default_addr
+#endif
+
+int
+compat_13_netbsd32_sigreturn(struct lwp *l,
+ const struct compat_13_netbsd32_sigreturn_args *uap,
+ register_t *retval)
+{
+ struct compat_13_sys_sigreturn_args ua;
+
+ NETBSD32TOP_UAP(sigcntxp, struct sigcontext13 *);
+
+ return compat_13_sys_sigreturn(l, &ua, retval);
+}
+
+void
+netbsd32_machdep_md_13_init(void)
+{
+
+ /* nothing to do */
+}
+
+void
+netbsd32_machdep_md_13_fini(void)
+{
+
+ /* nothing to do */
+}
diff --git a/sys/arch/mips/mips/netbsd32_machdep_16.c b/sys/arch/mips/mips/netbsd32_machdep_16.c
new file mode 100644
index 00000000000..46d39bc38c1
--- /dev/null
+++ b/sys/arch/mips/mips/netbsd32_machdep_16.c
@@ -0,0 +1,110 @@
+/* $NetBSD: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:38 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas <matt@3am-software.com>.
+ *
+ * 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_machdep_16.c,v 1.2 2019/01/27 02:08:38 pgoyette Exp $");
+
+#include "opt_compat_netbsd.h"
+#include "opt_coredump.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/ioctl.h>
+#include <sys/exec.h>
+#include <sys/cpu.h>
+#include <sys/core.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/uio.h>
+#include <sys/kernel.h>
+#include <sys/buf.h>
+#include <sys/signal.h>
+#include <sys/signalvar.h>
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
+#include <sys/module_hook.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_exec.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+
+#include <mips/cache.h>
+#include <mips/sysarch.h>
+#include <mips/cachectl.h>
+#include <mips/locore.h>
+#include <mips/frame.h>
+#include <mips/regnum.h>
+#include <mips/pcb.h>
+
+#include <uvm/uvm_extern.h>
+
+void netbsd32_sendsig_16(const ksiginfo_t *, const sigset_t *);
+
+void sendsig_context(const ksiginfo_t *, const sigset_t *);
+int netbsd32_sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
+
+extern struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
+
+int
+compat_16_netbsd32___sigreturn14(struct lwp *l,
+ const struct compat_16_netbsd32___sigreturn14_args *uap,
+ register_t *retval)
+{
+ struct compat_16_sys___sigreturn14_args ua;
+
+ NETBSD32TOP_UAP(sigcntxp, struct sigcontext *);
+
+ return compat_16_sys___sigreturn14(l, &ua, retval);
+}
+
+void
+netbsd32_sendsig_16(const ksiginfo_t *ksi, const sigset_t *mask)
+{
+ if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2)
+ sendsig_sigcontext(ksi, mask);
+ else
+ netbsd32_sendsig_siginfo(ksi, mask);
+}
+
+void
+netbsd32_machdep_md_16_init(void)
+{
+
+ MODULE_SET_HOOK(netbsd32_sendsig_hook, "nb32_16", netbsd32_sendsig_16);
+}
+
+void
+netbsd32_machdep_md_16_fini(void)
+{
+
+ MODULE_UNSET_HOOK(netbsd32_sendsig_hook);
+}
diff --git a/sys/arch/sparc/fpu/fpu.c b/sys/arch/sparc/fpu/fpu.c
index dadb0c00c3f..e263a0fb999 100644
--- a/sys/arch/sparc/fpu/fpu.c
+++ b/sys/arch/sparc/fpu/fpu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu.c,v 1.27 2012/02/12 16:34:10 matt Exp $ */
+/* $NetBSD: fpu.c,v 1.28 2019/01/27 02:08:38 pgoyette Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.27 2012/02/12 16:34:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.28 2019/01/27 02:08:38 pgoyette Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.27 2012/02/12 16:34:10 matt Exp $");
#include <sys/systm.h>
#include <sys/syslog.h>
#include <sys/signalvar.h>
+#include <sys/compat_stub.h>
#include <machine/instr.h>
#include <machine/reg.h>
@@ -108,7 +109,6 @@ static u_char fpu_codes_native[] = {
X8(FPE_FLTOVF),
X16(FPE_FLTINV)
};
-#if defined(COMPAT_SUNOS)
static u_char fpu_codes_sunos[] = {
X1(FPE_FLTINEX_TRAP),
X2(FPE_FLTDIV_TRAP),
@@ -116,8 +116,7 @@ static u_char fpu_codes_sunos[] = {
X8(FPE_FLTOVF_TRAP),
X16(FPE_FLTOPERR_TRAP)
};
-extern struct emul emul_sunos;
-#endif /* SUNOS_COMPAT */
+
/* Note: SVR4(Solaris) FPE_* codes happen to be compatible with ours */
/*
@@ -142,12 +141,15 @@ fpu_cleanup(
struct fpemu fe;
u_char *fpu_codes;
int code = 0;
+ int ret;
+ const struct emul *sunos_emul;
- fpu_codes =
-#ifdef COMPAT_SUNOS
- (p->p_emul == &emul_sunos) ? fpu_codes_sunos :
-#endif
- fpu_codes_native;
+ MODULE_CALL_HOOK(get_emul_sunos_hook, (&sunos_emul), enosys(), ret);
+
+ if (ret == 0 && p->p_emul == sunos_emul)
+ fpu_codes = fpu_codes_sunos;
+ else
+ fpu_codes = fpu_codes_native;
switch ((fsr >> FSR_FTT_SHIFT) & FSR_FTT_MASK) {
diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64
index b76e3548bed..832f62cda99 100644
--- a/sys/arch/sparc64/conf/files.sparc64
+++ b/sys/arch/sparc64/conf/files.sparc64
@@ -1,4 +1,4 @@
-# $NetBSD: files.sparc64,v 1.157 2018/12/19 13:57:50 maxv Exp $
+# $NetBSD: files.sparc64,v 1.158 2019/01/27 02:08:38 pgoyette Exp $
# @(#)files.sparc64 8.1 (Berkeley) 7/19/93
# sparc64-specific configuration info
@@ -294,8 +294,12 @@ file arch/sparc64/sparc64/compat_16_machdep.c compat_16
# NetBSD/sparc 32-bit Binary compatibility (COMPAT_NETBSD32)
include "compat/netbsd32/files.netbsd32"
-file arch/sparc64/sparc64/netbsd32_machdep.c compat_netbsd32
-file arch/sparc64/sparc64/netbsd32_sigcode.s compat_netbsd32
+file arch/sparc64/sparc64/netbsd32_machdep.c compat_netbsd32
+file arch/sparc64/sparc64/netbsd32_machdep_13.c compat_netbsd32 &
+ compat_13
+file arch/sparc64/sparc64/netbsd32_machdep_16.c compat_netbsd32 &
+ compat_16
+file arch/sparc64/sparc64/netbsd32_sigcode.s compat_netbsd32
# SunOS Binary Compatibility (COMPAT_SUNOS), 32-bit & 64-bit kernel
# (64-bit also depends on COMPAT_NETBSD32)
diff --git a/sys/arch/sparc64/sparc64/netbsd32_machdep.c b/sys/arch/sparc64/sparc64/netbsd32_machdep.c
index b2e3cb5a55d..74ab376c5f7 100644
--- a/sys/arch/sparc64/sparc64/netbsd32_machdep.c
+++ b/sys/arch/sparc64/sparc64/netbsd32_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.111 2018/11/27 14:09:54 maxv Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.112 2019/01/27 02:08:38 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,13 +27,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.111 2018/11/27 14:09:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.112 2019/01/27 02:08:38 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
#include "opt_compat_sunos.h"
#include "opt_modular.h"
#include "opt_execfmt.h"
+#include "opt_coredump.h"
#include "firm_events.h"
#endif
@@ -54,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.111 2018/11/27 14:09:54 maxv
#include <sys/ucontext.h>
#include <sys/ioctl.h>
#include <sys/kmem.h>
+#include <sys/compat_stub.h>
#include <dev/sun/event_var.h>
@@ -88,6 +90,8 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.111 2018/11/27 14:09:54 maxv
const char machine32[] = "sparc";
const char machine_arch32[] = "sparc";
+int netbsd32_sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
+
#if NFIRM_EVENTS > 0
static int ev_out32(struct firm_event *, int, struct uio *);
#endif
@@ -150,167 +154,12 @@ netbsd32_setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
tf->tf_out[7] = 0;
}
-#ifdef COMPAT_16
-/*
- * NB: since this is a 32-bit address world, sf_scp and sf_sc
- * can't be a pointer since those are 64-bits wide.
- */
-struct sparc32_sigframe {
- int sf_signo; /* signal number */
- int sf_code; /* code */
- u_int sf_scp; /* SunOS user addr of sigcontext */
- int sf_addr; /* SunOS compat, always 0 for now */
- struct netbsd32_sigcontext sf_sc; /* actual sigcontext */
-};
-
-#undef DEBUG
-#ifdef DEBUG
-extern int sigdebug;
-#endif
-
-static void
-netbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
-{
- int sig = ksi->ksi_signo;
- struct lwp *l = curlwp;
- struct proc *p = l->l_proc;
- struct sparc32_sigframe *fp;
- struct trapframe64 *tf;
- int addr, onstack, error;
- struct rwindow32 *oldsp, *newsp;
- register32_t sp;
- sig_t catcher = SIGACTION(p, sig).sa_handler;
- struct sparc32_sigframe sf;
- extern char netbsd32_sigcode[], netbsd32_esigcode[];
-#define szsigcode (netbsd32_esigcode - netbsd32_sigcode)
-
- tf = l->l_md.md_tf;
- /* Need to attempt to zero extend this 32-bit pointer */
- oldsp = (struct rwindow32 *)(u_long)(u_int)tf->tf_out[6];
- /* Do we need to jump onto the signal stack? */
- onstack =
- (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
- (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
- if (onstack) {
- fp = (struct sparc32_sigframe *)((char *)l->l_sigstk.ss_sp +
- l->l_sigstk.ss_size);
- l->l_sigstk.ss_flags |= SS_ONSTACK;
- } else
- fp = (struct sparc32_sigframe *)oldsp;
- fp = (struct sparc32_sigframe *)((u_long)(fp - 1) & ~7);
-
-#ifdef DEBUG
- sigpid = p->p_pid;
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
- printf("sendsig: %s[%d] sig %d newusp %p scp %p oldsp %p\n",
- p->p_comm, p->p_pid, sig, fp, &fp->sf_sc, oldsp);
- if (sigdebug & SDB_DDB) Debugger();
- }
-#endif
- /*
- * Now set up the signal frame. We build it in kernel space
- * and then copy it out. We probably ought to just build it
- * directly in user space....
- */
- memset(&sf, 0, sizeof(sf));
- sf.sf_signo = sig;
- sf.sf_code = (u_int)ksi->ksi_trap;
-#if defined(COMPAT_SUNOS) || defined(MODULAR)
- sf.sf_scp = (u_long)&fp->sf_sc;
-#endif
- sf.sf_addr = 0; /* XXX */
-
- /*
- * Build the signal context to be used by sigreturn.
- */
- sf.sf_sc.sc_onstack = onstack;
- sf.sf_sc.sc_mask = *mask;
- sf.sf_sc.sc_sp = (u_long)oldsp;
- sf.sf_sc.sc_pc = tf->tf_pc;
- sf.sf_sc.sc_npc = tf->tf_npc;
- sf.sf_sc.sc_psr = TSTATECCR_TO_PSR(tf->tf_tstate); /* XXX */
- sf.sf_sc.sc_g1 = tf->tf_global[1];
- sf.sf_sc.sc_o0 = tf->tf_out[0];
-
- /*
- * Put the stack in a consistent state before we whack away
- * at it. Note that write_user_windows may just dump the
- * registers into the pcb; we need them in the process's memory.
- * We also need to make sure that when we start the signal handler,
- * its %i6 (%fp), which is loaded from the newly allocated stack area,
- * joins seamlessly with the frame it was in when the signal occurred,
- * so that the debugger and _longjmp code can back up through it.
- */
- sendsig_reset(l, sig);
- mutex_exit(p->p_lock);
- newsp = (struct rwindow32 *)((long)fp - sizeof(struct rwindow32));
- write_user_windows();
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK))
- printf("sendsig: saving sf to %p, setting stack pointer %p to %p\n",
- fp, &(((struct rwindow32 *)newsp)->rw_in[6]), oldsp);
-#endif
- sp = NETBSD32PTR32I(oldsp);
- error = (rwindow_save(l) ||
- copyout(&sf, fp, sizeof sf) ||
- copyout(&sp, &(((struct rwindow32 *)newsp)->rw_in[6]),
- sizeof(sp)));
- mutex_enter(p->p_lock);
- if (error) {
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
-#ifdef DEBUG
- mutex_exit(p->p_lock);
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig: window save or copyout error\n");
- printf("sendsig: stack was trashed trying to send sig %d, sending SIGILL\n", sig);
- if (sigdebug & SDB_DDB) Debugger();
- mutex_enter(p->p_lock);
-#endif
- sigexit(l, SIGILL);
- /* NOTREACHED */
- }
-
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW) {
- printf("sendsig: %s[%d] sig %d scp %p\n",
- p->p_comm, p->p_pid, sig, &fp->sf_sc);
- }
-#endif
- /*
- * Arrange to continue execution at the code copied out in exec().
- * It needs the function to call in %g1, and a new stack pointer.
- */
- addr = p->p_psstrp - szsigcode;
- tf->tf_global[1] = (long)catcher;
- tf->tf_pc = addr;
- tf->tf_npc = addr + 4;
- tf->tf_out[6] = (uint64_t)(u_int)(u_long)newsp;
-
- /* Remember that we're now on the signal stack. */
- if (onstack)
- l->l_sigstk.ss_flags |= SS_ONSTACK;
-
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
- mutex_exit(p->p_lock);
- printf("sendsig: about to return to catcher %p thru %p\n",
- catcher, addr);
- if (sigdebug & SDB_DDB) Debugger();
- mutex_enter(p->p_lock);
- }
-#endif
-}
-#endif
-
struct sparc32_sigframe_siginfo {
siginfo32_t sf_si;
ucontext32_t sf_uc;
};
-static void
+int
netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
{
struct lwp *l = curlwp;
@@ -408,197 +257,21 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
/* Remember that we're now on the signal stack. */
if (onstack)
l->l_sigstk.ss_flags |= SS_ONSTACK;
+
+ return 0;
}
+struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
+
void
netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
-#ifdef COMPAT_16
- if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2)
- netbsd32_sendsig_sigcontext(ksi, mask);
- else
-#endif
- netbsd32_sendsig_siginfo(ksi, mask);
-}
-
-#undef DEBUG
-
-#ifdef COMPAT_13
-int
-compat_13_netbsd32_sigreturn(struct lwp *l, const struct compat_13_netbsd32_sigreturn_args *uap, register_t *retval)
-{
- /* {
- syscallarg(struct netbsd32_sigcontext13 *) sigcntxp;
- } */
- struct netbsd32_sigcontext13 *scp;
- struct netbsd32_sigcontext13 sc;
- struct trapframe64 *tf;
- struct proc *p = l->l_proc;
- sigset_t mask;
-
- /* First ensure consistent stack state (see sendsig). */
- write_user_windows();
- if (rwindow_save(l)) {
-#ifdef DEBUG
- printf("compat_13_netbsd32_sigreturn: rwindow_save(%p) failed, sending SIGILL\n", p);
- Debugger();
-#endif
- mutex_enter(p->p_lock);
- sigexit(l, SIGILL);
- }
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW) {
- printf("compat_13_netbsd32_sigreturn: %s[%d], sigcntxp %p\n",
- p->p_comm, p->p_pid, SCARG(uap, sigcntxp));
- if (sigdebug & SDB_DDB) Debugger();
- }
-#endif
- scp = (struct netbsd32_sigcontext13 *)(u_long)SCARG(uap, sigcntxp);
- if ((vaddr_t)scp & 3 || (copyin((void *)scp, &sc, sizeof sc) != 0))
- {
-#ifdef DEBUG
- printf("compat_13_netbsd32_sigreturn: copyin failed\n");
- Debugger();
-#endif
- return (EINVAL);
- }
- scp = &sc;
-
- tf = l->l_md.md_tf;
- /*
- * Only the icc bits in the psr are used, so it need not be
- * verified. pc and npc must be multiples of 4. This is all
- * that is required; if it holds, just do it.
- */
- if (((sc.sc_pc | sc.sc_npc) & 3) != 0)
-#ifdef DEBUG
- {
- printf("compat_13_netbsd32_sigreturn: pc %p or npc %p invalid\n", sc.sc_pc, sc.sc_npc);
- Debugger();
- return (EINVAL);
- }
-#else
- return (EINVAL);
-#endif
- /* take only psr ICC field */
- tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(sc.sc_psr);
- tf->tf_pc = (int64_t)sc.sc_pc;
- tf->tf_npc = (int64_t)sc.sc_npc;
- tf->tf_global[1] = (int64_t)sc.sc_g1;
- tf->tf_out[0] = (int64_t)sc.sc_o0;
- tf->tf_out[6] = (int64_t)sc.sc_sp;
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW) {
- printf("compat_13_netbsd32_sys_sigreturn: return trapframe pc=%p sp=%p tstate=%x\n",
- (int)tf->tf_pc, (int)tf->tf_out[6], (int)tf->tf_tstate);
- if (sigdebug & SDB_DDB) Debugger();
- }
-#endif
- mutex_enter(p->p_lock);
- if (scp->sc_onstack & SS_ONSTACK)
- l->l_sigstk.ss_flags |= SS_ONSTACK;
- else
- l->l_sigstk.ss_flags &= ~SS_ONSTACK;
- /* Restore signal mask */
- native_sigset13_to_sigset((sigset13_t *)&scp->sc_mask, &mask);
- (void) sigprocmask1(l, SIG_SETMASK, &mask, 0);
- mutex_exit(p->p_lock);
- return (EJUSTRETURN);
+ MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook, (ksi, mask),
+ netbsd32_sendsig_siginfo(ksi, mask));
}
-#endif
-
-/*
- * System call to cleanup state after a signal
- * has been taken. Reset signal mask and
- * stack state from context left by sendsig (above),
- * and return to the given trap frame (if there is one).
- * Check carefully to make sure that the user has not
- * modified the state to gain improper privileges or to cause
- * a machine fault.
- */
-/* ARGSUSED */
-int
-compat_16_netbsd32___sigreturn14(struct lwp *l, const struct compat_16_netbsd32___sigreturn14_args *uap, register_t *retval)
-{
- /* {
- syscallarg(struct sigcontext *) sigcntxp;
- } */
- struct netbsd32_sigcontext sc, *scp;
- struct trapframe64 *tf;
- struct proc *p = l->l_proc;
- /* First ensure consistent stack state (see sendsig). */
- write_user_windows();
- if (rwindow_save(l)) {
-#ifdef DEBUG
- printf("netbsd32_sigreturn14: rwindow_save(%p) failed, sending SIGILL\n", p);
- Debugger();
-#endif
- mutex_enter(p->p_lock);
- sigexit(l, SIGILL);
- }
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW) {
- printf("netbsd32_sigreturn14: %s[%d], sigcntxp %p\n",
- p->p_comm, p->p_pid, SCARG(uap, sigcntxp));
- if (sigdebug & SDB_DDB) Debugger();
- }
-#endif
- scp = (struct netbsd32_sigcontext *)(u_long)SCARG(uap, sigcntxp);
- if ((vaddr_t)scp & 3 || (copyin((void *)scp, &sc, sizeof sc) != 0))
- {
-#ifdef DEBUG
- printf("netbsd32_sigreturn14: copyin failed: scp=%p\n", scp);
- Debugger();
-#endif
- return (EINVAL);
- }
- scp = &sc;
-
- tf = l->l_md.md_tf;
- /*
- * Only the icc bits in the psr are used, so it need not be
- * verified. pc and npc must be multiples of 4. This is all
- * that is required; if it holds, just do it.
- */
- if (((sc.sc_pc | sc.sc_npc) & 3) != 0 || (sc.sc_pc == 0) || (sc.sc_npc == 0))
-#ifdef DEBUG
- {
- printf("netbsd32_sigreturn14: pc %p or npc %p invalid\n", sc.sc_pc, sc.sc_npc);
- Debugger();
- return (EINVAL);
- }
-#else
- return (EINVAL);
-#endif
- /* take only psr ICC field */
- tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(sc.sc_psr);
- tf->tf_pc = (int64_t)sc.sc_pc;
- tf->tf_npc = (int64_t)sc.sc_npc;
- tf->tf_global[1] = (int64_t)sc.sc_g1;
- tf->tf_out[0] = (int64_t)sc.sc_o0;
- tf->tf_out[6] = (int64_t)sc.sc_sp;
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW) {
- printf("netbsd32_sigreturn14: return trapframe pc=%p sp=%p tstate=%llx\n",
- (vaddr_t)tf->tf_pc, (vaddr_t)tf->tf_out[6], tf->tf_tstate);
- if (sigdebug & SDB_DDB) Debugger();
- }
-#endif
-
- /* Restore signal stack. */
- mutex_enter(p->p_lock);
- if (sc.sc_onstack & SS_ONSTACK)
- l->l_sigstk.ss_flags |= SS_ONSTACK;
- else
- l->l_sigstk.ss_flags &= ~SS_ONSTACK;
- /* Restore signal mask. */
- (void) sigprocmask1(l, SIG_SETMASK, &sc.sc_mask, 0);
- mutex_exit(p->p_lock);
-
- return (EJUSTRETURN);
-}
+#undef DEBUG
/* Unfortunately we need to convert v9 trapframe to v8 regs */
int
@@ -681,6 +354,7 @@ netbsd32_process_write_fpregs(struct lwp *l, const struct fpreg32 *regs,
/*
* 32-bit version of cpu_coredump.
*/
+#ifdef COREDUMP
int
cpu_coredump32(struct lwp *l, struct coredump_iostate *iocookie,
struct core32 *chdr)
@@ -736,6 +410,7 @@ cpu_coredump32(struct lwp *l, struct coredump_iostate *iocookie,
return coredump_write(iocookie, UIO_SYSSPACE, &md_core,
sizeof(md_core));
}
+#endif
void netbsd32_cpu_getmcontext(struct lwp *, mcontext_t *, unsigned int *);
@@ -1341,3 +1016,24 @@ netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t size,
{
return round_page((vaddr_t)(base) + (vsize_t)MAXDSIZ32);
}
+
+static const char *
+netbsd32_machine32(void)
+{
+
+ return machine32;
+}
+
+void
+netbsd32_machdep_md_init(void)
+{
+
+ MODULE_SET_HOOK(netbsd32_machine32_hook, "mach32", netbsd32_machine32);
+}
+
+void
+netbsd32_machdep_md_fini(void)
+{
+
+ MODULE_UNSET_HOOK(netbsd32_machine32_hook);
+}
diff --git a/sys/arch/sparc64/sparc64/netbsd32_machdep_13.c b/sys/arch/sparc64/sparc64/netbsd32_machdep_13.c
new file mode 100644
index 00000000000..c1e92e61d60
--- /dev/null
+++ b/sys/arch/sparc64/sparc64/netbsd32_machdep_13.c
@@ -0,0 +1,183 @@
+/* $NetBSD: netbsd32_machdep_13.c,v 1.2 2019/01/27 02:08:38 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 1998, 2001 Matthew R. Green
+ * 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: netbsd32_machdep_13.c,v 1.2 2019/01/27 02:08:38 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_modular.h"
+#include "opt_execfmt.h"
+#include "firm_events.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/exec.h>
+#include <sys/exec_aout.h>
+#include <sys/filedesc.h>
+#include <sys/file.h>
+#include <sys/proc.h>
+#include <sys/signalvar.h>
+#include <sys/systm.h>
+#include <sys/core.h>
+#include <sys/mount.h>
+#include <sys/buf.h>
+#include <sys/vnode.h>
+#include <sys/select.h>
+#include <sys/socketvar.h>
+#include <sys/ucontext.h>
+#include <sys/ioctl.h>
+#include <sys/kmem.h>
+
+#include <dev/sun/event_var.h>
+
+#include <net/if.h>
+#include <net/route.h>
+
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <netinet/igmp.h>
+#include <netinet/igmp_var.h>
+#include <netinet/ip_mroute.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_ioctl.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+#include <compat/netbsd32/netbsd32_exec.h>
+
+#include <compat/sys/signal.h>
+#include <compat/sys/signalvar.h>
+#include <compat/sys/siginfo.h>
+#include <compat/sys/ucontext.h>
+
+#include <machine/frame.h>
+#include <machine/pcb.h>
+#include <machine/reg.h>
+#include <machine/vmparam.h>
+#include <machine/vuid_event.h>
+#include <machine/netbsd32_machdep.h>
+#include <machine/userret.h>
+
+int
+compat_13_netbsd32_sigreturn(struct lwp *l, const struct compat_13_netbsd32_sigreturn_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(struct netbsd32_sigcontext13 *) sigcntxp;
+ } */
+ struct netbsd32_sigcontext13 *scp;
+ struct netbsd32_sigcontext13 sc;
+ struct trapframe64 *tf;
+ struct proc *p = l->l_proc;
+ sigset_t mask;
+
+ /* First ensure consistent stack state (see sendsig). */
+ write_user_windows();
+ if (rwindow_save(l)) {
+#ifdef DEBUG
+ printf("%s: rwindow_save(%p) failed, sending SIGILL\n",
+ __func__, p);
+ Debugger();
+#endif
+ mutex_enter(p->p_lock);
+ sigexit(l, SIGILL);
+ }
+#ifdef DEBUG
+ if (sigdebug & SDB_FOLLOW) {
+ printf("%s: %s[%d], sigcntxp %p\n", __func__,
+ p->p_comm, p->p_pid, SCARG(uap, sigcntxp));
+ if (sigdebug & SDB_DDB) Debugger();
+ }
+#endif
+ scp = (struct netbsd32_sigcontext13 *)(u_long)SCARG(uap, sigcntxp);
+ if ((vaddr_t)scp & 3 || (copyin((void *)scp, &sc, sizeof sc) != 0))
+ {
+#ifdef DEBUG
+ printf("%s: copyin failed\n", __func__);
+ Debugger();
+#endif
+ return (EINVAL);
+ }
+ scp = &sc;
+
+ tf = l->l_md.md_tf;
+ /*
+ * Only the icc bits in the psr are used, so it need not be
+ * verified. pc and npc must be multiples of 4. This is all
+ * that is required; if it holds, just do it.
+ */
+ if (((sc.sc_pc | sc.sc_npc) & 3) != 0)
+#ifdef DEBUG
+ {
+ printf("%s: pc %p or npc %p invalid\n",
+ __func__, sc.sc_pc, sc.sc_npc);
+ Debugger();
+ return (EINVAL);
+ }
+#else
+ return (EINVAL);
+#endif
+ /* take only psr ICC field */
+ tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(sc.sc_psr);
+ tf->tf_pc = (int64_t)sc.sc_pc;
+ tf->tf_npc = (int64_t)sc.sc_npc;
+ tf->tf_global[1] = (int64_t)sc.sc_g1;
+ tf->tf_out[0] = (int64_t)sc.sc_o0;
+ tf->tf_out[6] = (int64_t)sc.sc_sp;
+#ifdef DEBUG
+ if (sigdebug & SDB_FOLLOW) {
+ printf("%s: return trapframe pc=%p sp=%p tstate=%x\n", __func__,
+ (int)tf->tf_pc, (int)tf->tf_out[6], (int)tf->tf_tstate);
+ if (sigdebug & SDB_DDB) Debugger();
+ }
+#endif
+ mutex_enter(p->p_lock);
+ if (scp->sc_onstack & SS_ONSTACK)
+ l->l_sigstk.ss_flags |= SS_ONSTACK;
+ else
+ l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+ /* Restore signal mask */
+ native_sigset13_to_sigset((sigset13_t *)&scp->sc_mask, &mask);
+ (void) sigprocmask1(l, SIG_SETMASK, &mask, 0);
+ mutex_exit(p->p_lock);
+
+ return (EJUSTRETURN);
+}
+
+void
+netbsd32_machdep_md_13_init(void)
+{
+
+ /* Nothing to do */
+}
+
+void
+netbsd32_machdep_md_13_fini(void)
+{
+
+ /* Nothing to do */
+}
diff --git a/sys/arch/sparc64/sparc64/netbsd32_machdep_16.c b/sys/arch/sparc64/sparc64/netbsd32_machdep_16.c
new file mode 100644
index 00000000000..4ef1d2f6c2f
--- /dev/null
+++ b/sys/arch/sparc64/sparc64/netbsd32_machdep_16.c
@@ -0,0 +1,363 @@
+/* $NetBSD: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:38 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 1998, 2001 Matthew R. Green
+ * 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: netbsd32_machdep_16.c,v 1.2 2019/01/27 02:08:38 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_modular.h"
+#include "opt_execfmt.h"
+#include "firm_events.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/exec.h>
+#include <sys/exec_aout.h>
+#include <sys/filedesc.h>
+#include <sys/file.h>
+#include <sys/proc.h>
+#include <sys/signalvar.h>
+#include <sys/systm.h>
+#include <sys/core.h>
+#include <sys/mount.h>
+#include <sys/buf.h>
+#include <sys/vnode.h>
+#include <sys/select.h>
+#include <sys/socketvar.h>
+#include <sys/ucontext.h>
+#include <sys/ioctl.h>
+#include <sys/kmem.h>
+
+#include <dev/sun/event_var.h>
+
+#include <net/if.h>
+#include <net/route.h>
+
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <netinet/igmp.h>
+#include <netinet/igmp_var.h>
+#include <netinet/ip_mroute.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_ioctl.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+#include <compat/netbsd32/netbsd32_exec.h>
+
+#include <compat/sys/signal.h>
+#include <compat/sys/signalvar.h>
+#include <compat/sys/siginfo.h>
+#include <compat/sys/ucontext.h>
+
+#include <machine/frame.h>
+#include <machine/pcb.h>
+#include <machine/reg.h>
+#include <machine/vmparam.h>
+#include <machine/vuid_event.h>
+#include <machine/netbsd32_machdep.h>
+#include <machine/userret.h>
+
+void netbsd32_sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
+
+void netbsd32_sendsig_16(const ksiginfo_t *, const sigset_t *);
+
+/*
+ * NB: since this is a 32-bit address world, sf_scp and sf_sc
+ * can't be a pointer since those are 64-bits wide.
+ */
+struct sparc32_sigframe {
+ int sf_signo; /* signal number */
+ int sf_code; /* code */
+ u_int sf_scp; /* SunOS user addr of sigcontext */
+ int sf_addr; /* SunOS compat, always 0 for now */
+ struct netbsd32_sigcontext sf_sc; /* actual sigcontext */
+};
+
+extern struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
+
+#undef DEBUG
+#ifdef DEBUG
+extern int sigdebug;
+#endif
+
+static void
+netbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
+{
+ int sig = ksi->ksi_signo;
+ struct lwp *l = curlwp;
+ struct proc *p = l->l_proc;
+ struct sparc32_sigframe *fp;
+ struct trapframe64 *tf;
+ int addr, onstack, error;
+ struct rwindow32 *oldsp, *newsp;
+ register32_t sp;
+ sig_t catcher = SIGACTION(p, sig).sa_handler;
+ struct sparc32_sigframe sf;
+ extern char netbsd32_sigcode[], netbsd32_esigcode[];
+#define szsigcode (netbsd32_esigcode - netbsd32_sigcode)
+
+ tf = l->l_md.md_tf;
+ /* Need to attempt to zero extend this 32-bit pointer */
+ oldsp = (struct rwindow32 *)(u_long)(u_int)tf->tf_out[6];
+ /* Do we need to jump onto the signal stack? */
+ onstack =
+ (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
+ (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
+ if (onstack) {
+ fp = (struct sparc32_sigframe *)((char *)l->l_sigstk.ss_sp +
+ l->l_sigstk.ss_size);
+ l->l_sigstk.ss_flags |= SS_ONSTACK;
+ } else
+ fp = (struct sparc32_sigframe *)oldsp;
+ fp = (struct sparc32_sigframe *)((u_long)(fp - 1) & ~7);
+
+#ifdef DEBUG
+ sigpid = p->p_pid;
+ if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
+ printf("sendsig: %s[%d] sig %d newusp %p scp %p oldsp %p\n",
+ p->p_comm, p->p_pid, sig, fp, &fp->sf_sc, oldsp);
+ if (sigdebug & SDB_DDB) Debugger();
+ }
+#endif
+ /*
+ * Now set up the signal frame. We build it in kernel space
+ * and then copy it out. We probably ought to just build it
+ * directly in user space....
+ */
+ memset(&sf, 0, sizeof(sf));
+ sf.sf_signo = sig;
+ sf.sf_code = (u_int)ksi->ksi_trap;
+ sf.sf_scp = (u_long)&fp->sf_sc;
+ sf.sf_addr = 0; /* XXX */
+
+ /*
+ * Build the signal context to be used by sigreturn.
+ */
+ sf.sf_sc.sc_onstack = onstack;
+ sf.sf_sc.sc_mask = *mask;
+ sf.sf_sc.sc_sp = (u_long)oldsp;
+ sf.sf_sc.sc_pc = tf->tf_pc;
+ sf.sf_sc.sc_npc = tf->tf_npc;
+ sf.sf_sc.sc_psr = TSTATECCR_TO_PSR(tf->tf_tstate); /* XXX */
+ sf.sf_sc.sc_g1 = tf->tf_global[1];
+ sf.sf_sc.sc_o0 = tf->tf_out[0];
+
+ /*
+ * Put the stack in a consistent state before we whack away
+ * at it. Note that write_user_windows may just dump the
+ * registers into the pcb; we need them in the process's memory.
+ * We also need to make sure that when we start the signal handler,
+ * its %i6 (%fp), which is loaded from the newly allocated stack area,
+ * joins seamlessly with the frame it was in when the signal occurred,
+ * so that the debugger and _longjmp code can back up through it.
+ */
+ sendsig_reset(l, sig);
+ mutex_exit(p->p_lock);
+ newsp = (struct rwindow32 *)((long)fp - sizeof(struct rwindow32));
+ write_user_windows();
+#ifdef DEBUG
+ if ((sigdebug & SDB_KSTACK))
+ printf("sendsig: saving sf to %p, setting stack pointer %p to %p\n",
+ fp, &(((struct rwindow32 *)newsp)->rw_in[6]), oldsp);
+#endif
+ sp = NETBSD32PTR32I(oldsp);
+ error = (rwindow_save(l) ||
+ copyout(&sf, fp, sizeof sf) ||
+ copyout(&sp, &(((struct rwindow32 *)newsp)->rw_in[6]),
+ sizeof(sp)));
+ mutex_enter(p->p_lock);
+ if (error) {
+ /*
+ * Process has trashed its stack; give it an illegal
+ * instruction to halt it in its tracks.
+ */
+#ifdef DEBUG
+ mutex_exit(p->p_lock);
+ if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
+ printf("sendsig: window save or copyout error\n");
+ printf("sendsig: stack was trashed trying to send sig %d, sending SIGILL\n", sig);
+ if (sigdebug & SDB_DDB) Debugger();
+ mutex_enter(p->p_lock);
+#endif
+ sigexit(l, SIGILL);
+ /* NOTREACHED */
+ }
+
+#ifdef DEBUG
+ if (sigdebug & SDB_FOLLOW) {
+ printf("sendsig: %s[%d] sig %d scp %p\n",
+ p->p_comm, p->p_pid, sig, &fp->sf_sc);
+ }
+#endif
+ /*
+ * Arrange to continue execution at the code copied out in exec().
+ * It needs the function to call in %g1, and a new stack pointer.
+ */
+ addr = p->p_psstrp - szsigcode;
+ tf->tf_global[1] = (long)catcher;
+ tf->tf_pc = addr;
+ tf->tf_npc = addr + 4;
+ tf->tf_out[6] = (uint64_t)(u_int)(u_long)newsp;
+
+ /* Remember that we're now on the signal stack. */
+ if (onstack)
+ l->l_sigstk.ss_flags |= SS_ONSTACK;
+
+#ifdef DEBUG
+ if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
+ mutex_exit(p->p_lock);
+ printf("sendsig: about to return to catcher %p thru %p\n",
+ catcher, addr);
+ if (sigdebug & SDB_DDB) Debugger();
+ mutex_enter(p->p_lock);
+ }
+#endif
+}
+
+struct sparc32_sigframe_siginfo {
+ siginfo32_t sf_si;
+ ucontext32_t sf_uc;
+};
+
+void
+netbsd32_sendsig_16(const ksiginfo_t *ksi, const sigset_t *mask)
+{
+ if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2)
+ netbsd32_sendsig_sigcontext(ksi, mask);
+ else
+ netbsd32_sendsig_siginfo(ksi, mask);
+}
+
+#undef DEBUG
+
+/*
+ * System call to cleanup state after a signal
+ * has been taken. Reset signal mask and
+ * stack state from context left by sendsig (above),
+ * and return to the given trap frame (if there is one).
+ * Check carefully to make sure that the user has not
+ * modified the state to gain improper privileges or to cause
+ * a machine fault.
+ */
+/* ARGSUSED */
+int
+compat_16_netbsd32___sigreturn14(struct lwp *l, const struct compat_16_netbsd32___sigreturn14_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(struct sigcontext *) sigcntxp;
+ } */
+ struct netbsd32_sigcontext sc, *scp;
+ struct trapframe64 *tf;
+ struct proc *p = l->l_proc;
+
+ /* First ensure consistent stack state (see sendsig). */
+ write_user_windows();
+ if (rwindow_save(l)) {
+#ifdef DEBUG
+ printf("netbsd32_sigreturn14: rwindow_save(%p) failed, sending SIGILL\n", p);
+ Debugger();
+#endif
+ mutex_enter(p->p_lock);
+ sigexit(l, SIGILL);
+ }
+#ifdef DEBUG
+ if (sigdebug & SDB_FOLLOW) {
+ printf("netbsd32_sigreturn14: %s[%d], sigcntxp %p\n",
+ p->p_comm, p->p_pid, SCARG(uap, sigcntxp));
+ if (sigdebug & SDB_DDB) Debugger();
+ }
+#endif
+ scp = (struct netbsd32_sigcontext *)(u_long)SCARG(uap, sigcntxp);
+ if ((vaddr_t)scp & 3 || (copyin((void *)scp, &sc, sizeof sc) != 0))
+ {
+#ifdef DEBUG
+ printf("netbsd32_sigreturn14: copyin failed: scp=%p\n", scp);
+ Debugger();
+#endif
+ return (EINVAL);
+ }
+ scp = &sc;
+
+ tf = l->l_md.md_tf;
+ /*
+ * Only the icc bits in the psr are used, so it need not be
+ * verified. pc and npc must be multiples of 4. This is all
+ * that is required; if it holds, just do it.
+ */
+ if (((sc.sc_pc | sc.sc_npc) & 3) != 0 || (sc.sc_pc == 0) || (sc.sc_npc == 0))
+#ifdef DEBUG
+ {
+ printf("netbsd32_sigreturn14: pc %p or npc %p invalid\n", sc.sc_pc, sc.sc_npc);
+ Debugger();
+ return (EINVAL);
+ }
+#else
+ return (EINVAL);
+#endif
+ /* take only psr ICC field */
+ tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(sc.sc_psr);
+ tf->tf_pc = (int64_t)sc.sc_pc;
+ tf->tf_npc = (int64_t)sc.sc_npc;
+ tf->tf_global[1] = (int64_t)sc.sc_g1;
+ tf->tf_out[0] = (int64_t)sc.sc_o0;
+ tf->tf_out[6] = (int64_t)sc.sc_sp;
+#ifdef DEBUG
+ if (sigdebug & SDB_FOLLOW) {
+ printf("netbsd32_sigreturn14: return trapframe pc=%p sp=%p tstate=%llx\n",
+ (vaddr_t)tf->tf_pc, (vaddr_t)tf->tf_out[6], tf->tf_tstate);
+ if (sigdebug & SDB_DDB) Debugger();
+ }
+#endif
+
+ /* Restore signal stack. */
+ mutex_enter(p->p_lock);
+ if (sc.sc_onstack & SS_ONSTACK)
+ l->l_sigstk.ss_flags |= SS_ONSTACK;
+ else
+ l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+ /* Restore signal mask. */
+ (void) sigprocmask1(l, SIG_SETMASK, &sc.sc_mask, 0);
+ mutex_exit(p->p_lock);
+
+ return (EJUSTRETURN);
+}
+
+void
+netbsd32_machdep_md_16_init(void)
+{
+
+ MODULE_SET_HOOK(netbsd32_sendsig_hook, "nb32_16", netbsd32_sendsig_16);
+}
+
+void
+netbsd32_machdep_md_16_fini(void)
+{
+
+ MODULE_UNSET_HOOK(netbsd32_sendsig_hook);
+}
diff --git a/sys/arch/x68k/stand/aout2hux/Makefile b/sys/arch/x68k/stand/aout2hux/Makefile
index b91c42ad305..79e4a3791c8 100644
--- a/sys/arch/x68k/stand/aout2hux/Makefile
+++ b/sys/arch/x68k/stand/aout2hux/Makefile
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.6 2018/05/01 20:15:12 christos Exp $
+# $NetBSD: Makefile,v 1.7 2019/01/27 02:08:39 pgoyette Exp $
+
+.include <bsd.hostinit.mk>
.include <bsd.hostinit.mk>
diff --git a/sys/arch/x86/x86/cpu_ucode.c b/sys/arch/x86/x86/cpu_ucode.c
index 12f189d5b5d..011473daa69 100644
--- a/sys/arch/x86/x86/cpu_ucode.c
+++ b/sys/arch/x86/x86/cpu_ucode.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.9 2018/03/28 19:47:54 maxv Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.10 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,10 +29,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.9 2018/03/28 19:47:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.10 2019/01/27 02:08:39 pgoyette Exp $");
+#if defined(_KERNEL_OPT)
#include "opt_cpu_ucode.h"
#include "opt_xen.h"
+#endif
#include <sys/param.h>
#include <sys/cpuio.h>
diff --git a/sys/arch/x86/x86/cpu_ucode_amd.c b/sys/arch/x86/x86/cpu_ucode_amd.c
index 3579ce183fe..9446d13e46d 100644
--- a/sys/arch/x86/x86/cpu_ucode_amd.c
+++ b/sys/arch/x86/x86/cpu_ucode_amd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_amd.c,v 1.8 2018/03/17 15:56:32 christos Exp $ */
+/* $NetBSD: cpu_ucode_amd.c,v 1.9 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,10 +29,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_amd.c,v 1.8 2018/03/17 15:56:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_amd.c,v 1.9 2019/01/27 02:08:39 pgoyette Exp $");
+#ifdef _KERNEL_OPT
#include "opt_xen.h"
#include "opt_cpu_ucode.h"
+#endif
#include <sys/param.h>
#include <sys/conf.h>
diff --git a/sys/arch/x86/x86/cpu_ucode_intel.c b/sys/arch/x86/x86/cpu_ucode_intel.c
index 352817cedb1..90bb6f7be9f 100644
--- a/sys/arch/x86/x86/cpu_ucode_intel.c
+++ b/sys/arch/x86/x86/cpu_ucode_intel.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.14 2018/04/12 10:30:24 msaitoh Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.15 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,10 +29,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.14 2018/04/12 10:30:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.15 2019/01/27 02:08:39 pgoyette Exp $");
+#ifdef _KERNEL_OPT
#include "opt_xen.h"
#include "opt_cpu_ucode.h"
+#endif
#include <sys/param.h>
#include <sys/conf.h>
diff --git a/sys/arch/x86/x86/spectre.c b/sys/arch/x86/x86/spectre.c
index 061469224d3..42e9f48b79b 100644
--- a/sys/arch/x86/x86/spectre.c
+++ b/sys/arch/x86/x86/spectre.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spectre.c,v 1.22 2018/12/22 10:00:39 maxv Exp $ */
+/* $NetBSD: spectre.c,v 1.23 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.22 2018/12/22 10:00:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.23 2019/01/27 02:08:39 pgoyette Exp $");
+
+#include "opt_spectre.h"
#include "opt_spectre.h"
diff --git a/sys/arch/xen/conf/files.xen b/sys/arch/xen/conf/files.xen
index 497b783b793..9b8c6e1b3cb 100644
--- a/sys/arch/xen/conf/files.xen
+++ b/sys/arch/xen/conf/files.xen
@@ -1,4 +1,4 @@
-# $NetBSD: files.xen,v 1.175 2018/12/25 11:56:14 mlelstv Exp $
+# $NetBSD: files.xen,v 1.176 2019/01/27 02:08:39 pgoyette Exp $
# NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp
# NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp
@@ -331,6 +331,8 @@ file arch/amd64/amd64/compat_16_machdep.c compat_16
# NetBSD/i386 32-bit binary compatibility (COMPAT_NETBSD32)
include "compat/netbsd32/files.netbsd32"
file arch/amd64/amd64/netbsd32_machdep.c compat_netbsd32
+file arch/amd64/amd64/netbsd32_machdep_13.c compat_netbsd32 & compat_13
+file arch/amd64/amd64/netbsd32_machdep_16.c compat_netbsd32 & compat_16
file arch/amd64/amd64/netbsd32_sigcode.S compat_netbsd32 & compat_16
file arch/amd64/amd64/netbsd32_syscall.c compat_netbsd32
diff --git a/sys/arch/xen/x86/xen_ipi.c b/sys/arch/xen/x86/xen_ipi.c
index 258266f2508..6d36c7c1e67 100644
--- a/sys/arch/xen/x86/xen_ipi.c
+++ b/sys/arch/xen/x86/xen_ipi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.29 2018/12/24 14:55:42 cherry Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.30 2019/01/27 02:08:39 pgoyette Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,10 +33,12 @@
/*
* Based on: x86/ipi.c
- * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.29 2018/12/24 14:55:42 cherry Exp $");
+ * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.30 2019/01/27 02:08:39 pgoyette Exp $");
*/
-__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.29 2018/12/24 14:55:42 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.30 2019/01/27 02:08:39 pgoyette Exp $");
+
+#include "opt_ddb.h"
#include "opt_ddb.h"
diff --git a/sys/arch/xen/x86/xen_shm_machdep.c b/sys/arch/xen/x86/xen_shm_machdep.c
index f2c984af94c..6fe402a9730 100644
--- a/sys/arch/xen/x86/xen_shm_machdep.c
+++ b/sys/arch/xen/x86/xen_shm_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_shm_machdep.c,v 1.12 2018/07/27 09:22:40 maxv Exp $ */
+/* $NetBSD: xen_shm_machdep.c,v 1.13 2019/01/27 02:08:39 pgoyette Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_shm_machdep.c,v 1.12 2018/07/27 09:22:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_shm_machdep.c,v 1.13 2019/01/27 02:08:39 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
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/net/route_50.h b/sys/compat/net/route_50.h
new file mode 100644
index 00000000000..62a9738dac3
--- /dev/null
+++ b/sys/compat/net/route_50.h
@@ -0,0 +1,42 @@
+/* $NetBSD: route_50.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_50_H_
+#define _COMPAT_NET_ROUTE_50_H_
+
+#include <net/route.h>
+
+/* compat interfaces */
+
+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 */
diff --git a/sys/conf/Makefile.kern.inc b/sys/conf/Makefile.kern.inc
index 71362fd67bb..47bb1af3362 100644
--- a/sys/conf/Makefile.kern.inc
+++ b/sys/conf/Makefile.kern.inc
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.kern.inc,v 1.266 2018/09/22 12:24:04 rin Exp $
+# $NetBSD: Makefile.kern.inc,v 1.267 2019/01/27 02:08:41 pgoyette Exp $
#
# This file contains common `MI' targets and definitions and it is included
# at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -155,7 +155,7 @@ LINK_O?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}" && \
${KLINK.o}
##
-## (3) libkern and compat
+## (3) libkern
##
## Set OPT_MODULAR in the port Makefile if module(7) is enabled,
## as documented in $S/lib/libkern/Makefile.inc.
@@ -171,16 +171,6 @@ LIBKERN?= ${KERNLIB_PROF}
LIBKERNLN?= ${KERNLIBLN}
-### find out what to use for libcompat
-.include "$S/compat/common/Makefile.inc"
-.ifndef PROF
-SYSLIBCOMPAT?= ${COMPATLIB}
-.else
-SYSLIBCOMPAT?= ${COMPATLIB_PROF}
-.endif
-
-SYSLIBCOMPATLN?= ${COMPATLIBLN}
-
##
## (4) local objects, compile rules, and dependencies
##
@@ -205,7 +195,7 @@ _MD_OBJS= ${MD_OBJS}
# load lines for config "xxx" will be emitted as:
# xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel
-SYSTEM_LIB= ${MD_LIBS} ${SYSLIBCOMPAT} ${LIBKERN}
+SYSTEM_LIB= ${MD_LIBS} ${LIBKERN}
SYSTEM_OBJ?= ${_MD_OBJS} ${OBJS} ${SYSTEM_LIB}
SYSTEM_DEP+= Makefile ${SYSTEM_OBJ:O}
.if defined(CTFMERGE)
diff --git a/sys/conf/compat_netbsd80.config b/sys/conf/compat_netbsd80.config
new file mode 100644
index 00000000000..dc5323f979d
--- /dev/null
+++ b/sys/conf/compat_netbsd80.config
@@ -0,0 +1,9 @@
+# $NetBSD: compat_netbsd80.config,v 1.2 2019/01/27 02:08:41 pgoyette Exp $
+
+# Common fragment for all NetBSD targets wanting NetBSD 7.0 and newer
+# compatibility support.
+#
+# Note that COMPAT_80 implies all newer COMPAT_XX options.
+
+include "conf/compat_netbsd.config"
+options COMPAT_80 # NetBSD 8.0 and beyond.
diff --git a/sys/conf/files b/sys/conf/files
index c79d0a73057..ade9265191f 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1221 2018/12/29 11:30:12 maxv Exp $
+# $NetBSD: files,v 1.1222 2019/01/27 02:08:41 pgoyette Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20171118
@@ -157,13 +157,22 @@ defflag COMPAT_OSF1
defflag COMPAT_SUNOS: COMPAT_30
defflag COMPAT_ULTRIX: COMPAT_50
defflag COMPAT_NETBSD32
-defflag COMPAT_LINUX32 : COMPAT_LINUX, COMPAT_NETBSD32
+defflag COMPAT_SYSV
+defflag SYSV_IPC : SYSVSHM, SYSVSEM, SYSVMSG
+defflag COMPAT_NETBSD32_SYSVIPC : SYSV_IPC,
+ COMPAT_SYSV,
+ COMPAT_NETBSD32
+defflag COMPAT_LINUX32 : COMPAT_LINUX, COMPAT_NETBSD32,
+ COMPAT_50, COMPAT_SYSV,
+ COMPAT_NETBSD32_SYSVIPC
defflag COMPAT_AOUT_M68K: COMPAT_40
defflag COMPAT_M68K4K
defflag COMPAT_VAX1K
defflag COMPAT_43
defflag opt_compat_netbsd.h COMPAT_NOMID
+include "compat/common/files.common"
+
define machdep
defflag opt_machdep.h MACHDEP
diff --git a/sys/conf/std b/sys/conf/std
index d8af13d9c30..490e063f037 100644
--- a/sys/conf/std
+++ b/sys/conf/std
@@ -1,4 +1,4 @@
-# $NetBSD: std,v 1.22 2016/11/02 00:11:59 pgoyette Exp $
+# $NetBSD: std,v 1.23 2019/01/27 02:08:41 pgoyette Exp $
#
# standard MI 'options'
#
@@ -33,6 +33,11 @@ options COREDUMP # allow processes to coredump.
options AIO # POSIX asynchronous I/O
options MQUEUE # POSIX message queues
+# Common compatibility functions. They happen to be needed even when
+# no compatibility option is explicitly enabled.
+#
+options COMPAT_UTILS
+
#
# Security model.
#
diff --git a/sys/ddb/db_panic.c b/sys/ddb/db_panic.c
index da90784b539..04f4fcc0e31 100644
--- a/sys/ddb/db_panic.c
+++ b/sys/ddb/db_panic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_panic.c,v 1.8 2018/05/27 12:24:36 uwe Exp $ */
+/* $NetBSD: db_panic.c,v 1.9 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 2000, 2002, 2006, 2007, 2009, 2013 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_panic.c,v 1.8 2018/05/27 12:24:36 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_panic.c,v 1.9 2019/01/27 02:08:41 pgoyette Exp $");
#include <sys/types.h>
#include <sys/cpu.h>
diff --git a/sys/dev/acpi/acpi_pci.c b/sys/dev/acpi/acpi_pci.c
index 617f2143952..51aa29d91dd 100644
--- a/sys/dev/acpi/acpi_pci.c
+++ b/sys/dev/acpi/acpi_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.24 2018/10/21 11:04:26 jmcneill Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.25 2019/01/27 02:08:41 pgoyette Exp $ */
/*
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.24 2018/10/21 11:04:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.25 2019/01/27 02:08:41 pgoyette Exp $");
#include <sys/param.h>
#include <sys/device.h>
diff --git a/sys/dev/ata/ld_ataraid.c b/sys/dev/ata/ld_ataraid.c
index ee925d3b31e..986389bdecf 100644
--- a/sys/dev/ata/ld_ataraid.c
+++ b/sys/dev/ata/ld_ataraid.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_ataraid.c,v 1.48 2018/10/23 22:05:01 jdolecek Exp $ */
+/* $NetBSD: ld_ataraid.c,v 1.49 2019/01/27 02:08:41 pgoyette Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.48 2018/10/23 22:05:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.49 2019/01/27 02:08:41 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "bio.h"
diff --git a/sys/dev/bio.c b/sys/dev/bio.c
index 50505296ac2..bcc64a1ac6d 100644
--- a/sys/dev/bio.c
+++ b/sys/dev/bio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bio.c,v 1.13 2015/08/20 14:40:17 christos Exp $ */
+/* $NetBSD: bio.c,v 1.14 2019/01/27 02:08:41 pgoyette Exp $ */
/* $OpenBSD: bio.c,v 1.9 2007/03/20 02:35:55 marco Exp $ */
/*
@@ -28,7 +28,7 @@
/* A device controller ioctl tunnelling device. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.13 2015/08/20 14:40:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.14 2019/01/27 02:08:41 pgoyette Exp $");
#include "opt_compat_netbsd.h"
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.13 2015/08/20 14:40:17 christos Exp $");
#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>
@@ -127,10 +128,8 @@ bioioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
case BIOCDISK:
case BIOCDISK_NOVOL:
case BIOCVOL:
-#ifdef COMPAT_30
case OBIOCDISK:
case OBIOCVOL:
-#endif
error = kauth_authorize_device_passthru(l->l_cred, dev,
KAUTH_REQ_DEVICE_RAWIO_PASSTHRU_READCONF, addr);
if (error)
@@ -190,43 +189,12 @@ bioioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
return ENOENT;
}
mutex_exit(&bio_lock);
-#ifdef COMPAT_30
- 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 = bio_delegate_ioctl(common->bc_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 = bio_delegate_ioctl(common->bc_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;
- }
- }
-#endif
- error = bio_delegate_ioctl(common->bc_cookie, cmd, addr);
+ MODULE_CALL_HOOK(compat_bio_30_hook,
+ (common->bc_cookie, cmd, addr, bio_delegate_ioctl),
+ enosys(), error);
+ if (error == ENOSYS)
+ error = bio_delegate_ioctl(common->bc_cookie, cmd,
+ addr);
return error;
}
return 0;
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index 21ae7397255..d29ccdc09a7 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.176 2018/03/18 20:33:52 christos Exp $ */
+/* $NetBSD: ccd.c,v 1.177 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.176 2018/03/18 20:33:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.177 2019/01/27 02:08:41 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -115,6 +115,7 @@ __KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.176 2018/03/18 20:33:52 christos Exp $");
#include <sys/kthread.h>
#include <sys/bufq.h>
#include <sys/sysctl.h>
+#include <sys/compat_stub.h>
#include <uvm/uvm_extern.h>
@@ -1080,7 +1081,7 @@ ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
int unit = ccdunit(dev);
int i, j, lookedup = 0, error = 0;
- int part, pmask, make;
+ int part, pmask, make, hook;
struct ccd_softc *cs;
struct ccd_ioctl *ccio = (struct ccd_ioctl *)data;
kauth_cred_t uc;
@@ -1096,7 +1097,10 @@ ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
make = 1;
break;
default:
- if ((*compat_ccd_ioctl_60)(0, cmd, NULL, 0, NULL, NULL) == 0)
+ MODULE_CALL_HOOK(ccd_ioctl_60_hook,
+ (0, cmd, NULL, 0, NULL, NULL),
+ enosys(), hook);
+ if (hook == 0)
make = 1;
else
make = 0;
@@ -1107,7 +1111,9 @@ ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
return ENOENT;
uc = kauth_cred_get();
- error = (*compat_ccd_ioctl_60)(dev, cmd, data, flag, l, ccdioctl);
+ MODULE_CALL_HOOK(ccd_ioctl_60_hook,
+ (dev, cmd, data, flag, l, ccdioctl),
+ enosys(), error);
if (error != ENOSYS)
return error;
diff --git a/sys/dev/clockctl.c b/sys/dev/clockctl.c
index 0cf726e717b..bb8cc1e924d 100644
--- a/sys/dev/clockctl.c
+++ b/sys/dev/clockctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: clockctl.c,v 1.35 2016/11/21 03:53:59 rin Exp $ */
+/* $NetBSD: clockctl.c,v 1.36 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.35 2016/11/21 03:53:59 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.36 2019/01/27 02:08:41 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -46,18 +46,16 @@ __KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.35 2016/11/21 03:53:59 rin Exp $");
#include <sys/device.h>
#include <sys/time.h>
#include <sys/conf.h>
-#ifdef NTP
#include <sys/timex.h>
-#endif /* NTP */
#include <sys/kauth.h>
#include <sys/module.h>
#include <sys/mutex.h>
+#include <sys/compat_stub.h>
#include <sys/clockctl.h>
-#ifdef COMPAT_50
#include <compat/sys/clockctl.h>
#include <compat/sys/time_types.h>
-#endif
+
kmutex_t clockctl_mtx;
int clockctl_refcnt;
@@ -245,101 +243,31 @@ clockctlioctl(
error = clock_settime1(l->l_proc, args->clock_id, &ts, false);
break;
}
-#ifdef NTP
case CLOCKCTL_NTP_ADJTIME: {
struct clockctl_ntp_adjtime *args = data;
struct timex ntv;
+ if (vec_ntp_timestatus == NULL) {
+ error = ENOTTY;
+ break;
+ }
error = copyin(args->tp, &ntv, sizeof(ntv));
if (error)
return (error);
- ntp_adjtime1(&ntv);
+ (*vec_ntp_adjtime1)(&ntv);
error = copyout(&ntv, args->tp, sizeof(ntv));
if (error == 0)
- args->retval = ntp_timestatus();
- break;
- }
-#endif /* NTP */
- default:
-#ifdef COMPAT_50
- error = compat50_clockctlioctl(dev, cmd, data, flags, l);
-#else
- error = ENOTTY;
-#endif
- }
-
- return (error);
-}
-
-#ifdef COMPAT_50
-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);
+ args->retval = (*vec_ntp_timestatus)();
break;
}
-#ifdef NTP
- case CLOCKCTL_ONTP_ADJTIME: {
- /* The ioctl number changed but the data did not change. */
- error = (cd->d_ioctl)(dev, CLOCKCTL_NTP_ADJTIME,
- data, flags, l);
- break;
- }
-#endif
default:
- error = ENOTTY;
+ MODULE_CALL_HOOK(clockctl_ioctl_50_hook,
+ (dev, cmd, data, flags, l), enosys(), error);
+ if (error == ENOSYS)
+ error = ENOTTY;
}
return (error);
}
-#endif
diff --git a/sys/dev/fdt/fdt_subr.c b/sys/dev/fdt/fdt_subr.c
index 6ebf86267ab..21189ee5ba8 100644
--- a/sys/dev/fdt/fdt_subr.c
+++ b/sys/dev/fdt/fdt_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.24 2018/10/06 16:28:21 skrll Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.25 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.24 2018/10/06 16:28:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.25 2019/01/27 02:08:41 pgoyette Exp $");
+
+#include "opt_fdt.h"
#include "opt_fdt.h"
diff --git a/sys/dev/gpio/gpio.c b/sys/dev/gpio/gpio.c
index 30bfaa5ae00..630cca91754 100644
--- a/sys/dev/gpio/gpio.c
+++ b/sys/dev/gpio/gpio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.61 2018/05/19 13:59:06 thorpej Exp $ */
+/* $NetBSD: gpio.c,v 1.62 2019/01/27 02:08:41 pgoyette Exp $ */
/* $OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $ */
/*
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.61 2018/05/19 13:59:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.62 2019/01/27 02:08:41 pgoyette Exp $");
/*
* General Purpose Input/Output framework.
diff --git a/sys/dev/i2c/i2c.c b/sys/dev/i2c/i2c.c
index 53a3898790a..abd282a5cf1 100644
--- a/sys/dev/i2c/i2c.c
+++ b/sys/dev/i2c/i2c.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i2c.c,v 1.67 2018/12/09 19:21:16 jdolecek Exp $ */
+/* $NetBSD: i2c.c,v 1.68 2019/01/27 02:08:41 pgoyette Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.67 2018/12/09 19:21:16 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.68 2019/01/27 02:08:41 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/dev/ic/ne2000.c b/sys/dev/ic/ne2000.c
index a53f634beb1..8f76eceb5d4 100644
--- a/sys/dev/ic/ne2000.c
+++ b/sys/dev/ic/ne2000.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ne2000.c,v 1.75 2018/07/15 05:16:45 maxv Exp $ */
+/* $NetBSD: ne2000.c,v 1.76 2019/01/27 02:08:42 pgoyette Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.75 2018/07/15 05:16:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.76 2019/01/27 02:08:42 pgoyette Exp $");
#include "rtl80x9.h"
diff --git a/sys/dev/marvell/com_mv.c b/sys/dev/marvell/com_mv.c
index 11706626220..e3ab17c84fc 100644
--- a/sys/dev/marvell/com_mv.c
+++ b/sys/dev/marvell/com_mv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com_mv.c,v 1.11 2018/12/11 19:40:54 martin Exp $ */
+/* $NetBSD: com_mv.c,v 1.12 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 2007, 2010 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.11 2018/12/11 19:40:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.12 2019/01/27 02:08:42 pgoyette Exp $");
#include <sys/param.h>
#include <sys/bus.h>
diff --git a/sys/dev/pci/ahcisata_pci.c b/sys/dev/pci/ahcisata_pci.c
index 92e4fd178cd..79152f72c30 100644
--- a/sys/dev/pci/ahcisata_pci.c
+++ b/sys/dev/pci/ahcisata_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_pci.c,v 1.54 2019/01/22 22:22:06 jdolecek Exp $ */
+/* $NetBSD: ahcisata_pci.c,v 1.55 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.54 2019/01/22 22:22:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.55 2019/01/27 02:08:42 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_ahcisata_pci.h"
+#endif
#ifdef _KERNEL_OPT
#include "opt_ahcisata_pci.h"
diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c
index 179648ef19c..6e602209b5c 100644
--- a/sys/dev/pci/if_msk.c
+++ b/sys/dev/pci/if_msk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.84 2019/01/22 03:42:27 msaitoh Exp $ */
+/* $NetBSD: if_msk.c,v 1.85 2019/01/27 02:08:42 pgoyette Exp $ */
/* $OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $ */
/*
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.84 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.85 2019/01/27 02:08:42 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/dev/pci/if_ne_pci.c b/sys/dev/pci/if_ne_pci.c
index f5082407fc3..8003863ef18 100644
--- a/sys/dev/pci/if_ne_pci.c
+++ b/sys/dev/pci/if_ne_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ne_pci.c,v 1.39 2018/12/09 11:14:02 jdolecek Exp $ */
+/* $NetBSD: if_ne_pci.c,v 1.40 2019/01/27 02:08:42 pgoyette Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ne_pci.c,v 1.39 2018/12/09 11:14:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ne_pci.c,v 1.40 2019/01/27 02:08:42 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c
index cecfc558178..2c6d11c1f87 100644
--- a/sys/dev/pci/mpii.c
+++ b/sys/dev/pci/mpii.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.19 2018/12/28 15:06:07 kardel Exp $ */
+/* $NetBSD: mpii.c,v 1.20 2019/01/27 02:08:42 pgoyette Exp $ */
/* $OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $ */
/*
* Copyright (c) 2010, 2012 Mike Belopuhov
@@ -20,7 +20,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.19 2018/12/28 15:06:07 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.20 2019/01/27 02:08:42 pgoyette Exp $");
#include "bio.h"
diff --git a/sys/dev/pci/ppb.c b/sys/dev/pci/ppb.c
index d3166fc3c27..7acc0318edd 100644
--- a/sys/dev/pci/ppb.c
+++ b/sys/dev/pci/ppb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ppb.c,v 1.64 2018/12/07 09:36:26 msaitoh Exp $ */
+/* $NetBSD: ppb.c,v 1.65 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.64 2018/12/07 09:36:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.65 2019/01/27 02:08:42 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_ppb.h"
+#endif
#ifdef _KERNEL_OPT
#include "opt_ppb.h"
diff --git a/sys/dev/pci/virtio_pci.c b/sys/dev/pci/virtio_pci.c
index 5d5430c264e..de884218d43 100644
--- a/sys/dev/pci/virtio_pci.c
+++ b/sys/dev/pci/virtio_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.6 2019/01/14 14:55:37 yamaguchi Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.7 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.6 2019/01/14 14:55:37 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7 2019/01/27 02:08:42 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -853,4 +853,3 @@ virtio_pci_modcmd(modcmd_t cmd, void *opaque)
return error;
}
-
diff --git a/sys/dev/raidframe/rf_compat50.c b/sys/dev/raidframe/rf_compat50.c
index e637ecb02eb..108385a5481 100644
--- a/sys/dev/raidframe/rf_compat50.c
+++ b/sys/dev/raidframe/rf_compat50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_compat50.c,v 1.3 2018/01/18 00:32:49 mrg Exp $ */
+/* $NetBSD: rf_compat50.c,v 1.4 2019/01/27 02:08:42 pgoyette Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -39,12 +39,16 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
+
+#include <sys/compat_stub.h>
#include <dev/raidframe/raidframeio.h>
#include <dev/raidframe/raidframevar.h>
#include "rf_raid.h"
#include "rf_compat50.h"
+#include "rf_compat50_mod.h"
#include "rf_debugMem.h"
typedef struct RF_Config50_s {
@@ -214,3 +218,56 @@ out:
RF_Free(d_cfg, sizeof(RF_DeviceConfig50_t));
return error;
}
+
+int
+raidframe_ioctl_50(int cmd, int initted, RF_Raid_t *raidPtr, int unit,
+ void *data, RF_Config_t **k_cfg)
+{
+ int error;
+
+ switch (cmd) {
+ case RAIDFRAME_GET_INFO50:
+ if (initted == 0)
+ return ENXIO;
+ return rf_get_info50(raidPtr, data);
+
+ case RAIDFRAME_CONFIGURE50:
+ error = rf_config50(raidPtr, unit, data, k_cfg);
+ if (error != 0)
+ return error;
+ return EAGAIN; /* flag mainline to call generic config */
+ }
+ return EPASSTHROUGH;
+}
+
+void
+raidframe_50_init(void)
+{
+
+ MODULE_SET_HOOK(raidframe50_ioctl_hook, "raid50", raidframe_ioctl_50);
+}
+
+void
+raidframe_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(raidframe50_ioctl_hook);
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_raid_50, "raid,compat_50,compat_raid_80");
+
+static int
+compat_raid_50_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ raidframe_50_init();
+ return 0;
+ case MODULE_CMD_FINI:
+ raidframe_50_fini();
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/dev/raidframe/rf_compat50.h b/sys/dev/raidframe/rf_compat50.h
index 29990c8f4dc..69d3aa82593 100644
--- a/sys/dev/raidframe/rf_compat50.h
+++ b/sys/dev/raidframe/rf_compat50.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_compat50.h,v 1.2 2015/09/06 06:01:00 dholland Exp $ */
+/* $NetBSD: rf_compat50.h,v 1.3 2019/01/27 02:08:42 pgoyette Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -47,4 +47,6 @@
int rf_config50(RF_Raid_t *, int, void *, RF_Config_t **);
int rf_get_info50(RF_Raid_t *, void *);
+int raidframe_ioctl_50(int, int, RF_Raid_t *, int, void *, RF_Config_t **);
+
#endif /* _RF_COMPAT50_H_ */
diff --git a/sys/dev/raidframe/rf_compat50_mod.h b/sys/dev/raidframe/rf_compat50_mod.h
new file mode 100644
index 00000000000..a9447d00beb
--- /dev/null
+++ b/sys/dev/raidframe/rf_compat50_mod.h
@@ -0,0 +1,39 @@
+/* $NetBSD: rf_compat50_mod.h,v 1.2 2019/01/27 02:08:42 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 _RF_COMPAT50_MOD_H_
+#define _RF_COMPAT50_MOD_H_
+
+void raidframe_50_fini(void);
+void raidframe_50_init(void);
+
+#endif /* _RF_COMPAT50_MOD_H_ */
diff --git a/sys/dev/raidframe/rf_compat80.c b/sys/dev/raidframe/rf_compat80.c
index 53b963da8a3..b6a204b41e4 100644
--- a/sys/dev/raidframe/rf_compat80.c
+++ b/sys/dev/raidframe/rf_compat80.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_compat80.c,v 1.2 2018/01/20 01:32:45 mrg Exp $ */
+/* $NetBSD: rf_compat80.c,v 1.3 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 2017 Matthew R. Green
@@ -31,12 +31,16 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/module.h>
+
+#include <sys/compat_stub.h>
#include <dev/raidframe/raidframeio.h>
#include <dev/raidframe/raidframevar.h>
#include "rf_raid.h"
#include "rf_compat80.h"
+#include "rf_compat80_mod.h"
#include "rf_kintf.h"
int
@@ -217,3 +221,78 @@ rf_config80(RF_Raid_t *raidPtr, int unit, void *data, RF_Config_t **k_cfgp)
*k_cfgp = k_cfg;
return 0;
}
+
+int
+raidframe_ioctl_80(int cmd, int initted, RF_Raid_t *raidPtr, int unit,
+ void *data, RF_Config_t **k_cfg)
+{
+int error;
+
+ switch (cmd) {
+ case RAIDFRAME_CHECK_RECON_STATUS_EXT80:
+ case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT80:
+ case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT80:
+ case RAIDFRAME_GET_INFO80:
+ case RAIDFRAME_GET_COMPONENT_LABEL80:
+ if (initted == 0)
+ return ENXIO;
+ break;
+ case RAIDFRAME_CONFIGURE80:
+ break;
+ case RAIDFRAME_FAIL_DISK80:
+ return EPASSTHROUGH;
+ default:
+ return EINVAL;
+ }
+
+ switch (cmd) {
+ case RAIDFRAME_CHECK_RECON_STATUS_EXT80:
+ return rf_check_recon_status_ext80(raidPtr, data);
+ case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT80:
+ return rf_check_parityrewrite_status_ext80(raidPtr, data);
+ case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT80:
+ return rf_check_copyback_status_ext80(raidPtr, data);
+ case RAIDFRAME_GET_INFO80:
+ return rf_get_info80(raidPtr, data);
+ case RAIDFRAME_GET_COMPONENT_LABEL80:
+ return rf_get_component_label80(raidPtr, data);
+ case RAIDFRAME_CONFIGURE80:
+ error = rf_config80(raidPtr, unit, data, k_cfg);
+ if (error != 0)
+ return error;
+ return EAGAIN; /* flag mainline to call generic config */
+ }
+ return EPASSTHROUGH;
+}
+
+void
+raidframe_80_init(void)
+{
+
+ MODULE_SET_HOOK(raidframe80_ioctl_hook, "raid80", raidframe_ioctl_80);
+}
+
+void
+raidframe_80_fini(void)
+{
+
+ MODULE_UNSET_HOOK(raidframe80_ioctl_hook);
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_raid_80, "raid,compat_80");
+
+static int
+compat_raid_80_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ raidframe_80_init();
+ return 0;
+ case MODULE_CMD_FINI:
+ raidframe_80_fini();
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/dev/raidframe/rf_compat80_mod.h b/sys/dev/raidframe/rf_compat80_mod.h
new file mode 100644
index 00000000000..9f0a627e5d8
--- /dev/null
+++ b/sys/dev/raidframe/rf_compat80_mod.h
@@ -0,0 +1,44 @@
+/* $NetBSD: rf_compat80_mod.h,v 1.2 2019/01/27 02:08:42 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 _RF_COMPAT80_MOD_H_
+#define _RF_COMPAT80_MOD_H_
+
+struct RF_Raid_s;
+struct RF_Config_s;
+
+int raidframe_ioctl_80(int, int, struct RF_Raid_s *, int, void *,
+ struct RF_Config_s **);
+
+void raidframe_80_init(void);
+void raidframe_80_fini(void);
+
+#endif /* _RF_COMPAT80_MOD_H_ */
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index 67182036a93..f373aaf0397 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.357 2019/01/08 07:18:18 mrg Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.358 2019/01/27 02:08:42 pgoyette Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.357 2019/01/08 07:18:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.358 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -128,6 +128,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.357 2019/01/08 07:18:18 mrg Exp
#include <sys/reboot.h>
#include <sys/kauth.h>
#include <sys/module.h>
+#include <sys/compat_stub.h>
#include <prop/proplib.h>
@@ -149,13 +150,9 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.357 2019/01/08 07:18:18 mrg Exp
#include "rf_parityscan.h"
#include "rf_threadstuff.h"
-#ifdef COMPAT_50
#include "rf_compat50.h"
-#endif
-#ifdef COMPAT_80
#include "rf_compat80.h"
-#endif
#ifdef COMPAT_NETBSD32
#include "rf_compat32.h"
@@ -1104,16 +1101,6 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
case RAIDFRAME_PARITYMAP_GET_DISABLE:
case RAIDFRAME_PARITYMAP_SET_DISABLE:
case RAIDFRAME_PARITYMAP_SET_PARAMS:
-#ifdef COMPAT_50
- case RAIDFRAME_GET_INFO50:
-#endif
-#ifdef COMPAT_80
- case RAIDFRAME_CHECK_RECON_STATUS_EXT80:
- case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT80:
- case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT80:
- case RAIDFRAME_GET_INFO80:
- case RAIDFRAME_GET_COMPONENT_LABEL80:
-#endif
#ifdef COMPAT_NETBSD32
#ifdef _LP64
case RAIDFRAME_GET_INFO32:
@@ -1123,38 +1110,44 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
return (ENXIO);
}
- switch (cmd) {
-#ifdef COMPAT_50
- case RAIDFRAME_GET_INFO50:
- return rf_get_info50(raidPtr, data);
-
- case RAIDFRAME_CONFIGURE50:
- if ((retcode = rf_config50(raidPtr, unit, data, &k_cfg)) != 0)
- return retcode;
+ /*
+ * Handle compat ioctl calls
+ *
+ * * If compat code is not loaded, stub returns ENOSYS and we just
+ * check the "native" cmd's
+ * * If compat code is loaded but does not recognize the cmd, it
+ * returns EPASSTHROUGH, and we just check the "native" cmd's
+ * * If compat code returns EAGAIN, we need to finish via config
+ * * Otherwise the cmd has been handled and we just return
+ */
+ MODULE_CALL_HOOK(raidframe50_ioctl_hook,
+ (cmd, (rs->sc_flags & RAIDF_INITED),raidPtr, unit, data, &k_cfg),
+ enosys(), retcode);
+ if (retcode == ENOSYS)
+ retcode = 0;
+ else if (retcode == EAGAIN)
goto config;
-#endif
-
-#ifdef COMPAT_80
- case RAIDFRAME_CHECK_RECON_STATUS_EXT80:
- return rf_check_recon_status_ext80(raidPtr, data);
-
- case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT80:
- return rf_check_parityrewrite_status_ext80(raidPtr, data);
-
- case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT80:
- return rf_check_copyback_status_ext80(raidPtr, data);
-
- case RAIDFRAME_GET_INFO80:
- return rf_get_info80(raidPtr, data);
+ else if (retcode != EPASSTHROUGH)
+ return retcode;
+
+ MODULE_CALL_HOOK(raidframe80_ioctl_hook,
+ (cmd, (rs->sc_flags & RAIDF_INITED),raidPtr, unit, data, &k_cfg),
+ enosys(), retcode);
+ if (retcode == ENOSYS)
+ retcode = 0;
+ else if (retcode == EAGAIN)
+ goto config;
+ else if (retcode != EPASSTHROUGH)
+ return retcode;
- case RAIDFRAME_GET_COMPONENT_LABEL80:
- return rf_get_component_label80(raidPtr, data);
+ /*
+ * XXX
+ * Handling of FAIL_DISK80 command requires us to retain retcode's
+ * value of EPASSTHROUGH. If you add more compat code later, make
+ * sure you don't overwrite retcode and break this!
+ */
- case RAIDFRAME_CONFIGURE80:
- if ((retcode = rf_config80(raidPtr, unit, data, &k_cfg)) != 0)
- return retcode;
- goto config;
-#endif
+ switch (cmd) {
/* configure the system */
case RAIDFRAME_CONFIGURE:
@@ -1563,11 +1556,12 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
return (0);
/* fail a disk & optionally start reconstruction */
- case RAIDFRAME_FAIL_DISK:
-#ifdef COMPAT_80
case RAIDFRAME_FAIL_DISK80:
-#endif
-
+ /* Check if we called compat code for this cmd */
+ if (retcode != EPASSTHROUGH)
+ return EINVAL;
+ /* FALLTHRU */
+ case RAIDFRAME_FAIL_DISK:
if (raidPtr->Layout.map->faultsTolerated == 0) {
/* Can't do this on a RAID 0!! */
return(EINVAL);
diff --git a/sys/dev/sysmon/sysmon_power.c b/sys/dev/sysmon/sysmon_power.c
index 7872d425d45..97065e2f92e 100644
--- a/sys/dev/sysmon/sysmon_power.c
+++ b/sys/dev/sysmon/sysmon_power.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_power.c,v 1.58 2017/10/25 08:12:39 maya Exp $ */
+/* $NetBSD: sysmon_power.c,v 1.59 2019/01/27 02:08:42 pgoyette Exp $ */
/*-
* Copyright (c) 2007 Juan Romero Pardines.
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.58 2017/10/25 08:12:39 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.59 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.58 2017/10/25 08:12:39 maya Exp $
#include <sys/rndsource.h>
#include <sys/module.h>
#include <sys/once.h>
+#include <sys/compat_stub.h>
#include <dev/sysmon/sysmonvar.h>
#include <prop/proplib.h>
@@ -344,16 +345,10 @@ sysmon_power_daemon_task(struct power_event_dictionary *ped,
(struct sysmon_pswitch *)pev_data;
pev.pev_type = POWER_EVENT_SWITCH_STATE_CHANGE;
-#ifdef COMPAT_40
- pev.pev_switch.psws_state = event;
- pev.pev_switch.psws_type = pswitch->smpsw_type;
-
- if (pswitch->smpsw_name) {
- (void)strlcpy(pev.pev_switch.psws_name,
- pswitch->smpsw_name,
- sizeof(pev.pev_switch.psws_name));
- }
-#endif
+
+ MODULE_CALL_VOID_HOOK(compat_sysmon_power_40_hook,
+ (&pev, pswitch, event), __nothing);
+
error = sysmon_power_make_dictionary(ped->dict,
pswitch,
event,
diff --git a/sys/dev/usb/if_bwfm_usb.c b/sys/dev/usb/if_bwfm_usb.c
index e225bb60707..1396d5f5977 100644
--- a/sys/dev/usb/if_bwfm_usb.c
+++ b/sys/dev/usb/if_bwfm_usb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_usb.c,v 1.8 2018/09/01 22:01:03 riastradh Exp $ */
+/* $NetBSD: if_bwfm_usb.c,v 1.9 2019/01/27 02:08:42 pgoyette Exp $ */
/* $OpenBSD: if_bwfm_usb.c,v 1.2 2017/10/15 14:55:13 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.c,v 1.8 2018/09/01 22:01:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.c,v 1.9 2019/01/27 02:08:42 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/dev/usb/if_smsc.c b/sys/dev/usb/if_smsc.c
index be57db71958..0755fd2be7a 100644
--- a/sys/dev/usb/if_smsc.c
+++ b/sys/dev/usb/if_smsc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_smsc.c,v 1.40 2019/01/22 06:37:54 skrll Exp $ */
+/* $NetBSD: if_smsc.c,v 1.41 2019/01/27 02:08:42 pgoyette Exp $ */
/* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */
/* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.40 2019/01/22 06:37:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.41 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c
index a9ebbe0ed98..6f62b57c796 100644
--- a/sys/dev/usb/if_umb.c
+++ b/sys/dev/usb/if_umb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_umb.c,v 1.7 2018/11/15 10:56:30 maxv Exp $ */
+/* $NetBSD: if_umb.c,v 1.8 2019/01/27 02:08:42 pgoyette Exp $ */
/* $OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
/*
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.7 2018/11/15 10:56:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.8 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c
index 790ceb25313..e479ad7e4a8 100644
--- a/sys/dev/usb/ugen.c
+++ b/sys/dev/usb/ugen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.141 2018/11/08 01:59:53 manu Exp $ */
+/* $NetBSD: ugen.c,v 1.142 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.141 2018/11/08 01:59:53 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.142 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.141 2018/11/08 01:59:53 manu Exp $");
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/poll.h>
+#include <sys/compat_stub.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -1835,13 +1836,17 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
usbd_fill_deviceinfo(sc->sc_udev,
(struct usb_device_info *)addr, 0);
break;
-#ifdef COMPAT_30
case USB_GET_DEVICEINFO_OLD:
- usbd_fill_deviceinfo_old(sc->sc_udev,
- (struct usb_device_info_old *)addr, 0);
-
- break;
-#endif
+ {
+ int ret;
+ MODULE_CALL_HOOK(usb_subr_30_fill_hook,
+ (sc->sc_udev, (struct usb_device_info_old *)addr, 0,
+ usbd_devinfo_vp, usbd_printBCD),
+ enosys(), ret);
+ if (ret == 0)
+ return 0;
+ return EINVAL;
+ }
default:
return EINVAL;
}
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index b8f9923bc37..21048fb33bd 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhid.c,v 1.102 2018/09/03 16:29:34 riastradh Exp $ */
+/* $NetBSD: uhid.c,v 1.103 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2004, 2008, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.102 2018/09/03 16:29:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.103 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.102 2018/09/03 16:29:34 riastradh Exp $")
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/intr.h>
+#include <sys/compat_stub.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@@ -652,13 +653,15 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, void *addr,
usbd_fill_deviceinfo(sc->sc_hdev.sc_parent->sc_udev,
(struct usb_device_info *)addr, 0);
break;
-#ifdef COMPAT_30
case USB_GET_DEVICEINFO_OLD:
- usbd_fill_deviceinfo_old(sc->sc_hdev.sc_parent->sc_udev,
- (struct usb_device_info_old *)addr, 0);
-
+ MODULE_CALL_HOOK(usb_subr_30_fill_hook,
+ (sc->sc_hdev.sc_parent->sc_udev,
+ (struct usb_device_info_old *)addr, 0,
+ usbd_devinfo_vp, usbd_printBCD),
+ enosys(), err);
+ if (err == 0)
+ return 0;
break;
-#endif
case USB_GET_STRING_DESC:
{
struct usb_string_desc *si = (struct usb_string_desc *)addr;
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index aa359da935b..873504b14f7 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.174 2018/09/18 05:37:54 mrg Exp $ */
+/* $NetBSD: usb.c,v 1.175 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.174 2018/09/18 05:37:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.175 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -64,6 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.174 2018/09/18 05:37:54 mrg Exp $");
#include <sys/once.h>
#include <sys/atomic.h>
#include <sys/sysctl.h>
+#include <sys/compat_stub.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -201,10 +202,6 @@ Static int usb_get_next_event(struct usb_event *);
Static void usb_async_intr(void *);
Static void usb_soft_intr(void *);
-#ifdef COMPAT_30
-Static void usb_copy_old_devinfo(struct usb_device_info_old *, const struct usb_device_info *);
-#endif
-
Static const char *usbrev_str[] = USBREV_STR;
static int usb_match(device_t, cfdata_t, void *);
@@ -663,22 +660,18 @@ int
usbread(dev_t dev, struct uio *uio, int flag)
{
struct usb_event *ue;
-#ifdef COMPAT_30
struct usb_event_old *ueo = NULL; /* XXXGCC */
int useold = 0;
-#endif
int error, n;
if (minor(dev) != USB_DEV_MINOR)
return ENXIO;
switch (uio->uio_resid) {
-#ifdef COMPAT_30
case sizeof(struct usb_event_old):
ueo = kmem_zalloc(sizeof(struct usb_event_old), KM_SLEEP);
useold = 1;
/* FALLTHRU */
-#endif
case sizeof(struct usb_event):
ue = usb_alloc_event();
break;
@@ -702,43 +695,20 @@ usbread(dev_t dev, struct uio *uio, int flag)
}
mutex_exit(&usb_event_lock);
if (!error) {
-#ifdef COMPAT_30
if (useold) { /* copy fields to old struct */
- 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:
- ;
- }
+ MODULE_CALL_HOOK(usb_subr_30_copy_hook,
+ (ue, ueo, uio), enosys(), error);
+ if (error == ENOSYS)
+ error = EINVAL;
- error = uiomove((void *)ueo, sizeof(*ueo), uio);
+ if (!error)
+ error = uiomove((void *)ueo, sizeof(*ueo), uio);
} else
-#endif
error = uiomove((void *)ue, sizeof(*ue), uio);
}
usb_free_event(ue);
-#ifdef COMPAT_30
- if (useold)
+ if (ueo)
kmem_free(ueo, sizeof(struct usb_event_old));
-#endif
return error;
}
@@ -892,7 +862,6 @@ usbioctl(dev_t devt, u_long cmd, void *data, int flag, struct lwp *l)
break;
}
-#ifdef COMPAT_30
case USB_DEVICEINFO_OLD:
{
struct usbd_device *dev;
@@ -908,10 +877,14 @@ usbioctl(dev_t devt, u_long cmd, void *data, int flag, struct lwp *l)
error = ENXIO;
goto fail;
}
- usbd_fill_deviceinfo_old(dev, di, 1);
- break;
+ MODULE_CALL_HOOK(usb_subr_30_fill_hook,
+ (dev, di, 1, usbd_devinfo_vp, usbd_printBCD),
+ enosys(), error);
+ if (error == ENOSYS)
+ error = EINVAL;
+ if (error)
+ goto fail;
}
-#endif
case USB_DEVICESTATS:
*(struct usb_device_stats *)data = sc->sc_bus->ub_stats;
@@ -1259,62 +1232,3 @@ usb_detach(device_t self, int flags)
return 0;
}
-
-#ifdef COMPAT_30
-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));
-}
-#endif
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c
index 4c74c63e80a..32f5ac291e2 100644
--- a/sys/dev/usb/usb_subr.c
+++ b/sys/dev/usb/usb_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.228 2018/10/23 01:49:37 manu Exp $ */
+/* $NetBSD: usb_subr.c,v 1.229 2019/01/27 02:08:42 pgoyette Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.228 2018/10/23 01:49:37 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.229 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -68,8 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.228 2018/10/23 01:49:37 manu Exp $");
Static usbd_status usbd_set_config(struct usbd_device *, int);
Static void usbd_devinfo(struct usbd_device *, int, char *, size_t);
-Static void usbd_devinfo_vp(struct usbd_device *, char *, size_t, char *, size_t,
- int, int);
Static int usbd_getnewaddr(struct usbd_bus *);
Static int usbd_print(void *, const char *);
Static int usbd_ifprint(void *, const char *);
@@ -194,7 +192,7 @@ usbd_get_device_strings(struct usbd_device *ud)
}
-Static void
+void
usbd_devinfo_vp(struct usbd_device *dev, char *v, size_t vl, char *p,
size_t pl, int usedev, int useencoded)
{
@@ -1587,76 +1585,6 @@ usbd_fill_deviceinfo(struct usbd_device *dev, struct usb_device_info *di,
di->udi_nports = nports;
}
-#ifdef COMPAT_30
-void
-usbd_fill_deviceinfo_old(struct usbd_device *dev, struct usb_device_info_old *di,
- int usedev)
-{
- 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;
- usbd_devinfo_vp(dev, di->udi_vendor, sizeof(di->udi_vendor),
- di->udi_product, sizeof(di->udi_product), usedev, 0);
- usbd_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;
- }
-
- 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;
-}
-#endif
-
-
void
usb_free_device(struct usbd_device *dev)
{
diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h
index bef17f70f11..6c228d6119c 100644
--- a/sys/dev/usb/usbdi.h
+++ b/sys/dev/usb/usbdi.h
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.h,v 1.95 2018/08/02 06:09:04 riastradh Exp $ */
+/* $NetBSD: usbdi.h,v 1.96 2019/01/27 02:08:42 pgoyette Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@@ -158,10 +158,6 @@ usbd_status usbd_get_interface(struct usbd_interface *, uint8_t *);
int usbd_get_no_alts(usb_config_descriptor_t *, int);
void usbd_fill_deviceinfo(struct usbd_device *, struct usb_device_info *, int);
-#ifdef COMPAT_30
-void usbd_fill_deviceinfo_old(struct usbd_device *, struct usb_device_info_old *,
- int);
-#endif
int usbd_get_interface_altindex(struct usbd_interface *);
usb_interface_descriptor_t *usbd_find_idesc(usb_config_descriptor_t *,
@@ -235,6 +231,12 @@ const struct usb_devno *usb_match_device(const struct usb_devno *,
usb_match_device((const struct usb_devno *)(tbl), sizeof(tbl) / sizeof((tbl)[0]), sizeof((tbl)[0]), (vendor), (product))
#define USB_PRODUCT_ANY 0xffff
+/* compat callbacks */
+void usbd_devinfo_vp(struct usbd_device *, char *, size_t, char *, size_t,
+ int, int);
+int usbd_printBCD(char *, size_t, int);
+
+
/* NetBSD attachment information */
/* Attach data */
diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h
index 43fd14d2f17..245cb72dfc9 100644
--- a/sys/dev/usb/usbdivar.h
+++ b/sys/dev/usb/usbdivar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.117 2018/08/09 06:26:47 mrg Exp $ */
+/* $NetBSD: usbdivar.h,v 1.118 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -324,7 +324,6 @@ usbd_status usbd_reattach_device(device_t, struct usbd_device *,
int, const int *);
void usbd_remove_device(struct usbd_device *, struct usbd_port *);
-int usbd_printBCD(char *, size_t, int);
usbd_status usbd_fill_iface_data(struct usbd_device *, int, int);
void usb_free_device(struct usbd_device *);
diff --git a/sys/dev/usb/usbroothub.c b/sys/dev/usb/usbroothub.c
index 5912d713edb..2e0791a0c04 100644
--- a/sys/dev/usb/usbroothub.c
+++ b/sys/dev/usb/usbroothub.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbroothub.c,v 1.7 2018/09/03 16:29:34 riastradh Exp $ */
+/* $NetBSD: usbroothub.c,v 1.8 2019/01/27 02:08:42 pgoyette Exp $ */
/*-
* Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbroothub.c,v 1.7 2018/09/03 16:29:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbroothub.c,v 1.8 2019/01/27 02:08:42 pgoyette Exp $");
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 7ea35b591a7..549cc86e197 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.270 2018/12/10 15:22:35 hannken Exp $ */
+/* $NetBSD: vnd.c,v 1.271 2019/01/27 02:08:41 pgoyette Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.270 2018/12/10 15:22:35 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.271 2019/01/27 02:08:41 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@@ -120,6 +120,7 @@ __KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.270 2018/12/10 15:22:35 hannken Exp $");
#include <sys/conf.h>
#include <sys/kauth.h>
#include <sys/module.h>
+#include <sys/compat_stub.h>
#include <net/zlib.h>
@@ -1150,40 +1151,43 @@ vndioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
#endif
/* Do the get's first; they don't need initialization or verification */
switch (cmd) {
-#ifdef COMPAT_30
- case VNDIOCGET30: {
+ case VNDIOCGET:
if ((error = vndioctl_get(l, data, unit, &vattr)) != 0)
return error;
- struct vnd_user30 *vnu = data;
+ struct vnd_user *vnu = data;
vnu->vnu_dev = vattr.va_fsid;
vnu->vnu_ino = vattr.va_fileid;
return 0;
- }
-#endif
-#ifdef COMPAT_50
- case VNDIOCGET50: {
- if ((error = vndioctl_get(l, data, unit, &vattr)) != 0)
- return error;
- struct vnd_user50 *vnu = data;
- vnu->vnu_dev = vattr.va_fsid;
- vnu->vnu_ino = vattr.va_fileid;
- return 0;
- }
-#endif
+ default:
+ /* First check for COMPAT_50 hook */
+ MODULE_CALL_HOOK(compat_vndioctl_50_hook,
+ (cmd, l, data, unit, &vattr, vndioctl_get),
+ enosys(), error);
- case VNDIOCGET: {
- if ((error = vndioctl_get(l, data, unit, &vattr)) != 0)
- return error;
+ /*
+ * If not present, then COMPAT_30 hook also not
+ * present, so just continue with checks for the
+ * "write" commands
+ */
+ if (error == ENOSYS) {
+ error = 0;
+ break;
+ }
- struct vnd_user *vnu = data;
- vnu->vnu_dev = vattr.va_fsid;
- vnu->vnu_ino = vattr.va_fileid;
- return 0;
- }
- default:
- break;
+ /* If not already handled, try the COMPAT_30 hook */
+ if (error == EPASSTHROUGH)
+ MODULE_CALL_HOOK(compat_vndioctl_30_hook,
+ (cmd, l, data, unit, &vattr, vndioctl_get),
+ enosys(), error);
+
+ /* If no COMPAT_30 module, or not handled, check writes */
+ if (error == ENOSYS || error == EPASSTHROUGH) {
+ error = 0;
+ break;
+ }
+ return error;
}
vnd = device_lookup_private(&vnd_cd, unit);
@@ -1193,12 +1197,13 @@ vndioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
/* Must be open for writes for these commands... */
switch (cmd) {
- case VNDIOCSET:
- case VNDIOCCLR:
-#ifdef COMPAT_50
case VNDIOCSET50:
case VNDIOCCLR50:
-#endif
+ if (!compat_vndioctl_50_hook.hooked)
+ return EINVAL;
+ /* FALLTHROUGH */
+ case VNDIOCSET:
+ case VNDIOCCLR:
case DIOCSDINFO:
case DIOCWDINFO:
#ifdef __HAVE_OLD_DISKLABEL
@@ -1214,9 +1219,7 @@ vndioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
/* Must be initialized for these... */
switch (cmd) {
case VNDIOCCLR:
-#ifdef VNDIOCCLR50
case VNDIOCCLR50:
-#endif
case DIOCGDINFO:
case DIOCSDINFO:
case DIOCWDINFO:
@@ -1241,9 +1244,7 @@ vndioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
switch (cmd) {
-#ifdef VNDIOCSET50
case VNDIOCSET50:
-#endif
case VNDIOCSET:
if (vnd->sc_flags & VNF_INITED)
return EBUSY;
@@ -1496,9 +1497,7 @@ vndioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
vndthrottle(vnd, vnd->sc_vp);
vio->vnd_osize = dbtob(vnd->sc_size);
-#ifdef VNDIOCSET50
if (cmd != VNDIOCSET50)
-#endif
vio->vnd_size = dbtob(vnd->sc_size);
vnd->sc_flags |= VNF_INITED;
@@ -1558,9 +1557,7 @@ unlock_and_exit:
vndunlock(vnd);
return error;
-#ifdef VNDIOCCLR50
case VNDIOCCLR50:
-#endif
case VNDIOCCLR:
part = DISKPART(dev);
pmask = (1 << part);
diff --git a/sys/dev/wscons/files.wscons b/sys/dev/wscons/files.wscons
index 8c8102cfe90..6ffc0d9d7cd 100644
--- a/sys/dev/wscons/files.wscons
+++ b/sys/dev/wscons/files.wscons
@@ -1,4 +1,4 @@
-# $NetBSD: files.wscons,v 1.55 2017/12/18 18:59:32 jmcneill Exp $
+# $NetBSD: files.wscons,v 1.56 2019/01/27 02:08:42 pgoyette Exp $
#
# "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@@ -58,6 +58,7 @@ file dev/wscons/wsemul_vt100_subr.c wsdisplay & wsemul_vt100
file dev/wscons/wsemul_vt100_chars.c wsdisplay & wsemul_vt100
file dev/wscons/wsemul_vt100_keys.c wsdisplay & wsemul_vt100
file dev/wscons/wsevent.c wsdisplay | wskbd | wsmouse | wsmux
+file dev/wscons/wsevent_50.c compat_50
file dev/wscons/wskbd.c wskbd needs-flag
file dev/wscons/wskbdutil.c wskbd needs-flag
file dev/wscons/wsmouse.c wsmouse needs-flag
diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c
index c26947fc849..6281798b486 100644
--- a/sys/dev/wscons/wsevent.c
+++ b/sys/dev/wscons/wsevent.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsevent.c,v 1.39 2018/06/14 10:30:55 uwe Exp $ */
+/* $NetBSD: wsevent.c,v 1.40 2019/01/27 02:08:42 pgoyette Exp $ */
/*-
* Copyright (c) 2006, 2008 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.39 2018/06/14 10:30:55 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.40 2019/01/27 02:08:42 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -120,6 +120,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.39 2018/06/14 10:30:55 uwe Exp $");
#include <sys/vnode.h>
#include <sys/select.h>
#include <sys/poll.h>
+#include <sys/compat_stub.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wseventvar.h>
@@ -188,47 +189,19 @@ wsevent_fini(struct wseventvar *ev)
softint_disestablish(ev->sih);
}
-#if defined(COMPAT_50) || defined(MODULAR)
-static int
-wsevent_copyout_events50(const struct wscons_event *events, int cnt,
- struct uio *uio)
-{
- int i;
-
- for (i = 0; i < cnt; i++) {
- const struct wscons_event *ev = &events[i];
- struct owscons_event ev50;
- int error;
-
- ev50.type = ev->type;
- ev50.value = ev->value;
- timespec_to_timespec50(&ev->time, &ev50.time);
-
- error = uiomove(&ev50, sizeof(ev50), uio);
- if (error) {
- return error;
- }
- }
- return 0;
-}
-#else /* defined(COMPAT_50) || defined(MODULAR) */
-static int
-wsevent_copyout_events50(const struct wscons_event *events, int cnt,
- struct uio *uio)
-{
-
- return EINVAL;
-}
-#endif /* defined(COMPAT_50) || defined(MODULAR) */
-
static int
wsevent_copyout_events(const struct wscons_event *events, int cnt,
struct uio *uio, int ver)
{
+ int error;
switch (ver) {
case 0:
- return wsevent_copyout_events50(events, cnt, uio);
+ MODULE_CALL_HOOK(wsevent_50_copyout_events_hook,
+ (events, cnt, uio), enosys(), error);
+ if (error == ENOSYS)
+ error = EINVAL;
+ return error;
case WSEVENT_VERSION:
return uiomove(__UNCONST(events), cnt * sizeof(*events), uio);
default:
diff --git a/sys/dev/wscons/wsevent_50.c b/sys/dev/wscons/wsevent_50.c
new file mode 100644
index 00000000000..7a1f5d9ca46
--- /dev/null
+++ b/sys/dev/wscons/wsevent_50.c
@@ -0,0 +1,160 @@
+/* $NetBSD: wsevent_50.c,v 1.2 2019/01/27 02:08:42 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julio M. Merino Vidal.
+ *
+ * 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) 1996, 1997 Christopher G. Demetriou. 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. 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.
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * 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.
+ *
+ * @(#)event.c 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Internal "wscons_event" queue interface for the keyboard and mouse drivers.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: wsevent_50.c,v 1.2 2019/01/27 02:08:42 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/fcntl.h>
+#include <sys/kmem.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/vnode.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <sys/compat_stub.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wseventvar.h>
+#include <dev/wscons/wsevent_50.h>
+
+static int
+wsevent_copyout_events50(const struct wscons_event *events, int cnt,
+ struct uio *uio)
+{
+ int i;
+
+ for (i = 0; i < cnt; i++) {
+ const struct wscons_event *ev = &events[i];
+ struct owscons_event ev50;
+ int error;
+
+ ev50.type = ev->type;
+ ev50.value = ev->value;
+ timespec_to_timespec50(&ev->time, &ev50.time);
+
+ error = uiomove(&ev50, sizeof(ev50), uio);
+ if (error) {
+ return error;
+ }
+ }
+ return 0;
+}
+
+void
+wsevent_50_init(void)
+{
+
+ MODULE_SET_HOOK(wsevent_50_copyout_events_hook, "wsc_50",
+ wsevent_copyout_events50);
+}
+
+void
+wsevent_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(wsevent_50_copyout_events_hook);
+}
diff --git a/sys/dev/wscons/wsevent_50.h b/sys/dev/wscons/wsevent_50.h
new file mode 100644
index 00000000000..b937c1a1c77
--- /dev/null
+++ b/sys/dev/wscons/wsevent_50.h
@@ -0,0 +1,38 @@
+/* $NetBSD: wsevent_50.h,v 1.2 2019/01/27 02:08:42 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 _DEV_WSCONS_WSEVENT_50_H
+#define _DEV_WSCONS_WSEVENT_50_H
+
+void wsevent_50_init(void);
+void wsevent_50_fini(void);
+
+#endif /* _DEV_WSCONS_WSEVENT_50_H */
diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.c
index 40e61a222bb..de279c0111e 100644
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.c
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_bios.c,v 1.3 2018/08/27 04:58:24 riastradh Exp $ */
+/* $NetBSD: nouveau_bios.c,v 1.4 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright 2005-2006 Erik Waling
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_bios.c,v 1.3 2018/08/27 04:58:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_bios.c,v 1.4 2019/01/27 02:08:42 pgoyette Exp $");
#include <drm/drmP.h>
diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c
index d47bd75d8e5..f9a000816bb 100644
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_dma.c,v 1.3 2018/08/27 04:58:24 riastradh Exp $ */
+/* $NetBSD: nouveau_dma.c,v 1.4 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (C) 2007 Ben Skeggs.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dma.c,v 1.3 2018/08/27 04:58:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dma.c,v 1.4 2019/01/27 02:08:42 pgoyette Exp $");
#include "nouveau_drm.h"
#include "nouveau_dma.h"
diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
index c64961190e4..7cd73f12b6e 100644
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_gem.c,v 1.8 2018/08/27 15:22:54 riastradh Exp $ */
+/* $NetBSD: nouveau_gem.c,v 1.9 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright (C) 2008 Ben Skeggs.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_gem.c,v 1.8 2018/08/27 15:22:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_gem.c,v 1.9 2019/01/27 02:08:42 pgoyette Exp $");
#include <linux/err.h> /* XXX */
diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fbcon.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fbcon.c
index cb097ae7d6b..945b0210e80 100644
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fbcon.c
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fbcon.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nv04_fbcon.c,v 1.2 2018/08/27 04:58:24 riastradh Exp $ */
+/* $NetBSD: nouveau_nv04_fbcon.c,v 1.3 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright 2009 Ben Skeggs
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv04_fbcon.c,v 1.2 2018/08/27 04:58:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv04_fbcon.c,v 1.3 2019/01/27 02:08:42 pgoyette Exp $");
#include "nouveau_drm.h"
#include "nouveau_dma.h"
diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fence.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fence.c
index 5e7ece78b74..458a30df68a 100644
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fence.c
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fence.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nv04_fence.c,v 1.2 2018/08/27 04:58:24 riastradh Exp $ */
+/* $NetBSD: nouveau_nv04_fence.c,v 1.3 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv04_fence.c,v 1.2 2018/08/27 04:58:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv04_fence.c,v 1.3 2019/01/27 02:08:42 pgoyette Exp $");
#include "nouveau_drm.h"
#include "nouveau_dma.h"
diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c
index eebcddb4a1a..7694b8db864 100644
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nv10_fence.c,v 1.4 2018/08/27 04:58:24 riastradh Exp $ */
+/* $NetBSD: nouveau_nv10_fence.c,v 1.5 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv10_fence.c,v 1.4 2018/08/27 04:58:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv10_fence.c,v 1.5 2019/01/27 02:08:42 pgoyette Exp $");
#include "nouveau_drm.h"
#include "nouveau_dma.h"
diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c
index ae7d4c0b250..a4f3b3762e7 100644
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nv84_fence.c,v 1.5 2018/08/27 07:38:42 riastradh Exp $ */
+/* $NetBSD: nouveau_nv84_fence.c,v 1.6 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv84_fence.c,v 1.5 2018/08/27 07:38:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv84_fence.c,v 1.6 2019/01/27 02:08:42 pgoyette Exp $");
#include "nouveau_drm.h"
#include "nouveau_dma.h"
diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nvc0_fence.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nvc0_fence.c
index 8e470cc2950..d983ebff977 100644
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nvc0_fence.c
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nvc0_fence.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nvc0_fence.c,v 1.2 2018/08/27 04:58:24 riastradh Exp $ */
+/* $NetBSD: nouveau_nvc0_fence.c,v 1.3 2019/01/27 02:08:42 pgoyette Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvc0_fence.c,v 1.2 2018/08/27 04:58:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvc0_fence.c,v 1.3 2019/01/27 02:08:42 pgoyette Exp $");
#include "nouveau_drm.h"
#include "nouveau_dma.h"
diff --git a/sys/external/bsd/drm2/i915drm/files.i915drmkms b/sys/external/bsd/drm2/i915drm/files.i915drmkms
index d76af99a85d..64750cd217e 100644
--- a/sys/external/bsd/drm2/i915drm/files.i915drmkms
+++ b/sys/external/bsd/drm2/i915drm/files.i915drmkms
@@ -1,4 +1,6 @@
-# $NetBSD: files.i915drmkms,v 1.34 2019/01/19 16:58:29 dholland Exp $
+# $NetBSD: files.i915drmkms,v 1.35 2019/01/27 02:08:42 pgoyette Exp $
+
+version 20180827
version 20180827
diff --git a/sys/external/bsd/drm2/include/linux/atomic.h b/sys/external/bsd/drm2/include/linux/atomic.h
index 9fce660fea9..576efa2e57a 100644
--- a/sys/external/bsd/drm2/include/linux/atomic.h
+++ b/sys/external/bsd/drm2/include/linux/atomic.h
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic.h,v 1.19 2018/08/27 15:11:17 riastradh Exp $ */
+/* $NetBSD: atomic.h,v 1.20 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
diff --git a/sys/external/bsd/drm2/nouveau/files.nouveau b/sys/external/bsd/drm2/nouveau/files.nouveau
index 5fc60890526..8d60f814f6e 100644
--- a/sys/external/bsd/drm2/nouveau/files.nouveau
+++ b/sys/external/bsd/drm2/nouveau/files.nouveau
@@ -1,4 +1,6 @@
-# $NetBSD: files.nouveau,v 1.23 2018/10/14 17:25:21 riastradh Exp $
+# $NetBSD: files.nouveau,v 1.24 2019/01/27 02:08:43 pgoyette Exp $
+
+version 20180827
version 20180827
diff --git a/sys/external/bsd/drm2/radeon/files.radeon b/sys/external/bsd/drm2/radeon/files.radeon
index 3c39b1b76e9..9d2164005ed 100644
--- a/sys/external/bsd/drm2/radeon/files.radeon
+++ b/sys/external/bsd/drm2/radeon/files.radeon
@@ -1,4 +1,6 @@
-# $NetBSD: files.radeon,v 1.22 2018/09/21 11:31:50 kamil Exp $
+# $NetBSD: files.radeon,v 1.23 2019/01/27 02:08:43 pgoyette Exp $
+
+version 20180827
version 20180827
diff --git a/sys/external/bsd/gnu-efi/dist/lib/print.c b/sys/external/bsd/gnu-efi/dist/lib/print.c
index ea5c8503bea..cff751f4cc3 100644
--- a/sys/external/bsd/gnu-efi/dist/lib/print.c
+++ b/sys/external/bsd/gnu-efi/dist/lib/print.c
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.2 2018/08/19 14:50:24 jmcneill Exp $ */
+/* $NetBSD: print.c,v 1.3 2019/01/27 02:08:43 pgoyette Exp $ */
/*++
@@ -532,6 +532,7 @@ Returns:
_PoolCatPrint (fmt, args, &spc, _PoolPrint);
return spc.str;
}
+>>>>>>> 1.1.1.1.34.1
CHAR16 *
PoolPrint (
diff --git a/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/stm32-pinfunc.h b/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/stm32-pinfunc.h
index 10d3585bd38..a534190f278 100644
--- a/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/stm32-pinfunc.h
+++ b/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/stm32-pinfunc.h
@@ -1,4 +1,10 @@
-/* $NetBSD: stm32-pinfunc.h,v 1.1.1.2 2018/04/28 18:25:53 jmcneill Exp $ */
+/* $NetBSD: stm32-pinfunc.h,v 1.2 2019/01/27 02:08:43 pgoyette Exp $ */
+
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/*
+ * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
+ * Author: Torgue Alexandre <alexandre.torgue@st.com> for STMicroelectronics.
+ */
/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
/*
diff --git a/sys/fs/puffs/files.puffs b/sys/fs/puffs/files.puffs
index 51e59feef74..4db35aea570 100644
--- a/sys/fs/puffs/files.puffs
+++ b/sys/fs/puffs/files.puffs
@@ -1,9 +1,9 @@
-# $NetBSD: files.puffs,v 1.6 2014/10/11 06:42:19 uebayasi Exp $
+# $NetBSD: files.puffs,v 1.7 2019/01/27 02:08:43 pgoyette Exp $
deffs PUFFS
define puffs: vfs
-file fs/puffs/puffs_compat.c puffs
+file fs/puffs/puffs_compat.c compat_50
file fs/puffs/puffs_msgif.c puffs
file fs/puffs/puffs_node.c puffs
file fs/puffs/puffs_subr.c puffs
diff --git a/sys/fs/puffs/puffs_compat.c b/sys/fs/puffs/puffs_compat.c
index 31072b67f06..4dd88daf9fe 100644
--- a/sys/fs/puffs/puffs_compat.c
+++ b/sys/fs/puffs/puffs_compat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_compat.c,v 1.4 2015/04/22 17:07:24 pooka Exp $ */
+/* $NetBSD: puffs_compat.c,v 1.5 2019/01/27 02:08:43 pgoyette Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_compat.c,v 1.4 2015/04/22 17:07:24 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_compat.c,v 1.5 2019/01/27 02:08:43 pgoyette Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: puffs_compat.c,v 1.4 2015/04/22 17:07:24 pooka Exp $
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/atomic.h>
+#include <sys/compat_stub.h>
#include <dev/putter/putter_sys.h>
@@ -157,7 +158,6 @@ struct puffs50_vnmsg_symlink {
* vattr translation routines
*/
-#ifdef COMPAT_50
static void
vattr_to_50(const struct vattr *va, struct vattr50 *va50)
{
@@ -207,7 +207,6 @@ vattr_from_50(const struct vattr50 *va50, struct vattr *va)
va->va_filerev = va50->va_filerev;
va->va_vaflags = va50->va_flags;
}
-#endif /* COMPAT_50 */
/*
* XXX: cannot assert that sleeping is possible
@@ -223,12 +222,11 @@ vattr_from_50(const struct vattr50 *va50, struct vattr *va)
#define ASSIGN(field) \
cmsg->field = omsg->field;
-bool
+int
puffs_compat_outgoing(struct puffs_req *oreq,
struct puffs_req **creqp, ssize_t *deltap)
{
- bool rv = false;
-#ifdef COMPAT_50
+ int rv = ENOSYS; /* non-zero return ==> false */
struct puffs_req *creq = NULL;
ssize_t delta = 0;
@@ -331,9 +329,8 @@ puffs_compat_outgoing(struct puffs_req *oreq,
if (creq) {
*creqp = creq;
*deltap = delta;
- rv = true;
+ rv = 0;
}
-#endif
return rv;
}
@@ -350,7 +347,6 @@ void
puffs_compat_incoming(struct puffs_req *preq, struct puffs_req *creq)
{
-#ifdef COMPAT_50
if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VFS
&& preq->preq_optype == PUFFS_VFS_FHTOVP) {
INIT(vfsmsg_fhtonode);
@@ -438,5 +434,18 @@ puffs_compat_incoming(struct puffs_req *preq, struct puffs_req *creq)
panic("puffs compat ops come in pairs");
}
}
-#endif /* COMPAT_50 */
+}
+
+void puffs_50_init(void)
+{
+
+ MODULE_SET_HOOK(puffs_50_out_hook, "pffs50", puffs_compat_outgoing);
+ MODULE_SET_HOOK(puffs_50_in_hook, "pffs50", puffs_compat_incoming);
+}
+
+void puffs_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(puffs_50_out_hook);
+ MODULE_UNSET_HOOK(puffs_50_in_hook);
}
diff --git a/sys/fs/puffs/puffs_msgif.c b/sys/fs/puffs/puffs_msgif.c
index 3023a532e01..5b9066cef27 100644
--- a/sys/fs/puffs/puffs_msgif.c
+++ b/sys/fs/puffs/puffs_msgif.c
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_msgif.c,v 1.101 2017/04/17 08:31:01 hannken Exp $ */
+/* $NetBSD: puffs_msgif.c,v 1.102 2019/01/27 02:08:43 pgoyette Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.101 2017/04/17 08:31:01 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.102 2019/01/27 02:08:43 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.101 2017/04/17 08:31:01 hannken Ex
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/atomic.h>
+#include <sys/compat_stub.h>
#include <uvm/uvm.h>
@@ -335,6 +336,9 @@ puffs_msg_enqueue(struct puffs_mount *pmp, struct puffs_msgpark *park)
struct lwp *l = curlwp;
struct puffs_req *preq, *creq;
ssize_t delta;
+#if 1
+ int ret;
+#endif
/*
* Some clients reuse a park, so reset some flags. We might
@@ -348,13 +352,17 @@ puffs_msg_enqueue(struct puffs_mount *pmp, struct puffs_msgpark *park)
#if 1
/* check if we do compat adjustments */
- if (pmp->pmp_docompat && puffs_compat_outgoing(preq, &creq, &delta)) {
- park->park_creq = park->park_preq;
- park->park_creqlen = park->park_maxlen;
-
- park->park_maxlen += delta;
- park->park_copylen += delta;
- park->park_preq = preq = creq;
+ if (pmp->pmp_docompat) {
+ MODULE_CALL_HOOK(puffs_50_out_hook, (preq, &creq, &delta),
+ enosys(), ret);
+ if (ret == 0) {
+ park->park_creq = park->park_preq;
+ park->park_creqlen = park->park_maxlen;
+
+ park->park_maxlen += delta;
+ park->park_copylen += delta;
+ park->park_preq = preq = creq;
+ }
}
#endif
@@ -805,7 +813,8 @@ puffsop_msg(void *ctx, struct puffs_req *preq)
size_t csize;
KASSERT(pmp->pmp_docompat);
- puffs_compat_incoming(preq, park->park_creq);
+ MODULE_CALL_VOID_HOOK(puffs_50_in_hook,
+ (preq, park->park_creq), __nothing);
creq = park->park_creq;
csize = park->park_creqlen;
park->park_creq = park->park_preq;
diff --git a/sys/fs/puffs/puffs_sys.h b/sys/fs/puffs/puffs_sys.h
index 0b6cad7b2e3..ff544885801 100644
--- a/sys/fs/puffs/puffs_sys.h
+++ b/sys/fs/puffs/puffs_sys.h
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_sys.h,v 1.90 2016/07/07 06:55:42 msaitoh Exp $ */
+/* $NetBSD: puffs_sys.h,v 1.91 2019/01/27 02:08:43 pgoyette Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@@ -290,7 +290,7 @@ void puffs_gop_markupdate(struct vnode *, int);
void puffs_senderr(struct puffs_mount *, int, int, const char *,
puffs_cookie_t);
-bool puffs_compat_outgoing(struct puffs_req *, struct puffs_req**, ssize_t*);
+int puffs_compat_outgoing(struct puffs_req *, struct puffs_req**, ssize_t*);
void puffs_compat_incoming(struct puffs_req *, struct puffs_req *);
void puffs_updatenode(struct puffs_node *, int, voff_t);
@@ -359,4 +359,11 @@ do { \
var = puffs_msg_wait2(pmp, park, vp1, vp2); \
} while (/*CONSTCOND*/0)
+/*
+ * compat50 init/fini
+ */
+
+void puffs_50_init(void);
+void puffs_50_fini(void);
+
#endif /* _PUFFS_SYS_H_ */
diff --git a/sys/kern/compat_stub.c b/sys/kern/compat_stub.c
new file mode 100644
index 00000000000..ea3b878c427
--- /dev/null
+++ b/sys/kern/compat_stub.c
@@ -0,0 +1,259 @@
+/* $NetBSD: compat_stub.c,v 1.2 2019/01/27 02:08:43 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>
+
+#ifdef _KERNEL_OPT
+#include "opt_ntp.h"
+#include "opt_sctp.h"
+#endif
+
+#include <sys/systm.h>
+#include <sys/compat_stub.h>
+
+#ifdef NTP
+#include <sys/timespec.h>
+#include <sys/timex.h>
+#endif
+
+#ifdef SCTP
+#include <netinet/sctp_asconf.h>
+#endif
+
+/*
+ * Routine vectors for compat_50___sys_ntp_gettime
+ *
+ * MP-hooks not needed since the NTP code is not modular
+ */
+
+#ifdef NTP
+void (*vec_ntp_gettime)(struct ntptimeval *) = ntp_gettime;
+int (*vec_ntp_timestatus)(void) = ntp_timestatus;
+void (*vec_ntp_adjtime1)(struct timex *) = ntp_adjtime1;
+#else
+void (*vec_ntp_gettime)(struct ntptimeval *) = NULL;
+int (*vec_ntp_timestatus)(void) = NULL;
+void (*vec_ntp_adjtime1)(struct timex *) = NULL;
+#endif
+
+/*
+ * Routine vectors for sctp (called from within rtsock)
+ *
+ * MP-hooks not needed since the SCTP code is not modular
+ */
+
+#ifdef SCTP
+void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
+void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;
+#else
+void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
+void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
+#endif
+
+
+/*
+ * usb device_info compatability
+ */
+struct usb_subr_30_fill_hook_t usb_subr_30_fill_hook;
+struct usb_subr_30_copy_hook_t usb_subr_30_copy_hook;
+
+/*
+ * ccd device compatability ioctl
+ */
+
+struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook;
+
+/*
+ * clockctl device compatability ioctl
+ */
+
+struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook;
+
+/*
+ * if_sppp device compatability ioctl subroutine
+ */
+
+struct sppp_params_50_hook_t sppp_params_50_hook;
+
+/*
+ * cryptodev compatability ioctl
+ */
+
+struct ocryptof_50_hook_t ocryptof_50_hook;
+
+/*
+ * raidframe compatability
+ */
+struct raidframe50_ioctl_hook_t raidframe50_ioctl_hook;
+struct raidframe80_ioctl_hook_t raidframe80_ioctl_hook;
+
+/*
+ * puffs compatability
+ */
+
+struct puffs_50_out_hook_t puffs_50_out_hook;
+struct puffs_50_in_hook_t puffs_50_in_hook;
+
+/* XXX
+int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
+ ssize_t *) = (void *)enosys;
+void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
+ (void *)voidop;
+ XXX */
+
+/*
+ * wsevents compatability
+ */
+struct wsevent_50_copyout_events_hook_t wsevent_50_copyout_events_hook;
+
+/*
+ * sysmon_power compatability
+ */
+struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook;
+
+/*
+ * compat_bio compatability
+ */
+struct compat_bio_30_hook_t compat_bio_30_hook;
+
+/*
+ * vnd ioctl compatability
+ */
+struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook;
+struct compat_vndioctl_50_hook_t compat_vndioctl_50_hook;
+
+/*
+ * ieee80211 ioctl compatability
+ */
+struct ieee80211_ostats_hook_t ieee80211_ostats_hook;
+
+/*
+ * if_43 compatability
+ */
+struct if_43_cvtcmd_hook_t if_43_cvtcmd_hook;
+struct if_43_ifioctl_hook_t if_43_ifioctl_hook;
+
+/*
+ * if43_20 compatability
+ */
+struct if43_20_hook_t if43_20_hook;
+
+/*
+ * upic_syscalls_40 compatability
+ */
+struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
+
+/*
+ * upic_syscalls_50 compatability
+ */
+struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
+
+/*
+ * rtsock 14 compatability
+ */
+struct rtsock_14_oifmsg_hook_t rtsock_14_oifmsg_hook;
+struct rtsock_14_iflist_hook_t rtsock_14_iflist_hook;
+
+/*
+ * rtsock 50 compatability
+ */
+struct rtsock_50_iflist_hook_t rtsock_50_iflist_hook;
+struct rtsock_50_oifmsg_hook_t rtsock_50_oifmsg_hook;
+struct rtsock_50_rt_missmsg_hook_t rtsock_50_rt_missmsg_hook;
+struct rtsock_50_rt_ifmsg_hook_t rtsock_50_rt_ifmsg_hook;
+struct rtsock_50_rt_ifannouncemsg_hook_t rtsock_50_rt_ifannouncemsg_hook;
+struct rtsock_50_rt_newaddrmsg_hook_t rtsock_50_rt_newaddrmsg_hook;
+struct rtsock_50_rt_ieee80211msg_hook_t rtsock_50_rt_ieee80211msg_hook;
+
+/*
+ * rtsock 70 compatability
+ */
+struct rtsock_70_newaddr_hook_t rtsock_70_newaddr_hook;
+struct rtsock_70_iflist_hook_t rtsock_70_iflist_hook;
+
+/*
+ * modctl handler for old style OSTAT
+ */
+struct compat_modstat_80_hook_t compat_modstat_80_hook;
+
+/*
+ * mask for kern_sig_43's killpg (updated by compat_09)
+ */
+int kern_sig_43_pgid_mask = ~0;
+
+/*
+ * hook for kern_proc_32
+ */
+struct kern_proc_32_copyin_hook_t kern_proc_32_copyin_hook;
+struct kern_proc_32_base_hook_t kern_proc_32_base_hook;
+
+/*
+ * Hook for sparc fpu code to check if a process is running
+ * under sunos emulation
+ */
+struct get_emul_sunos_hook_t get_emul_sunos_hook;
+
+/*
+ * Hook for rnd_ioctl_50 callbacks
+ */
+struct rnd_ioctl_50_hook_t rnd_ioctl_50_hook;
+struct rnd_ioctl_50_32_hook_t rnd_ioctl_50_32_hook;
+
+/*
+ * Hooks for compat_60 ttioctl and ptmioctl
+ */
+struct compat_60_ttioctl_hook_t compat_60_ttioctl_hook;
+struct compat_60_ptmioctl_hook_t compat_60_ptmioctl_hook;
+
+/*
+ * Hook for compat_10 openat
+ */
+struct compat_10_openat_hook_t compat_10_openat_hook;
+
+/*
+ * Hook for compat_70_unp_addsockcred
+ */
+struct compat_70_unp_hook_t compat_70_unp_hook;
+
+/*
+ * Hook for sysvipc50_sysctl
+ */
+struct sysvipc50_sysctl_hook_t sysvipc50_sysctl_hook;
+
+/*
+ * Hook for 32-bit machine name
+ *
+ * This probably would be better placed in compat/netbsd32/netbsd32_mod.c
+ * but the consumer code in linux32_exec_elf32.c is sometimes included in
+ * the main kernel, and not in a compat_netbsd32 module. (In particular,
+ * this is true for i386 and sgimips.)
+ */
+struct netbsd32_machine32_hook_t netbsd32_machine32_hook;
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index 749d39fce47..8d1a73f26e0 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.c,v 1.78 2018/09/03 16:29:35 riastradh Exp $ */
+/* $NetBSD: exec_script.c,v 1.79 2019/01/27 02:08:43 pgoyette Exp $ */
/*
* Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.78 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.79 2019/01/27 02:08:43 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_script.h"
+#endif
#ifdef _KERNEL_OPT
#include "opt_script.h"
diff --git a/sys/kern/files.kern b/sys/kern/files.kern
index 5f0d7f9cc32..0a44c5f750f 100644
--- a/sys/kern/files.kern
+++ b/sys/kern/files.kern
@@ -1,4 +1,4 @@
-# $NetBSD: files.kern,v 1.30 2019/01/09 04:01:20 mrg Exp $
+# $NetBSD: files.kern,v 1.31 2019/01/27 02:08:43 pgoyette Exp $
#
# kernel sources
@@ -7,14 +7,13 @@ define kern: machdep, uvm
defflag opt_kern.h KERN
defflag opt_script.h SETUIDSCRIPTS FDSCRIPTS
defflag KASLR
-file compat/common/compat_util.c kern
-file compat/common/compat_mod.c compat_netbsd | compat_netbsd32
file conf/debugsyms.c kern
file conf/param.c kern
file kern/bufq_disksort.c bufq_disksort
file kern/bufq_fcfs.c bufq_fcfs
file kern/bufq_priocscan.c bufq_priocscan
file kern/bufq_readprio.c bufq_readprio | new_bufq_strategy
+file kern/compat_stub.c kern
file kern/core_elf32.c exec_elf32
file kern/core_elf64.c exec_elf64
file kern/core_netbsd.c exec_aout | exec_coff | exec_ecoff
@@ -111,6 +110,7 @@ file kern/subr_device.c kern
file kern/subr_devsw.c kern
file kern/subr_disk.c kern
file kern/subr_disk_open.c kern
+file kern/subr_emul.c kern
file kern/subr_evcnt.c kern
file kern/subr_exec_fd.c kern
file kern/subr_extent.c kern
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c
index ba461d0897f..ee660fc9c9d 100644
--- a/sys/kern/init_sysent.c
+++ b/sys/kern/init_sysent.c
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysent.c,v 1.322 2018/08/10 21:47:16 pgoyette Exp $ */
+/* $NetBSD: init_sysent.c,v 1.323 2019/01/27 02:08:43 pgoyette Exp $ */
/*
* System call switch table.
@@ -8,7 +8,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.322 2018/08/10 21:47:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.323 2019/01/27 02:08:43 pgoyette Exp $");
#include "opt_modular.h"
#include "opt_ntp.h"
@@ -897,7 +897,7 @@ struct sysent sysent[] = {
{
ns(struct compat_30_sys_ntp_gettime_args),
.sy_flags = SYCALL_ARG_PTR,
- .sy_call = (sy_call_t *)compat_30(sys_ntp_gettime)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 175 = compat_30_ntp_gettime */
#if defined(NTP) || !defined(_KERNEL_OPT)
{
@@ -1597,26 +1597,26 @@ struct sysent sysent[] = {
{
ns(struct compat_60_sys_sa_register_args),
.sy_flags = SYCALL_ARG_PTR,
- .sy_call = (sy_call_t *)compat_60(sys_sa_register)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 330 = compat_60_sa_register */
{
ns(struct compat_60_sys_sa_stacks_args),
.sy_flags = SYCALL_ARG_PTR,
- .sy_call = (sy_call_t *)compat_60(sys_sa_stacks)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 331 = compat_60_sa_stacks */
{
- .sy_call = (sy_call_t *)compat_60(sys_sa_enable)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 332 = compat_60_sa_enable */
{
ns(struct compat_60_sys_sa_setconcurrency_args),
- .sy_call = (sy_call_t *)compat_60(sys_sa_setconcurrency)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 333 = compat_60_sa_setconcurrency */
{
- .sy_call = (sy_call_t *)compat_60(sys_sa_yield)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 334 = compat_60_sa_yield */
{
ns(struct compat_60_sys_sa_preempt_args),
- .sy_call = (sy_call_t *)compat_60(sys_sa_preempt)
+ .sy_call = (sy_call_t *)sys_nomodule
}, /* 335 = compat_60_sa_preempt */
{
.sy_call = sys_nosys,
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index 35b6585c112..c18be80c703 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_module.c,v 1.132 2018/09/03 16:29:35 riastradh Exp $ */
+/* $NetBSD: kern_module.c,v 1.133 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.132 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.133 2019/01/27 02:08:43 pgoyette Exp $");
#define _MODULE_INTERNAL
@@ -243,6 +243,9 @@ module_free(module_t *mod)
{
specificdata_fini(module_specificdata_domain, &mod->mod_sdref);
+ if (mod->mod_required)
+ kmem_free(mod->mod_required, mod->mod_arequired *
+ sizeof(module_t *));
kmem_free(mod, sizeof(*mod));
}
@@ -252,7 +255,7 @@ module_free(module_t *mod)
static void
module_require_force(struct module *mod)
{
- mod->mod_flags |= MODFLG_MUST_FORCE;
+ SET(mod->mod_flags, MODFLG_MUST_FORCE);
}
/*
@@ -573,7 +576,7 @@ module_init_class(modclass_t modclass)
* (If the module has previously been set to
* MODFLG_MUST_FORCE, don't try to override that!)
*/
- if ((mod->mod_flags & MODFLG_MUST_FORCE) ||
+ if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE) ||
module_do_builtin(mod, mi->mi_name, NULL,
NULL) != 0) {
TAILQ_REMOVE(&module_builtins, mod, mod_chain);
@@ -738,9 +741,8 @@ module_lookup(const char *name)
KASSERT(kernconfig_is_held());
TAILQ_FOREACH(mod, &module_list, mod_chain) {
- if (strcmp(mod->mod_info->mi_name, name) == 0) {
+ if (strcmp(mod->mod_info->mi_name, name) == 0)
break;
- }
}
return mod;
@@ -798,8 +800,8 @@ module_enqueue(module_t *mod)
/* Add references to the requisite modules. */
for (i = 0; i < mod->mod_nrequired; i++) {
- KASSERT(mod->mod_required[i] != NULL);
- mod->mod_required[i]->mod_refcnt++;
+ KASSERT((*mod->mod_required)[i] != NULL);
+ (*mod->mod_required)[i]->mod_refcnt++;
}
}
module_count++;
@@ -807,6 +809,31 @@ module_enqueue(module_t *mod)
}
/*
+ * Our array of required module pointers starts with zero entries. If we
+ * need to add a new entry, and the list is already full, we reallocate a
+ * larger array, adding MAXMODDEPS entries.
+ */
+static void
+alloc_required(module_t *mod)
+{
+ module_t *(*new)[], *(*old)[];
+ int areq;
+ int i;
+
+ if (mod->mod_nrequired >= mod->mod_arequired) {
+ areq = mod->mod_arequired + MAXMODDEPS;
+ old = mod->mod_required;
+ new = kmem_zalloc(areq * sizeof(module_t *), KM_SLEEP);
+ for (i = 0; i < mod->mod_arequired; i++)
+ (*new)[i] = (*old)[i];
+ mod->mod_required = new;
+ if (old)
+ kmem_free(old, mod->mod_arequired * sizeof(module_t *));
+ mod->mod_arequired = areq;
+ }
+}
+
+/*
* module_do_builtin:
*
* Initialize a module from the list of modules that are
@@ -853,14 +880,17 @@ module_do_builtin(const module_t *pmod, const char *name, module_t **modp,
* cases (such as nfsserver + nfs), the dependee can be
* succesfully linked without the dependencies.
*/
- module_error("%s: can't find builtin dependency `%s'",
- pmod->mod_info->mi_name, name);
+ module_error("built-in module %s can't find builtin "
+ "dependency `%s'", pmod->mod_info->mi_name, name);
return ENOENT;
}
/*
* Initialize pre-requisites.
*/
+ KASSERT(mod->mod_required == NULL);
+ KASSERT(mod->mod_arequired == 0);
+ KASSERT(mod->mod_nrequired == 0);
if (mi->mi_required != NULL) {
for (s = mi->mi_required; *s != '\0'; s = p) {
if (*s == ',')
@@ -872,17 +902,14 @@ module_do_builtin(const module_t *pmod, const char *name, module_t **modp,
strlcpy(buf, s, len);
if (buf[0] == '\0')
break;
- if (mod->mod_nrequired == MAXMODDEPS - 1) {
- module_error("%s: too many required modules "
- "%d >= %d", pmod->mod_info->mi_name,
- mod->mod_nrequired, MAXMODDEPS - 1);
- return EINVAL;
- }
+ alloc_required(mod);
error = module_do_builtin(mod, buf, &mod2, NULL);
if (error != 0) {
- return error;
+ module_error("built-in module %s prerequisite "
+ "%s failed, error %d", name, buf, error);
+ goto fail;
}
- mod->mod_required[mod->mod_nrequired++] = mod2;
+ (*mod->mod_required)[mod->mod_nrequired++] = mod2;
}
}
@@ -894,9 +921,9 @@ module_do_builtin(const module_t *pmod, const char *name, module_t **modp,
error = (*mi->mi_modcmd)(MODULE_CMD_INIT, props);
module_active = prev_active;
if (error != 0) {
- module_error("builtin module `%s' "
- "failed to init, error %d", mi->mi_name, error);
- return error;
+ module_error("built-in module %s failed its MODULE_CMD_INIT, "
+ "error %d", mi->mi_name, error);
+ goto fail;
}
/* load always succeeds after this point */
@@ -908,6 +935,15 @@ module_do_builtin(const module_t *pmod, const char *name, module_t **modp,
}
module_enqueue(mod);
return 0;
+
+ fail:
+ if (mod->mod_required)
+ kmem_free(mod->mod_required, mod->mod_arequired *
+ sizeof(module_t *));
+ mod->mod_arequired = 0;
+ mod->mod_nrequired = 0;
+ mod->mod_required = NULL;
+ return error;
}
/*
@@ -921,13 +957,19 @@ module_do_load(const char *name, bool isdep, int flags,
prop_dictionary_t props, module_t **modp, modclass_t modclass,
bool autoload)
{
-#define MODULE_MAX_DEPTH 6
-
+ /* The pending list for this level of recursion */
TAILQ_HEAD(pending_t, module);
- static int depth = 0;
- static struct pending_t *pending_lists[MODULE_MAX_DEPTH];
struct pending_t *pending;
struct pending_t new_pending = TAILQ_HEAD_INITIALIZER(new_pending);
+
+ /* The stack of pending lists */
+ static SLIST_HEAD(pend_head, pend_entry) pend_stack =
+ SLIST_HEAD_INITIALIZER(pend_stack);
+ struct pend_entry {
+ SLIST_ENTRY(pend_entry) pe_entry;
+ struct pending_t *pe_pending;
+ } my_pend_entry;
+
modinfo_t *mi;
module_t *mod, *mod2, *prev_active;
prop_dictionary_t filedict;
@@ -942,27 +984,20 @@ module_do_load(const char *name, bool isdep, int flags,
error = 0;
/*
- * Avoid recursing too far.
- */
- if (++depth > MODULE_MAX_DEPTH) {
- module_error("recursion too deep for `%s' %d > %d", name,
- depth, MODULE_MAX_DEPTH);
- depth--;
- return EMLINK;
- }
-
- /*
- * Set up the pending list for this depth. If this is a
- * recursive entry, then use same list as for outer call,
- * else use the locally allocated list. In either case,
- * remember which one we're using.
+ * Set up the pending list for this entry. If this is an
+ * internal entry (for a dependency), then use the same list
+ * as for the outer call; otherwise, it's an external entry
+ * (possibly recursive, ie a module's xxx_modcmd(init, ...)
+ * routine called us), so use the locally allocated list. In
+ * either case, add it to our stack.
*/
if (isdep) {
- KASSERT(depth > 1);
- pending = pending_lists[depth - 2];
+ KASSERT(SLIST_FIRST(&pend_stack) != NULL);
+ pending = SLIST_FIRST(&pend_stack)->pe_pending;
} else
pending = &new_pending;
- pending_lists[depth - 1] = pending;
+ my_pend_entry.pe_pending = pending;
+ SLIST_INSERT_HEAD(&pend_stack, &my_pend_entry, pe_entry);
/*
* Search the list of disabled builtins first.
@@ -973,17 +1008,17 @@ module_do_load(const char *name, bool isdep, int flags,
}
}
if (mod) {
- if ((mod->mod_flags & MODFLG_MUST_FORCE) &&
- (flags & MODCTL_LOAD_FORCE) == 0) {
+ if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE) &&
+ !ISSET(flags, MODCTL_LOAD_FORCE)) {
if (!autoload) {
module_error("use -f to reinstate "
"builtin module `%s'", name);
}
- depth--;
+ SLIST_REMOVE_HEAD(&pend_stack, pe_entry);
return EPERM;
} else {
+ SLIST_REMOVE_HEAD(&pend_stack, pe_entry);
error = module_do_builtin(mod, name, modp, props);
- depth--;
return error;
}
}
@@ -1011,14 +1046,14 @@ module_do_load(const char *name, bool isdep, int flags,
}
module_print("%s module `%s' already loaded",
isdep ? "dependent" : "requested", name);
- depth--;
+ SLIST_REMOVE_HEAD(&pend_stack, pe_entry);
return EEXIST;
}
mod = module_newmodule(MODULE_SOURCE_FILESYS);
if (mod == NULL) {
module_error("out of memory for `%s'", name);
- depth--;
+ SLIST_REMOVE_HEAD(&pend_stack, pe_entry);
return ENOMEM;
}
@@ -1037,8 +1072,8 @@ module_do_load(const char *name, bool isdep, int flags,
module_error("vfs load failed for `%s', "
"error %d", name, error);
#endif
+ SLIST_REMOVE_HEAD(&pend_stack, pe_entry);
module_free(mod);
- depth--;
return error;
}
TAILQ_INSERT_TAIL(pending, mod, mod_chain);
@@ -1064,7 +1099,7 @@ module_do_load(const char *name, bool isdep, int flags,
if (!module_compatible(mi->mi_version, __NetBSD_Version__)) {
module_error("module `%s' built for `%d', system `%d'",
mi->mi_name, mi->mi_version, __NetBSD_Version__);
- if ((flags & MODCTL_LOAD_FORCE) != 0) {
+ if (ISSET(flags, MODCTL_LOAD_FORCE)) {
module_error("forced load, system may be unstable");
} else {
error = EPROGMISMATCH;
@@ -1106,6 +1141,8 @@ module_do_load(const char *name, bool isdep, int flags,
module_error("module with name `%s' already loaded",
mod2->mod_info->mi_name);
error = EEXIST;
+ if (modp != NULL)
+ *modp = mod2;
goto fail;
}
}
@@ -1129,6 +1166,7 @@ module_do_load(const char *name, bool isdep, int flags,
* Now try to load any requisite modules.
*/
if (mi->mi_required != NULL) {
+ mod->mod_arequired = 0;
for (s = mi->mi_required; *s != '\0'; s = p) {
if (*s == ',')
s++;
@@ -1146,13 +1184,7 @@ module_do_load(const char *name, bool isdep, int flags,
strlcpy(buf, s, len);
if (buf[0] == '\0')
break;
- if (mod->mod_nrequired == MAXMODDEPS - 1) {
- error = EINVAL;
- module_error("too many required modules "
- "%d >= %d", mod->mod_nrequired,
- MAXMODDEPS - 1);
- goto fail;
- }
+ alloc_required(mod);
if (strcmp(buf, mi->mi_name) == 0) {
error = EDEADLK;
module_error("self-dependency detected for "
@@ -1167,7 +1199,7 @@ module_do_load(const char *name, bool isdep, int flags,
buf, error);
goto fail;
}
- mod->mod_required[mod->mod_nrequired++] = mod2;
+ (*mod->mod_required)[mod->mod_nrequired++] = mod2;
}
}
@@ -1190,6 +1222,7 @@ module_do_load(const char *name, bool isdep, int flags,
goto fail;
}
}
+
prev_active = module_active;
module_active = mod;
error = (*mi->mi_modcmd)(MODULE_CMD_INIT, filedict ? filedict : props);
@@ -1231,10 +1264,10 @@ module_do_load(const char *name, bool isdep, int flags,
* a short delay unless auto-unload is disabled.
*/
mod->mod_autotime = time_second + module_autotime;
- mod->mod_flags |= MODFLG_AUTO_LOADED;
+ SET(mod->mod_flags, MODFLG_AUTO_LOADED);
module_thread_kick();
}
- depth--;
+ SLIST_REMOVE_HEAD(&pend_stack, pe_entry);
module_print("module `%s' loaded successfully", mi->mi_name);
module_callback_load(mod);
return 0;
@@ -1249,8 +1282,8 @@ module_do_load(const char *name, bool isdep, int flags,
filedict = NULL;
}
TAILQ_REMOVE(pending, mod, mod_chain);
+ SLIST_REMOVE_HEAD(&pend_stack, pe_entry);
module_free(mod);
- depth--;
return error;
}
@@ -1305,14 +1338,24 @@ module_do_unload(const char *name, bool load_requires_force)
module_count--;
TAILQ_REMOVE(&module_list, mod, mod_chain);
for (i = 0; i < mod->mod_nrequired; i++) {
- mod->mod_required[i]->mod_refcnt--;
+ (*mod->mod_required)[i]->mod_refcnt--;
}
module_print("unloaded module `%s'", name);
if (mod->mod_kobj != NULL) {
kobj_unload(mod->mod_kobj);
}
if (mod->mod_source == MODULE_SOURCE_KERNEL) {
- mod->mod_nrequired = 0; /* will be re-parsed */
+ if (mod->mod_required != NULL) {
+ /*
+ * release "required" resources - will be re-parsed
+ * if the module is re-enabled
+ */
+ kmem_free(mod->mod_required,
+ mod->mod_arequired * sizeof(module_t *));
+ mod->mod_nrequired = 0;
+ mod->mod_arequired = 0;
+ mod->mod_required = NULL;
+ }
if (load_requires_force)
module_require_force(mod);
TAILQ_INSERT_TAIL(&module_builtins, mod, mod_chain);
@@ -1410,8 +1453,8 @@ module_fetch_info(module_t *mod)
return error;
}
if (size != sizeof(modinfo_t **)) {
- module_error("`link_set_modules' section wrong size %zu != %zu",
- size, sizeof(modinfo_t **));
+ module_error("`link_set_modules' section wrong size "
+ "(got %zu, wanted %zu)", size, sizeof(modinfo_t **));
return ENOEXEC;
}
mod->mod_info = *(modinfo_t **)addr;
@@ -1460,7 +1503,7 @@ module_thread(void *cookie)
if (mod->mod_source == MODULE_SOURCE_KERNEL)
continue;
/* skip modules that weren't auto-loaded */
- if ((mod->mod_flags & MODFLG_AUTO_LOADED) == 0)
+ if (!ISSET(mod->mod_flags, MODFLG_AUTO_LOADED))
continue;
if (uvmexp.free < uvmexp.freemin) {
diff --git a/sys/kern/kern_module_vfs.c b/sys/kern/kern_module_vfs.c
index f0c7d01a5d4..1c7b2a7aacd 100644
--- a/sys/kern/kern_module_vfs.c
+++ b/sys/kern/kern_module_vfs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_module_vfs.c,v 1.16 2017/06/01 02:45:13 chs Exp $ */
+/* $NetBSD: kern_module_vfs.c,v 1.17 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.16 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.17 2019/01/27 02:08:43 pgoyette Exp $");
#define _MODULE_INTERNAL
#include <sys/param.h>
@@ -106,7 +106,7 @@ module_load_vfs(const char *name, int flags, bool autoload,
/*
* Load and process <module>.plist if it exists.
*/
- if (((flags & MODCTL_NO_PROP) == 0 && filedictp) || autoload) {
+ if ((!ISSET(flags, MODCTL_NO_PROP) && filedictp) || autoload) {
error = module_load_plist_vfs(path, nochroot, &moduledict);
if (error != 0) {
module_print("plist load returned error %d for `%s'",
@@ -124,7 +124,7 @@ module_load_vfs(const char *name, int flags, bool autoload,
}
}
if (error == 0) { /* can get here if error == ENOENT */
- if ((flags & MODCTL_NO_PROP) == 0 && filedictp)
+ if (!ISSET(flags, MODCTL_NO_PROP) && filedictp)
*filedictp = moduledict;
else
prop_object_release(moduledict);
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index b1886168611..77117d6b95d 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_proc.c,v 1.224 2018/12/10 14:46:24 maxv Exp $ */
+/* $NetBSD: kern_proc.c,v 1.225 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.224 2018/12/10 14:46:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.225 2019/01/27 02:08:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_kstack.h"
@@ -105,14 +105,11 @@ __KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.224 2018/12/10 14:46:24 maxv Exp $")
#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>
-#ifdef COMPAT_NETBSD32
-#include <compat/netbsd32/netbsd32.h>
-#endif
-
/*
* Process lists.
*/
@@ -1898,22 +1895,16 @@ sysctl_doeproc(SYSCTLFN_ARGS)
int
copyin_psstrings(struct proc *p, struct ps_strings *arginfo)
{
+#if !defined(_RUMPKERNEL)
+ int retval;
-#ifdef COMPAT_NETBSD32
if (p->p_flag & PK_32) {
- 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;
+ MODULE_CALL_HOOK(kern_proc_32_copyin_hook, (p, arginfo),
+ enosys(), retval);
+ return retval;
}
-#endif
+#endif /* !defined(_RUMPKERNEL) */
+
return copyin_proc(p, (void *)p->p_psstrp, arginfo, sizeof(*arginfo));
}
@@ -2122,14 +2113,12 @@ copy_procargs(struct proc *p, int oid, size_t *limit,
i = 0;
}
-#ifdef COMPAT_NETBSD32
- if (p->p_flag & PK_32) {
- netbsd32_charp *argv32;
-
- argv32 = (netbsd32_charp *)argv;
- base = (vaddr_t)NETBSD32PTR64(argv32[i++]);
- } else
-#endif
+#if !defined(_RUMPKERNEL)
+ if (p->p_flag & PK_32)
+ MODULE_CALL_HOOK(kern_proc_32_base_hook,
+ (argv, i++), 0, base);
+ else
+#endif /* !defined(_RUMPKERNEL) */
base = (vaddr_t)argv[i++];
loaded -= entry_len;
diff --git a/sys/kern/kern_rndq.c b/sys/kern/kern_rndq.c
index 0cce46c41d6..91320f7b024 100644
--- a/sys/kern/kern_rndq.c
+++ b/sys/kern/kern_rndq.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rndq.c,v 1.90 2018/07/03 18:09:28 jdolecek Exp $ */
+/* $NetBSD: kern_rndq.c,v 1.91 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.90 2018/07/03 18:09:28 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.91 2019/01/27 02:08:43 pgoyette Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -51,14 +51,13 @@ __KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.90 2018/07/03 18:09:28 jdolecek Exp
#include <sys/rndsink.h>
#include <sys/rndsource.h>
#include <sys/rngtest.h>
+#include <sys/file.h>
#include <sys/systm.h>
+#include <sys/module_hook.h>
+#include <sys/compat_stub.h>
#include <dev/rnd_private.h>
-#ifdef COMPAT_50
-#include <compat/sys/rnd.h>
-#endif
-
#if defined(__HAVE_CPU_RNG) && !defined(_RUMPKERNEL)
#include <machine/cpu_rng.h>
#endif
@@ -1493,11 +1492,16 @@ rnd_system_ioctl(struct file *fp, u_long cmd, void *addr)
break;
default:
-#ifdef COMPAT_50
- return compat_50_rnd_ioctl(fp, cmd, addr);
-#else
- return ENOTTY;
+ MODULE_CALL_HOOK(rnd_ioctl_50_hook, (fp, cmd, addr),
+ enosys(), ret);
+#if defined(_LP64)
+ if (ret == ENOSYS)
+ MODULE_CALL_HOOK(rnd_ioctl_50_32_hook, (fp, cmd, addr),
+ enosys(), ret);
#endif
+ if (ret == ENOSYS)
+ ret = ENOTTY;
+ return ret;
}
switch (cmd) {
diff --git a/sys/kern/kern_stub.c b/sys/kern/kern_stub.c
index 3ccb08102fb..0055aa9b8dc 100644
--- a/sys/kern/kern_stub.c
+++ b/sys/kern/kern_stub.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_stub.c,v 1.45 2018/04/12 20:43:44 christos Exp $ */
+/* $NetBSD: kern_stub.c,v 1.46 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.45 2018/04/12 20:43:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.46 2019/01/27 02:08:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_ktrace.h"
@@ -98,7 +98,8 @@ __strong_alias(msgctl1,enosys);
__strong_alias(shmctl1,enosys);
#endif
#ifndef SYSVSEM
-__strong_alias(semctl1,enosys);
+ __strong_alias(semctl1,enosys);
+#endif
#endif
#endif
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index 064ead1fc89..d5f6b3a30e2 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_subr.c,v 1.222 2019/01/05 18:03:41 mlelstv Exp $ */
+/* $NetBSD: kern_subr.c,v 1.223 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.222 2019/01/05 18:03:41 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.223 2019/01/27 02:08:43 pgoyette Exp $");
#include "opt_ddb.h"
#include "opt_md.h"
diff --git a/sys/kern/subr_emul.c b/sys/kern/subr_emul.c
new file mode 100644
index 00000000000..1be33f57d29
--- /dev/null
+++ b/sys/kern/subr_emul.c
@@ -0,0 +1,146 @@
+/* $NetBSD: subr_emul.c,v 1.2 2019/01/27 02:08:43 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 1994, 2000, 2005, 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas and Maxime Villard.
+ *
+ * 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) 1996 Christopher G. Demetriou
+ * 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(1, "$NetBSD: subr_emul.c,v 1.2 2019/01/27 02:08:43 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_pax.h"
+#endif /* _KERNEL_OPT */
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/vnode.h>
+#include <sys/namei.h>
+#include <sys/exec.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;
+}
diff --git a/sys/kern/subr_syscall_stats.c b/sys/kern/subr_syscall_stats.c
index 6ad727ace5c..c93421fc67a 100644
--- a/sys/kern/subr_syscall_stats.c
+++ b/sys/kern/subr_syscall_stats.c
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_syscall_stats.c,v 1.4 2018/12/22 20:49:19 christos Exp $ */
+/* $NetBSD: subr_syscall_stats.c,v 1.5 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_syscall_stats.c,v 1.4 2018/12/22 20:49:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_syscall_stats.c,v 1.5 2019/01/27 02:08:43 pgoyette Exp $");
#include "opt_syscall_stats.h"
diff --git a/sys/kern/sys_module.c b/sys/kern/sys_module.c
index 36e267d4753..79aad3dc8b7 100644
--- a/sys/kern/sys_module.c
+++ b/sys/kern/sys_module.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_module.c,v 1.25 2018/09/04 14:31:18 maxv Exp $ */
+/* $NetBSD: sys_module.c,v 1.26 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.25 2018/09/04 14:31:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.26 2019/01/27 02:08:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_modular.h"
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.25 2018/09/04 14:31:18 maxv Exp $")
#include <sys/module.h>
#include <sys/syscall.h>
#include <sys/syscallargs.h>
+#include <sys/compat_stub.h>
/*
* Arbitrary limit to avoid DoS for excessive memory allocation.
@@ -113,12 +114,21 @@ out1:
static int
handle_modctl_stat(struct 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;
@@ -128,16 +138,54 @@ handle_modctl_stat(struct 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;
- 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;
}
+ }
+ TAILQ_FOREACH(mod, &module_builtins, mod_chain) {
+ ms_cnt++;
+ mi = mod->mod_info;
+ if (mi->mi_required != NULL) {
+ 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;
@@ -153,9 +201,13 @@ handle_modctl_stat(struct 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;
@@ -168,11 +220,41 @@ handle_modctl_stat(struct iovec *iov, void *arg)
ms++;
}
kernconfig_unlock();
- error = copyout(mso, 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 = 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));
}
@@ -235,7 +317,6 @@ sys_modctl(struct lwp *l, const struct sys_modctl_args *uap,
(void *)(uintptr_t)MODCTL_LOAD,
(void *)loadtype, NULL);
break;
-
default:
error = EINVAL;
break;
@@ -244,7 +325,11 @@ sys_modctl(struct lwp *l, const struct sys_modctl_args *uap,
break;
default:
- error = EINVAL;
+
+ MODULE_CALL_HOOK(compat_modstat_80_hook,
+ (SCARG(uap, cmd), &iov, arg), enosys(), error);
+ if (error == ENOSYS)
+ error = EINVAL;
break;
}
diff --git a/sys/kern/syscalls.conf b/sys/kern/syscalls.conf
index 227178d0d3e..057fbd2c084 100644
--- a/sys/kern/syscalls.conf
+++ b/sys/kern/syscalls.conf
@@ -1,4 +1,4 @@
-# $NetBSD: syscalls.conf,v 1.28 2016/05/06 10:17:34 pooka Exp $
+# $NetBSD: syscalls.conf,v 1.29 2019/01/27 02:08:43 pgoyette Exp $
sysnames="syscalls.c"
sysnumhdr="../sys/syscall.h"
@@ -11,7 +11,7 @@ sysalign=1
rumpcalls="../rump/librump/rumpkern/rump_syscalls.c"
rumpcallshdr="../rump/include/rump/rump_syscalls.h"
rumpsysmap="../rump/rump.sysmap"
-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="sysent"
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index b433cc4d43c..ef9e82ddaef 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.293 2018/07/31 13:00:13 rjs Exp $
+ $NetBSD: syscalls.master,v 1.294 2019/01/27 02:08:43 pgoyette Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -76,28 +76,28 @@
5 STD RUMP { int|sys||open(const char *path, \
int flags, ... mode_t mode); }
6 STD RUMP { int|sys||close(int fd); }
-7 COMPAT_50 MODULAR compat { int|sys||wait4(pid_t pid, int *status, \
+7 COMPAT_50 MODULAR compat_50 { int|sys||wait4(pid_t pid, int *status, \
int options, struct rusage50 *rusage); }
-8 COMPAT_43 MODULAR compat \
+8 COMPAT_43 MODULAR compat_43 \
{ int|sys||creat(const char *path, mode_t mode); } ocreat
9 STD RUMP { int|sys||link(const char *path, const char *link); }
10 STD RUMP { int|sys||unlink(const char *path); }
11 OBSOL execv
12 STD RUMP { int|sys||chdir(const char *path); }
13 STD RUMP { int|sys||fchdir(int fd); }
-14 COMPAT_50 MODULAR compat RUMP \
+14 COMPAT_50 MODULAR compat_50 RUMP \
{ int|sys||mknod(const char *path, mode_t mode, uint32_t dev); }
15 STD RUMP { int|sys||chmod(const char *path, mode_t mode); }
16 STD RUMP { int|sys||chown(const char *path, uid_t uid, \
gid_t gid); }
17 STD { int|sys||obreak(char *nsize); } break
-18 COMPAT_20 MODULAR compat { int|sys||getfsstat(struct statfs12 *buf, \
+18 COMPAT_20 MODULAR compat_20 { int|sys||getfsstat(struct statfs12 *buf, \
long bufsize, int flags); }
-19 COMPAT_43 MODULAR compat \
+19 COMPAT_43 MODULAR compat_43 \
{ long|sys||lseek(int fd, long offset, int whence); }\
olseek
20 NOERR RUMP { pid_t|sys||getpid_with_ppid(void); } getpid
-21 COMPAT_40 MODULAR compat \
+21 COMPAT_40 MODULAR compat_40 \
{ int|sys||mount(const char *type, const char *path, \
int flags, void *data); }
22 STD RUMP { int|sys||unmount(const char *path, int flags); }
@@ -125,10 +125,10 @@
35 STD RUMP { int|sys||fchflags(int fd, u_long flags); }
36 NOERR RUMP { void|sys||sync(void); }
37 STD { int|sys||kill(pid_t pid, int signum); }
-38 COMPAT_43 MODULAR compat \
+38 COMPAT_43 MODULAR compat_43 \
{ int|sys||stat(const char *path, struct stat43 *ub); } stat43
39 NOERR RUMP { pid_t|sys||getppid(void); }
-40 COMPAT_43 MODULAR compat \
+40 COMPAT_43 MODULAR compat_43 \
{ int|sys||lstat(const char *path, \
struct stat43 *ub); } lstat43
41 STD RUMP { int|sys||dup(int fd); }
@@ -138,22 +138,22 @@
u_long offset, u_int scale); }
45 STD RUMP { int|sys||ktrace(const char *fname, int ops, \
int facs, pid_t pid); }
-46 COMPAT_13 MODULAR compat { int|sys||sigaction(int signum, \
+46 COMPAT_13 MODULAR compat_13 { int|sys||sigaction(int signum, \
const struct sigaction13 *nsa, \
struct sigaction13 *osa); } sigaction13
47 NOERR RUMP { gid_t|sys||getgid_with_egid(void); } getgid
-48 COMPAT_13 MODULAR compat { int|sys||sigprocmask(int how, \
+48 COMPAT_13 MODULAR compat_13 { int|sys||sigprocmask(int how, \
int mask); } sigprocmask13
49 STD RUMP { int|sys||__getlogin(char *namebuf, size_t namelen); }
50 STD RUMP { int|sys||__setlogin(const char *namebuf); }
51 STD { int|sys||acct(const char *path); }
-52 COMPAT_13 MODULAR compat { int|sys||sigpending(void); } sigpending13
-53 COMPAT_13 MODULAR compat { int|sys||sigaltstack( \
+52 COMPAT_13 MODULAR compat_13 { int|sys||sigpending(void); } sigpending13
+53 COMPAT_13 MODULAR compat_13 { int|sys||sigaltstack( \
const struct sigaltstack13 *nss, \
struct sigaltstack13 *oss); } sigaltstack13
54 STD RUMP { int|sys||ioctl(int fd, \
u_long com, ... void *data); }
-55 COMPAT_12 MODULAR compat { int|sys||reboot(int opt); } oreboot
+55 COMPAT_12 MODULAR compat_12 { int|sys||reboot(int opt); } oreboot
56 STD RUMP { int|sys||revoke(const char *path); }
57 STD RUMP { int|sys||symlink(const char *path, \
const char *link); }
@@ -163,21 +163,21 @@
char * const *argp, char * const *envp); }
60 STD RUMP { mode_t|sys||umask(mode_t newmask); }
61 STD RUMP { int|sys||chroot(const char *path); }
-62 COMPAT_43 MODULAR compat \
+62 COMPAT_43 MODULAR compat_43 \
{ int|sys||fstat(int fd, struct stat43 *sb); } fstat43
-63 COMPAT_43 MODULAR compat \
+63 COMPAT_43 MODULAR compat_43 \
{ int|sys||getkerninfo(int op, char *where, int *size, \
int arg); } ogetkerninfo
-64 COMPAT_43 MODULAR compat \
+64 COMPAT_43 MODULAR compat_43 \
{ int|sys||getpagesize(void); } ogetpagesize
-65 COMPAT_12 MODULAR compat { int|sys||msync(void *addr, size_t len); }
+65 COMPAT_12 MODULAR compat_12 { int|sys||msync(void *addr, size_t len); }
; XXX COMPAT_??? for 4.4BSD-compatible vfork(2)?
66 STD { int|sys||vfork(void); }
67 OBSOL vread
68 OBSOL vwrite
69 OBSOL sbrk
70 OBSOL sstk
-71 COMPAT_43 MODULAR compat \
+71 COMPAT_43 MODULAR compat_43 \
{ int|sys||mmap(void *addr, size_t len, int prot, \
int flags, int fd, long pos); } ommap
72 STD { int|sys||ovadvise(int anom); } vadvise
@@ -196,43 +196,44 @@
const gid_t *gidset); }
81 STD RUMP { int|sys||getpgrp(void); }
82 STD RUMP { int|sys||setpgid(pid_t pid, pid_t pgid); }
-83 COMPAT_50 MODULAR compat { int|sys||setitimer(int which, \
+83 COMPAT_50 MODULAR compat_50 { int|sys||setitimer(int which, \
const struct itimerval50 *itv, \
struct itimerval50 *oitv); }
-84 COMPAT_43 MODULAR compat { int|sys||wait(void); } owait
-85 COMPAT_12 MODULAR compat { int|sys||swapon(const char *name); } oswapon
-86 COMPAT_50 MODULAR compat { int|sys||getitimer(int which, \
+84 COMPAT_43 MODULAR compat_43 { int|sys||wait(void); } owait
+85 COMPAT_12 MODULAR compat_12 { int|sys||swapon(const char *name); } \
+ oswapon
+86 COMPAT_50 MODULAR compat_50 { int|sys||getitimer(int which, \
struct itimerval50 *itv); }
-87 COMPAT_43 MODULAR compat \
+87 COMPAT_43 MODULAR compat_43 \
{ int|sys||gethostname(char *hostname, u_int len); } \
ogethostname
-88 COMPAT_43 MODULAR compat \
+88 COMPAT_43 MODULAR compat_43 \
{ int|sys||sethostname(char *hostname, u_int len); } \
osethostname
-89 COMPAT_43 MODULAR compat \
+89 COMPAT_43 MODULAR compat_43 \
{ int|sys||getdtablesize(void); } ogetdtablesize
90 STD RUMP { int|sys||dup2(int from, int to); }
91 UNIMPL getdopt
92 STD RUMP { int|sys||fcntl(int fd, int cmd, ... void *arg); }
-93 COMPAT_50 MODULAR compat RUMP \
+93 COMPAT_50 MODULAR compat_50 RUMP \
{ int|sys||select(int nd, fd_set *in, fd_set *ou, \
fd_set *ex, struct timeval50 *tv); }
94 UNIMPL setdopt
95 STD RUMP { int|sys||fsync(int fd); }
96 STD { int|sys||setpriority(int which, id_t who, int prio); }
-97 COMPAT_30 MODULAR compat \
+97 COMPAT_30 MODULAR compat_30 \
{ int|sys||socket(int domain, int type, int protocol); }
98 STD RUMP { int|sys||connect(int s, const struct sockaddr *name, \
socklen_t namelen); }
-99 COMPAT_43 MODULAR compat \
+99 COMPAT_43 MODULAR compat_43 \
{ int|sys||accept(int s, void *name, \
socklen_t *anamelen); } oaccept
100 STD { int|sys||getpriority(int which, id_t who); }
-101 COMPAT_43 MODULAR compat { int|sys||send(int s, void *buf, int len, \
+101 COMPAT_43 MODULAR compat_43 { int|sys||send(int s, void *buf, int len, \
int flags); } osend
-102 COMPAT_43 MODULAR compat { int|sys||recv(int s, void *buf, int len, \
+102 COMPAT_43 MODULAR compat_43 { int|sys||recv(int s, void *buf, int len, \
int flags); } orecv
-103 COMPAT_13 MODULAR compat \
+103 COMPAT_13 MODULAR compat_13 \
{ int|sys||sigreturn(struct sigcontext13 *sigcntxp); } \
sigreturn13
104 STD RUMP { int|sys||bind(int s, const struct sockaddr *name, \
@@ -241,23 +242,23 @@
const void *val, socklen_t valsize); }
106 STD RUMP { int|sys||listen(int s, int backlog); }
107 OBSOL vtimes
-108 COMPAT_43 MODULAR compat \
+108 COMPAT_43 MODULAR compat_43 \
{ int|sys||sigvec(int signum, struct sigvec *nsv, \
struct sigvec *osv); } osigvec
109 COMPAT_43 MODULAR compat { int|sys||sigblock(int mask); } osigblock
110 COMPAT_43 MODULAR compat { int|sys||sigsetmask(int mask); } osigsetmask
111 COMPAT_13 MODULAR compat { int|sys||sigsuspend(int mask); } sigsuspend13
-112 COMPAT_43 MODULAR compat { int|sys||sigstack(struct sigstack *nss, \
+112 COMPAT_43 MODULAR compat_43 { int|sys||sigstack(struct sigstack *nss, \
struct sigstack *oss); } osigstack
-113 COMPAT_43 MODULAR compat \
+113 COMPAT_43 MODULAR compat_43 \
{ int|sys||recvmsg(int s, struct omsghdr *msg, \
int flags); } orecvmsg
-114 COMPAT_43 MODULAR compat \
+114 COMPAT_43 MODULAR compat_43 \
{ int|sys||sendmsg(int s, void *msg, int flags); } osendmsg
115 OBSOL vtrace
-116 COMPAT_50 MODULAR compat { int|sys||gettimeofday(struct timeval50 *tp, \
- void *tzp); }
-117 COMPAT_50 MODULAR compat \
+116 COMPAT_50 MODULAR compat_50 \
+ { int|sys||gettimeofday(struct timeval50 *tp, void *tzp); }
+117 COMPAT_50 MODULAR compat_50 \
{ int|sys||getrusage(int who, struct rusage50 *rusage); }
118 STD RUMP { int|sys||getsockopt(int s, int level, int name, \
void *val, socklen_t *avalsize); }
@@ -266,21 +267,21 @@
const struct iovec *iovp, int iovcnt); }
121 STD RUMP { ssize_t|sys||writev(int fd, \
const struct iovec *iovp, int iovcnt); }
-122 COMPAT_50 MODULAR compat \
+122 COMPAT_50 MODULAR compat_50 \
{ int|sys||settimeofday(const struct timeval50 *tv, \
const void *tzp); }
123 STD RUMP { int|sys||fchown(int fd, uid_t uid, gid_t gid); }
124 STD RUMP { int|sys||fchmod(int fd, mode_t mode); }
-125 COMPAT_43 MODULAR compat \
+125 COMPAT_43 MODULAR compat_43 \
{ int|sys||recvfrom(int s, void *buf, size_t len, \
int flags, void *from, socklen_t *fromlenaddr); } \
orecvfrom
126 STD RUMP { int|sys||setreuid(uid_t ruid, uid_t euid); }
127 STD RUMP { int|sys||setregid(gid_t rgid, gid_t egid); }
128 STD RUMP { int|sys||rename(const char *from, const char *to); }
-129 COMPAT_43 MODULAR compat \
+129 COMPAT_43 MODULAR compat_43 \
{ int|sys||truncate(const char *path, long length); } otruncate
-130 COMPAT_43 MODULAR compat \
+130 COMPAT_43 MODULAR compat_43 \
{ int|sys||ftruncate(int fd, long length); } oftruncate
131 STD RUMP { int|sys||flock(int fd, int how); }
132 STD RUMP { int|sys||mkfifo(const char *path, mode_t mode); }
@@ -292,32 +293,32 @@
int protocol, int *rsv); }
136 STD RUMP { int|sys||mkdir(const char *path, mode_t mode); }
137 STD RUMP { int|sys||rmdir(const char *path); }
-138 COMPAT_50 MODULAR compat RUMP { int|sys||utimes(const char *path, \
+138 COMPAT_50 MODULAR compat_50 RUMP { int|sys||utimes(const char *path, \
const struct timeval50 *tptr); }
139 OBSOL 4.2 sigreturn
-140 COMPAT_50 MODULAR compat \
+140 COMPAT_50 MODULAR compat_50 \
{ int|sys||adjtime(const struct timeval50 *delta, \
struct timeval50 *olddelta); }
-141 COMPAT_43 MODULAR compat \
+141 COMPAT_43 MODULAR compat_43 \
{ int|sys||getpeername(int fdes, void *asa, \
socklen_t *alen); } ogetpeername
-142 COMPAT_43 MODULAR compat \
+142 COMPAT_43 MODULAR compat_43 \
{ int32_t|sys||gethostid(void); } ogethostid
-143 COMPAT_43 MODULAR compat \
+143 COMPAT_43 MODULAR compat_43 \
{ int|sys||sethostid(int32_t hostid); } osethostid
-144 COMPAT_43 MODULAR compat \
+144 COMPAT_43 MODULAR compat_43 \
{ int|sys||getrlimit(int which, \
struct orlimit *rlp); } ogetrlimit
-145 COMPAT_43 MODULAR compat { int|sys||setrlimit(int which, \
+145 COMPAT_43 MODULAR compat_43 { int|sys||setrlimit(int which, \
const struct orlimit *rlp); } osetrlimit
-146 COMPAT_43 MODULAR compat \
+146 COMPAT_43 MODULAR compat_43 \
{ int|sys||killpg(int pgid, int signum); } okillpg
147 STD RUMP { int|sys||setsid(void); }
148 COMPAT_50 MODULAR XXX { int|sys||quotactl(const char *path, int cmd, \
int uid, void *arg); }
-149 COMPAT_43 MODULAR compat { int|sys||quota(void); } oquota
-150 COMPAT_43 MODULAR compat { int|sys||getsockname(int fdec, void *asa, \
- socklen_t *alen); } ogetsockname
+149 COMPAT_43 MODULAR compat_43 { int|sys||quota(void); } oquota
+150 COMPAT_43 MODULAR compat_43 { int|sys||getsockname(int fdec, \
+ void *asa, socklen_t *alen); } ogetsockname
; Syscalls 151-180 inclusive are reserved for vendor-specific
; system calls. (This includes various calls added for compatibity
@@ -328,21 +329,21 @@
153 UNIMPL
154 UNIMPL
155 STD MODULAR nfsserver RUMP { int|sys||nfssvc(int flag, void *argp); }
-156 COMPAT_43 MODULAR compat \
+156 COMPAT_43 MODULAR compat_43 \
{ int|sys||getdirentries(int fd, char *buf, \
u_int count, long *basep); } ogetdirentries
-157 COMPAT_20 MODULAR compat { int|sys||statfs(const char *path, \
+157 COMPAT_20 MODULAR compat_20 { int|sys||statfs(const char *path, \
struct statfs12 *buf); }
-158 COMPAT_20 MODULAR compat \
+158 COMPAT_20 MODULAR compat_20 \
{ int|sys||fstatfs(int fd, struct statfs12 *buf); }
159 UNIMPL
160 UNIMPL
-161 COMPAT_30 MODULAR compat { int|sys||getfh(const char *fname, \
+161 COMPAT_30 MODULAR compat_30 { int|sys||getfh(const char *fname, \
struct compat_30_fhandle *fhp); }
-162 COMPAT_09 MODULAR compat \
+162 COMPAT_09 MODULAR compat_09 \
{ int|sys||getdomainname(char *domainname, int len); } \
ogetdomainname
-163 COMPAT_09 MODULAR compat \
+163 COMPAT_09 MODULAR compat_09 \
{ int|sys||setdomainname(char *domainname, int len); } \
osetdomainname
164 COMPAT_09 MODULAR compat \
@@ -353,7 +354,7 @@
168 UNIMPL
; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
#if !defined(_LP64)
-169 COMPAT_10 MODULAR sysv_ipc \
+169 COMPAT_10 MODULAR compat_sysv_10 \
{ int|sys||semsys(int which, int a2, int a3, int a4, \
int a5); } osemsys
#else
@@ -361,7 +362,7 @@
#endif
; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
#if !defined(_LP64)
-170 COMPAT_10 MODULAR sysv_ipc \
+170 COMPAT_10 MODULAR compat_sysv_10 \
{ int|sys||msgsys(int which, int a2, int a3, int a4, \
int a5, int a6); } omsgsys
#else
@@ -369,7 +370,7 @@
#endif
; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
#if !defined(_LP64)
-171 COMPAT_10 MODULAR sysv_ipc \
+171 COMPAT_10 MODULAR compat_sysv_10 \
{ int|sys||shmsys(int which, int a2, int a3, int a4); } \
oshmsys
#else
@@ -381,7 +382,8 @@
174 STD RUMP { ssize_t|sys||pwrite(int fd, const void *buf, \
size_t nbyte, int PAD, off_t offset); }
; For some reason, ntp_gettime doesn't want to raise SIGSYS when it's excluded.
-175 COMPAT_30 { int|sys||ntp_gettime(struct ntptimeval30 *ntvp); }
+175 COMPAT_30 MODULAR compat_30 \
+ { int|sys||ntp_gettime(struct ntptimeval30 *ntvp); }
#if defined(NTP) || !defined(_KERNEL_OPT)
176 STD { int|sys||ntp_adjtime(struct timex *tp); }
#else
@@ -401,13 +403,13 @@
185 STD MODULAR lfs { int|sys||lfs_markv(fsid_t *fsidp, \
struct block_info *blkiov, int blkcnt); }
186 STD MODULAR lfs { int|sys||lfs_segclean(fsid_t *fsidp, u_long segment); }
-187 COMPAT_50 MODULAR compat { int|sys||lfs_segwait(fsid_t *fsidp, \
+187 COMPAT_50 MODULAR compat_50 { int|sys||lfs_segwait(fsid_t *fsidp, \
struct timeval50 *tv); }
-188 COMPAT_12 MODULAR compat \
+188 COMPAT_12 MODULAR compat_12 \
{ int|sys||stat(const char *path, struct stat12 *ub); } stat12
-189 COMPAT_12 MODULAR compat \
+189 COMPAT_12 MODULAR compat_12 \
{ int|sys||fstat(int fd, struct stat12 *sb); } fstat12
-190 COMPAT_12 MODULAR compat { int|sys||lstat(const char *path, \
+190 COMPAT_12 MODULAR compat_12 { int|sys||lstat(const char *path, \
struct stat12 *ub); } lstat12
191 STD RUMP { long|sys||pathconf(const char *path, int name); }
192 STD RUMP { long|sys||fpathconf(int fd, int name); }
@@ -417,7 +419,7 @@
struct rlimit *rlp); }
195 STD RUMP { int|sys||setrlimit(int which, \
const struct rlimit *rlp); }
-196 COMPAT_12 MODULAR compat \
+196 COMPAT_12 MODULAR compat_12 \
{ int|sys||getdirentries(int fd, char *buf, \
u_int count, long *basep); }
197 STD { void *|sys||mmap(void *addr, size_t len, int prot, \
@@ -435,7 +437,7 @@
203 STD { int|sys||mlock(const void *addr, size_t len); }
204 STD { int|sys||munlock(const void *addr, size_t len); }
205 STD { int|sys||undelete(const char *path); }
-206 COMPAT_50 MODULAR compat RUMP { int|sys||futimes(int fd, \
+206 COMPAT_50 MODULAR compat_50 RUMP { int|sys||futimes(int fd, \
const struct timeval50 *tptr); }
207 STD RUMP { pid_t|sys||getpgid(pid_t pid); }
208 STD RUMP { int|sys||reboot(int opt, char *bootstr); }
@@ -456,7 +458,7 @@
218 UNIMPL
219 UNIMPL
; System calls 220-300 are reserved for use by NetBSD
-220 COMPAT_14 MODULAR sysv_ipc \
+220 COMPAT_14 MODULAR compat_sysv_14 \
{ int|sys||__semctl(int semid, int semnum, int cmd, \
union __semun *arg); }
221 STD MODULAR sysv_ipc { int|sys||semget(key_t key, int nsems, \
@@ -464,7 +466,7 @@
222 STD MODULAR sysv_ipc { int|sys||semop(int semid, struct sembuf *sops, \
size_t nsops); }
223 STD MODULAR sysv_ipc { int|sys||semconfig(int flag); }
-224 COMPAT_14 MODULAR sysv_ipc { int|sys||msgctl(int msqid, int cmd, \
+224 COMPAT_14 MODULAR compat_sysv_14 { int|sys||msgctl(int msqid, int cmd, \
struct msqid_ds14 *buf); }
225 STD MODULAR sysv_ipc { int|sys||msgget(key_t key, int msgflg); }
226 STD MODULAR sysv_ipc { int|sys||msgsnd(int msqid, const void *msgp, \
@@ -473,36 +475,39 @@
size_t msgsz, long msgtyp, int msgflg); }
228 STD MODULAR sysv_ipc { void *|sys||shmat(int shmid, \
const void *shmaddr, int shmflg); }
-229 COMPAT_14 MODULAR sysv_ipc { int|sys||shmctl(int shmid, int cmd, \
+229 COMPAT_14 MODULAR compat_sysv_14 { int|sys||shmctl(int shmid, int cmd, \
struct shmid_ds14 *buf); }
230 STD MODULAR sysv_ipc { int|sys||shmdt(const void *shmaddr); }
231 STD MODULAR sysv_ipc { int|sys||shmget(key_t key, size_t size, \
int shmflg); }
-232 COMPAT_50 MODULAR compat { int|sys||clock_gettime(clockid_t clock_id, \
- struct timespec50 *tp); }
-233 COMPAT_50 MODULAR compat { int|sys||clock_settime(clockid_t clock_id, \
- const struct timespec50 *tp); }
-234 COMPAT_50 MODULAR compat { int|sys||clock_getres(clockid_t clock_id, \
- struct timespec50 *tp); }
+232 COMPAT_50 MODULAR compat_50 \
+ { int|sys||clock_gettime(clockid_t clock_id, \
+ struct timespec50 *tp); }
+233 COMPAT_50 MODULAR compat_50 \
+ { int|sys||clock_settime(clockid_t clock_id, \
+ const struct timespec50 *tp); }
+234 COMPAT_50 MODULAR compat_50 \
+ { int|sys||clock_getres(clockid_t clock_id, \
+ struct timespec50 *tp); }
235 STD RUMP { int|sys||timer_create(clockid_t clock_id, \
struct sigevent *evp, timer_t *timerid); }
236 STD RUMP { int|sys||timer_delete(timer_t timerid); }
-237 COMPAT_50 MODULAR compat { int|sys||timer_settime(timer_t timerid, \
+237 COMPAT_50 MODULAR compat_50 { int|sys||timer_settime(timer_t timerid, \
int flags, const struct itimerspec50 *value, \
struct itimerspec50 *ovalue); }
-238 COMPAT_50 MODULAR compat { int|sys||timer_gettime(timer_t timerid, \
+238 COMPAT_50 MODULAR compat_50 { int|sys||timer_gettime(timer_t timerid, \
struct itimerspec50 *value); }
239 STD RUMP { int|sys||timer_getoverrun(timer_t timerid); }
;
; Syscalls 240-269 are reserved for other IEEE Std1003.1b syscalls
;
-240 COMPAT_50 MODULAR compat \
+240 COMPAT_50 MODULAR compat_50 \
{ int|sys||nanosleep(const struct timespec50 *rqtp, \
struct timespec50 *rmtp); }
241 STD RUMP { int|sys||fdatasync(int fd); }
242 STD { int|sys||mlockall(int flags); }
243 STD { int|sys||munlockall(void); }
-244 COMPAT_50 MODULAR compat \
+244 COMPAT_50 MODULAR compat_50 \
{ int|sys||__sigtimedwait(const sigset_t *set, \
siginfo_t *info, struct timespec50 *timeout); }
245 STD { int|sys||sigqueueinfo(pid_t pid, \
@@ -542,35 +547,36 @@
264 STD MODULAR mqueue \
{ ssize_t|sys||mq_receive(mqd_t mqdes, char *msg_ptr, \
size_t msg_len, unsigned *msg_prio); }
-265 COMPAT_50 MODULAR compat \
- { int|sys||mq_timedsend(mqd_t mqdes, \
- const char *msg_ptr, size_t msg_len, \
- unsigned msg_prio, \
- const struct timespec50 *abs_timeout); }
-266 COMPAT_50 MODULAR compat \
- { ssize_t|sys||mq_timedreceive(mqd_t mqdes, \
- char *msg_ptr, size_t msg_len, unsigned *msg_prio, \
- const struct timespec50 *abs_timeout); }
+265 COMPAT_50 MODULAR compat_50 \
+ { int|sys||mq_timedsend(mqd_t mqdes, \
+ const char *msg_ptr, size_t msg_len, \
+ unsigned msg_prio, \
+ const struct timespec50 *abs_timeout); }
+266 COMPAT_50 MODULAR compat_50 \
+ { ssize_t|sys||mq_timedreceive(mqd_t mqdes, \
+ char *msg_ptr, size_t msg_len, unsigned *msg_prio, \
+ const struct timespec50 *abs_timeout); }
267 UNIMPL
268 UNIMPL
269 UNIMPL
270 STD RUMP { int|sys||__posix_rename(const char *from, \
const char *to); }
271 STD { int|sys||swapctl(int cmd, void *arg, int misc); }
-272 COMPAT_30 MODULAR compat { int|sys||getdents(int fd, char *buf, size_t count); }
+272 COMPAT_30 MODULAR compat_30 \
+ { int|sys||getdents(int fd, char *buf, size_t count); }
273 STD { int|sys||minherit(void *addr, size_t len, \
int inherit); }
274 STD RUMP { int|sys||lchmod(const char *path, mode_t mode); }
275 STD RUMP { int|sys||lchown(const char *path, uid_t uid, \
gid_t gid); }
-276 COMPAT_50 MODULAR compat RUMP { int|sys||lutimes(const char *path, \
+276 COMPAT_50 MODULAR compat_50 RUMP { int|sys||lutimes(const char *path, \
const struct timeval50 *tptr); }
277 STD { int|sys|13|msync(void *addr, size_t len, int flags); }
-278 COMPAT_30 MODULAR compat \
+278 COMPAT_30 MODULAR compat_30 \
{ int|sys|13|stat(const char *path, struct stat13 *ub); }
-279 COMPAT_30 MODULAR compat \
+279 COMPAT_30 MODULAR compat_30 \
{ int|sys|13|fstat(int fd, struct stat13 *sb); }
-280 COMPAT_30 MODULAR compat \
+280 COMPAT_30 MODULAR compat_30 \
{ int|sys|13|lstat(const char *path, struct stat13 *ub); }
281 STD { int|sys|14|sigaltstack( \
const struct sigaltstack *nss, \
@@ -592,7 +598,7 @@
290 STD RUMP { ssize_t|sys||pwritev(int fd, \
const struct iovec *iovp, int iovcnt, \
int PAD, off_t offset); }
-291 COMPAT_16 MODULAR compat { int|sys|14|sigaction(int signum, \
+291 COMPAT_16 MODULAR compat_16 { int|sys|14|sigaction(int signum, \
const struct sigaction *nsa, \
struct sigaction *osa); }
292 STD { int|sys|14|sigpending(sigset_t *set); }
@@ -600,26 +606,27 @@
const sigset_t *set, \
sigset_t *oset); }
294 STD { int|sys|14|sigsuspend(const sigset_t *set); }
-295 COMPAT_16 MODULAR compat \
+295 COMPAT_16 MODULAR compat_16 \
{ int|sys|14|sigreturn(struct sigcontext *sigcntxp); }
296 STD RUMP { int|sys||__getcwd(char *bufp, size_t length); }
297 STD RUMP { int|sys||fchroot(int fd); }
-298 COMPAT_30 MODULAR compat \
+298 COMPAT_30 MODULAR compat_30 \
{ int|sys||fhopen(const struct compat_30_fhandle *fhp, int flags); }
-299 COMPAT_30 MODULAR compat \
+299 COMPAT_30 MODULAR compat_30 \
{ int|sys||fhstat(const struct compat_30_fhandle *fhp, \
struct stat13 *sb); }
-300 COMPAT_20 MODULAR compat \
+300 COMPAT_20 MODULAR compat_20 \
{ int|sys||fhstatfs(const struct compat_30_fhandle *fhp, \
struct statfs12 *buf); }
-301 COMPAT_50 MODULAR sysv_ipc \
+301 COMPAT_50 MODULAR compat_sysv_50 \
{ int|sys|13|__semctl(int semid, int semnum, int cmd, \
... union __semun *arg); }
-302 COMPAT_50 MODULAR sysv_ipc { int|sys|13|msgctl(int msqid, int cmd, \
- struct msqid_ds *buf); }
-303 COMPAT_50 MODULAR sysv_ipc { int|sys|13|shmctl(int shmid, int cmd, \
+302 COMPAT_50 MODULAR compat_sysv_50 \
+ { int|sys|13|msgctl(int msqid, int cmd, struct msqid_ds *buf); }
+303 COMPAT_50 MODULAR compat_sysv_50 \
+ { int|sys|13|shmctl(int shmid, int cmd, \
struct shmid_ds13 *buf); }
-304 STD RUMP { int|sys||lchflags(const char *path, u_long flags); }
+304 STD RUMP { int|sys||lchflags(const char *path, u_long flags); }
305 NOERR RUMP { int|sys||issetugid(void); }
306 STD RUMP { int|sys||utrace(const char *label, void *addr, \
size_t len); }
@@ -638,7 +645,7 @@
317 STD { void|sys||_lwp_setprivate(void *ptr); }
318 STD { int|sys||_lwp_kill(lwpid_t target, int signo); }
319 STD { int|sys||_lwp_detach(lwpid_t target); }
-320 COMPAT_50 MODULAR compat \
+320 COMPAT_50 MODULAR compat_50 \
{ int|sys||_lwp_park(const struct timespec50 *ts, \
lwpid_t unpark, const void *hint, \
const void *unparkhint); }
@@ -657,13 +664,19 @@
328 UNIMPL
329 UNIMPL
; SA system calls.
-330 COMPAT_60 { int|sys||sa_register(void *newv, void **oldv, \
+330 COMPAT_60 MODULAR compat_60 \
+ { int|sys||sa_register(void *newv, void **oldv, \
int flags, ssize_t stackinfo_offset); }
-331 COMPAT_60 { int|sys||sa_stacks(int num, stack_t *stacks); }
-332 COMPAT_60 { int|sys||sa_enable(void); }
-333 COMPAT_60 { int|sys||sa_setconcurrency(int concurrency); }
-334 COMPAT_60 { int|sys||sa_yield(void); }
-335 COMPAT_60 { int|sys||sa_preempt(int sa_id); }
+331 COMPAT_60 MODULAR compat_60 \
+ { int|sys||sa_stacks(int num, stack_t *stacks); }
+332 COMPAT_60 MODULAR compat_60 \
+ { int|sys||sa_enable(void); }
+333 COMPAT_60 MODULAR compat_60 \
+ { int|sys||sa_setconcurrency(int concurrency); }
+334 COMPAT_60 MODULAR compat_60 \
+ { int|sys||sa_yield(void); }
+335 COMPAT_60 MODULAR compat_60 \
+ { int|sys||sa_preempt(int sa_id); }
336 OBSOL sys_sa_unblockyield
;
; Syscalls 337-339 are reserved for other scheduler activation syscalls.
@@ -679,7 +692,7 @@
342 OBSOL sys_pmc_control
343 STD { int|sys||rasctl(void *addr, size_t len, int op); }
344 STD RUMP { int|sys||kqueue(void); }
-345 COMPAT_50 MODULAR compat RUMP { int|sys||kevent(int fd, \
+345 COMPAT_50 MODULAR compat_50 RUMP { int|sys||kevent(int fd, \
const struct kevent *changelist, size_t nchanges, \
struct kevent *eventlist, size_t nevents, \
const struct timespec50 *timeout); }
@@ -707,7 +720,7 @@
struct statvfs *buf, int flags); }
358 STD RUMP { int|sys||fstatvfs1(int fd, struct statvfs *buf, \
int flags); }
-359 COMPAT_30 MODULAR compat \
+359 COMPAT_30 MODULAR compat_30 \
{ int|sys||fhstatvfs1(const struct compat_30_fhandle *fhp, \
struct statvfs *buf, int flags); }
360 STD RUMP { int|sys||extattrctl(const char *path, int cmd, \
@@ -743,11 +756,11 @@
int attrnamespace, void *data, size_t nbytes); }
372 STD RUMP { ssize_t|sys||extattr_list_link(const char *path, \
int attrnamespace, void *data, size_t nbytes); }
-373 COMPAT_50 MODULAR compat RUMP \
+373 COMPAT_50 MODULAR compat_50 RUMP \
{ int|sys||pselect(int nd, fd_set *in, fd_set *ou, \
fd_set *ex, const struct timespec50 *ts, \
const sigset_t *mask); }
-374 COMPAT_50 MODULAR compat RUMP \
+374 COMPAT_50 MODULAR compat_50 RUMP \
{ int|sys||pollts(struct pollfd *fds, u_int nfds, \
const struct timespec50 *ts, const sigset_t *mask); }
375 STD RUMP { int|sys||setxattr(const char *path, \
@@ -777,17 +790,18 @@
const char *name); }
386 STD RUMP { int|sys||fremovexattr(int fd, \
const char *name); }
-387 COMPAT_50 MODULAR compat RUMP \
+387 COMPAT_50 MODULAR compat_50 RUMP \
{ int|sys|30|stat(const char *path, struct stat30 *ub); }
-388 COMPAT_50 MODULAR compat RUMP \
+388 COMPAT_50 MODULAR compat_50 RUMP \
{ int|sys|30|fstat(int fd, struct stat30 *sb); }
-389 COMPAT_50 MODULAR compat RUMP \
+389 COMPAT_50 MODULAR compat_50 RUMP \
{ int|sys|30|lstat(const char *path, struct stat30 *ub); }
390 STD RUMP { int|sys|30|getdents(int fd, char *buf, size_t count); }
391 IGNORED old posix_fadvise
-392 COMPAT_30 MODULAR compat { int|sys|30|fhstat(const struct compat_30_fhandle \
+392 COMPAT_30 MODULAR compat_30 \
+ { int|sys|30|fhstat(const struct compat_30_fhandle \
*fhp, struct stat30 *sb); }
-393 COMPAT_50 MODULAR compat \
+393 COMPAT_50 MODULAR compat_30 \
{ int|sys|30|ntp_gettime(struct ntptimeval50 *ntvp); }
394 STD RUMP { int|sys|30|socket(int domain, int type, int protocol); }
395 STD RUMP { int|sys|30|getfh(const char *fname, void *fhp, \
@@ -796,7 +810,7 @@
int flags); }
397 STD RUMP { int|sys|40|fhstatvfs1(const void *fhp, \
size_t fh_size, struct statvfs *buf, int flags); }
-398 COMPAT_50 MODULAR compat RUMP { int|sys|40|fhstat(const void *fhp, \
+398 COMPAT_50 MODULAR compat_50 RUMP { int|sys|40|fhstat(const void *fhp, \
size_t fh_size, struct stat30 *sb); }
; Asynchronous I/O system calls
@@ -879,7 +893,7 @@
{ ssize_t|sys|50|mq_timedreceive(mqd_t mqdes, \
char *msg_ptr, size_t msg_len, unsigned *msg_prio, \
const struct timespec *abs_timeout); }
-434 COMPAT_60 MODULAR compat \
+434 COMPAT_60 MODULAR compat_60 \
{ int|sys||_lwp_park(const struct timespec *ts, \
lwpid_t unpark, const void *hint, \
const void *unparkhint); }
diff --git a/sys/kern/syscalls_autoload.c b/sys/kern/syscalls_autoload.c
index c3a1f494f71..81c6169ae5b 100644
--- a/sys/kern/syscalls_autoload.c
+++ b/sys/kern/syscalls_autoload.c
@@ -1,4 +1,4 @@
-/* $NetBSD: syscalls_autoload.c,v 1.29 2018/08/10 21:47:16 pgoyette Exp $ */
+/* $NetBSD: syscalls_autoload.c,v 1.30 2019/01/27 02:08:43 pgoyette Exp $ */
/*
* System call autoload table.
@@ -8,115 +8,116 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.29 2018/08/10 21:47:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.30 2019/01/27 02:08:43 pgoyette Exp $");
#include <sys/proc.h>
static struct sc_autoload netbsd_syscalls_autoload[] = {
- { SYS_compat_50_wait4, "compat" },
- { SYS_compat_43_ocreat, "compat" },
- { SYS_compat_50_mknod, "compat" },
- { SYS_compat_20_getfsstat, "compat" },
- { SYS_compat_43_olseek, "compat" },
- { SYS_compat_40_mount, "compat" },
+ { SYS_compat_50_wait4, "compat_50" },
+ { SYS_compat_43_ocreat, "compat_43" },
+ { SYS_compat_50_mknod, "compat_50" },
+ { SYS_compat_20_getfsstat, "compat_20" },
+ { SYS_compat_43_olseek, "compat_43" },
+ { SYS_compat_40_mount, "compat_40" },
{ SYS_ptrace, "ptrace" },
- { SYS_compat_43_stat43, "compat" },
- { SYS_compat_43_lstat43, "compat" },
- { SYS_compat_13_sigaction13, "compat" },
- { SYS_compat_13_sigprocmask13, "compat" },
- { SYS_compat_13_sigpending13, "compat" },
- { SYS_compat_13_sigaltstack13, "compat" },
- { SYS_compat_12_oreboot, "compat" },
- { SYS_compat_43_fstat43, "compat" },
- { SYS_compat_43_ogetkerninfo, "compat" },
- { SYS_compat_43_ogetpagesize, "compat" },
- { SYS_compat_12_msync, "compat" },
- { SYS_compat_43_ommap, "compat" },
- { SYS_compat_50_setitimer, "compat" },
- { SYS_compat_43_owait, "compat" },
- { SYS_compat_12_oswapon, "compat" },
- { SYS_compat_50_getitimer, "compat" },
- { SYS_compat_43_ogethostname, "compat" },
- { SYS_compat_43_osethostname, "compat" },
- { SYS_compat_43_ogetdtablesize, "compat" },
- { SYS_compat_50_select, "compat" },
- { SYS_compat_30_socket, "compat" },
- { SYS_compat_43_oaccept, "compat" },
- { SYS_compat_43_osend, "compat" },
- { SYS_compat_43_orecv, "compat" },
- { SYS_compat_13_sigreturn13, "compat" },
- { SYS_compat_43_osigvec, "compat" },
+ { SYS_compat_43_stat43, "compat_43" },
+ { SYS_compat_43_lstat43, "compat_43" },
+ { SYS_compat_13_sigaction13, "compat_13" },
+ { SYS_compat_13_sigprocmask13, "compat_13" },
+ { SYS_compat_13_sigpending13, "compat_13" },
+ { SYS_compat_13_sigaltstack13, "compat_13" },
+ { SYS_compat_12_oreboot, "compat_12" },
+ { SYS_compat_43_fstat43, "compat_43" },
+ { SYS_compat_43_ogetkerninfo, "compat_43" },
+ { SYS_compat_43_ogetpagesize, "compat_43" },
+ { SYS_compat_12_msync, "compat_12" },
+ { SYS_compat_43_ommap, "compat_43" },
+ { SYS_compat_50_setitimer, "compat_50" },
+ { SYS_compat_43_owait, "compat_43" },
+ { SYS_compat_12_oswapon, "compat_12" },
+ { SYS_compat_50_getitimer, "compat_50" },
+ { SYS_compat_43_ogethostname, "compat_43" },
+ { SYS_compat_43_osethostname, "compat_43" },
+ { SYS_compat_43_ogetdtablesize, "compat_43" },
+ { SYS_compat_50_select, "compat_50" },
+ { SYS_compat_30_socket, "compat_30" },
+ { SYS_compat_43_oaccept, "compat_43" },
+ { SYS_compat_43_osend, "compat_43" },
+ { SYS_compat_43_orecv, "compat_43" },
+ { SYS_compat_13_sigreturn13, "compat_13" },
+ { SYS_compat_43_osigvec, "compat_43" },
{ SYS_compat_43_osigblock, "compat" },
{ SYS_compat_43_osigsetmask, "compat" },
{ SYS_compat_13_sigsuspend13, "compat" },
- { SYS_compat_43_osigstack, "compat" },
- { SYS_compat_43_orecvmsg, "compat" },
- { SYS_compat_43_osendmsg, "compat" },
- { SYS_compat_50_gettimeofday, "compat" },
- { SYS_compat_50_getrusage, "compat" },
- { SYS_compat_50_settimeofday, "compat" },
- { SYS_compat_43_orecvfrom, "compat" },
- { SYS_compat_43_otruncate, "compat" },
- { SYS_compat_43_oftruncate, "compat" },
- { SYS_compat_50_utimes, "compat" },
- { SYS_compat_50_adjtime, "compat" },
- { SYS_compat_43_ogetpeername, "compat" },
- { SYS_compat_43_ogethostid, "compat" },
- { SYS_compat_43_osethostid, "compat" },
- { SYS_compat_43_ogetrlimit, "compat" },
- { SYS_compat_43_osetrlimit, "compat" },
- { SYS_compat_43_okillpg, "compat" },
+ { SYS_compat_43_osigstack, "compat_43" },
+ { SYS_compat_43_orecvmsg, "compat_43" },
+ { SYS_compat_43_osendmsg, "compat_43" },
+ { SYS_compat_50_gettimeofday, "compat_50" },
+ { SYS_compat_50_getrusage, "compat_50" },
+ { SYS_compat_50_settimeofday, "compat_50" },
+ { SYS_compat_43_orecvfrom, "compat_43" },
+ { SYS_compat_43_otruncate, "compat_43" },
+ { SYS_compat_43_oftruncate, "compat_43" },
+ { SYS_compat_50_utimes, "compat_50" },
+ { SYS_compat_50_adjtime, "compat_50" },
+ { SYS_compat_43_ogetpeername, "compat_43" },
+ { SYS_compat_43_ogethostid, "compat_43" },
+ { SYS_compat_43_osethostid, "compat_43" },
+ { SYS_compat_43_ogetrlimit, "compat_43" },
+ { SYS_compat_43_osetrlimit, "compat_43" },
+ { SYS_compat_43_okillpg, "compat_43" },
{ SYS_compat_50_quotactl, "XXX" },
- { SYS_compat_43_oquota, "compat" },
- { SYS_compat_43_ogetsockname, "compat" },
+ { SYS_compat_43_oquota, "compat_43" },
+ { SYS_compat_43_ogetsockname, "compat_43" },
{ SYS_nfssvc, "nfsserver" },
- { SYS_compat_43_ogetdirentries, "compat" },
- { SYS_compat_20_statfs, "compat" },
- { SYS_compat_20_fstatfs, "compat" },
- { SYS_compat_30_getfh, "compat" },
- { SYS_compat_09_ogetdomainname, "compat" },
- { SYS_compat_09_osetdomainname, "compat" },
+ { SYS_compat_43_ogetdirentries, "compat_43" },
+ { SYS_compat_20_statfs, "compat_20" },
+ { SYS_compat_20_fstatfs, "compat_20" },
+ { SYS_compat_30_getfh, "compat_30" },
+ { SYS_compat_09_ogetdomainname, "compat_09" },
+ { SYS_compat_09_osetdomainname, "compat_09" },
{ SYS_compat_09_ouname, "compat" },
#if !defined(_LP64)
- { SYS_compat_10_osemsys, "sysv_ipc" },
+ { SYS_compat_10_osemsys, "compat_sysv_10" },
#else
#endif
#if !defined(_LP64)
- { SYS_compat_10_omsgsys, "sysv_ipc" },
+ { SYS_compat_10_omsgsys, "compat_sysv_10" },
#else
#endif
#if !defined(_LP64)
- { SYS_compat_10_oshmsys, "sysv_ipc" },
+ { SYS_compat_10_oshmsys, "compat_sysv_10" },
#else
#endif
+ { SYS_compat_30_ntp_gettime, "compat_30" },
{ SYS_lfs_bmapv, "lfs" },
{ SYS_lfs_markv, "lfs" },
{ SYS_lfs_segclean, "lfs" },
- { SYS_compat_50_lfs_segwait, "compat" },
- { SYS_compat_12_stat12, "compat" },
- { SYS_compat_12_fstat12, "compat" },
- { SYS_compat_12_lstat12, "compat" },
- { SYS_compat_12_getdirentries, "compat" },
- { SYS_compat_50_futimes, "compat" },
+ { SYS_compat_50_lfs_segwait, "compat_50" },
+ { SYS_compat_12_stat12, "compat_12" },
+ { SYS_compat_12_fstat12, "compat_12" },
+ { SYS_compat_12_lstat12, "compat_12" },
+ { SYS_compat_12_getdirentries, "compat_12" },
+ { SYS_compat_50_futimes, "compat_50" },
{ SYS_afssys, "openafs" },
- { SYS_compat_14___semctl, "sysv_ipc" },
+ { SYS_compat_14___semctl, "compat_sysv_14" },
{ SYS_semget, "sysv_ipc" },
{ SYS_semop, "sysv_ipc" },
{ SYS_semconfig, "sysv_ipc" },
- { SYS_compat_14_msgctl, "sysv_ipc" },
+ { SYS_compat_14_msgctl, "compat_sysv_14" },
{ SYS_msgget, "sysv_ipc" },
{ SYS_msgsnd, "sysv_ipc" },
{ SYS_msgrcv, "sysv_ipc" },
{ SYS_shmat, "sysv_ipc" },
- { SYS_compat_14_shmctl, "sysv_ipc" },
+ { SYS_compat_14_shmctl, "compat_sysv_14" },
{ SYS_shmdt, "sysv_ipc" },
{ SYS_shmget, "sysv_ipc" },
- { SYS_compat_50_clock_gettime, "compat" },
- { SYS_compat_50_clock_settime, "compat" },
- { SYS_compat_50_clock_getres, "compat" },
- { SYS_compat_50_timer_settime, "compat" },
- { SYS_compat_50_timer_gettime, "compat" },
- { SYS_compat_50_nanosleep, "compat" },
- { SYS_compat_50___sigtimedwait, "compat" },
+ { SYS_compat_50_clock_gettime, "compat_50" },
+ { SYS_compat_50_clock_settime, "compat_50" },
+ { SYS_compat_50_clock_getres, "compat_50" },
+ { SYS_compat_50_timer_settime, "compat_50" },
+ { SYS_compat_50_timer_gettime, "compat_50" },
+ { SYS_compat_50_nanosleep, "compat_50" },
+ { SYS_compat_50___sigtimedwait, "compat_50" },
{ SYS__ksem_init, "ksem" },
{ SYS__ksem_open, "ksem" },
{ SYS__ksem_unlink, "ksem" },
@@ -135,32 +136,38 @@ static struct sc_autoload netbsd_syscalls_autoload[] = {
{ SYS_mq_notify, "mqueue" },
{ SYS_mq_send, "mqueue" },
{ SYS_mq_receive, "mqueue" },
- { SYS_compat_50_mq_timedsend, "compat" },
- { SYS_compat_50_mq_timedreceive, "compat" },
- { SYS_compat_30_getdents, "compat" },
- { SYS_compat_50_lutimes, "compat" },
- { SYS_compat_30___stat13, "compat" },
- { SYS_compat_30___fstat13, "compat" },
- { SYS_compat_30___lstat13, "compat" },
- { SYS_compat_16___sigaction14, "compat" },
- { SYS_compat_16___sigreturn14, "compat" },
- { SYS_compat_30_fhopen, "compat" },
- { SYS_compat_30_fhstat, "compat" },
- { SYS_compat_20_fhstatfs, "compat" },
- { SYS_compat_50_____semctl13, "sysv_ipc" },
- { SYS_compat_50___msgctl13, "sysv_ipc" },
- { SYS_compat_50___shmctl13, "sysv_ipc" },
- { SYS_compat_50__lwp_park, "compat" },
- { SYS_compat_50_kevent, "compat" },
- { SYS_compat_30_fhstatvfs1, "compat" },
- { SYS_compat_50_pselect, "compat" },
- { SYS_compat_50_pollts, "compat" },
- { SYS_compat_50___stat30, "compat" },
- { SYS_compat_50___fstat30, "compat" },
- { SYS_compat_50___lstat30, "compat" },
- { SYS_compat_30___fhstat30, "compat" },
- { SYS_compat_50___ntp_gettime30, "compat" },
- { SYS_compat_50___fhstat40, "compat" },
+ { SYS_compat_50_mq_timedsend, "compat_50" },
+ { SYS_compat_50_mq_timedreceive, "compat_50" },
+ { SYS_compat_30_getdents, "compat_30" },
+ { SYS_compat_50_lutimes, "compat_50" },
+ { SYS_compat_30___stat13, "compat_30" },
+ { SYS_compat_30___fstat13, "compat_30" },
+ { SYS_compat_30___lstat13, "compat_30" },
+ { SYS_compat_16___sigaction14, "compat_16" },
+ { SYS_compat_16___sigreturn14, "compat_16" },
+ { SYS_compat_30_fhopen, "compat_30" },
+ { SYS_compat_30_fhstat, "compat_30" },
+ { SYS_compat_20_fhstatfs, "compat_20" },
+ { SYS_compat_50_____semctl13, "compat_sysv_50" },
+ { SYS_compat_50___msgctl13, "compat_sysv_50" },
+ { SYS_compat_50___shmctl13, "compat_sysv_50" },
+ { SYS_compat_50__lwp_park, "compat_50" },
+ { SYS_compat_60_sa_register, "compat_60" },
+ { SYS_compat_60_sa_stacks, "compat_60" },
+ { SYS_compat_60_sa_enable, "compat_60" },
+ { SYS_compat_60_sa_setconcurrency, "compat_60" },
+ { SYS_compat_60_sa_yield, "compat_60" },
+ { SYS_compat_60_sa_preempt, "compat_60" },
+ { SYS_compat_50_kevent, "compat_50" },
+ { SYS_compat_30_fhstatvfs1, "compat_30" },
+ { SYS_compat_50_pselect, "compat_50" },
+ { SYS_compat_50_pollts, "compat_50" },
+ { SYS_compat_50___stat30, "compat_50" },
+ { SYS_compat_50___fstat30, "compat_50" },
+ { SYS_compat_50___lstat30, "compat_50" },
+ { SYS_compat_30___fhstat30, "compat_30" },
+ { SYS_compat_50___ntp_gettime30, "compat_30" },
+ { SYS_compat_50___fhstat40, "compat_50" },
{ SYS_aio_cancel, "aio" },
{ SYS_aio_error, "aio" },
{ SYS_aio_fsync, "aio" },
@@ -172,7 +179,7 @@ static struct sc_autoload netbsd_syscalls_autoload[] = {
{ SYS___lfs_segwait50, "lfs" },
{ SYS___mq_timedsend50, "mqueue" },
{ SYS___mq_timedreceive50, "mqueue" },
- { SYS_compat_60__lwp_park, "compat" },
+ { SYS_compat_60__lwp_park, "compat_60" },
{ SYS___aio_suspend50, "aio" },
{ SYS_____semctl50, "sysv_ipc" },
{ SYS___shmctl50, "sysv_ipc" },
diff --git a/sys/kern/sysv_ipc.c b/sys/kern/sysv_ipc.c
index 5339970f66b..07bf2bd6c85 100644
--- a/sys/kern/sysv_ipc.c
+++ b/sys/kern/sysv_ipc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_ipc.c,v 1.34 2019/01/10 22:02:16 christos Exp $ */
+/* $NetBSD: sysv_ipc.c,v 1.35 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.34 2019/01/10 22:02:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.35 2019/01/27 02:08:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_sysv.h"
@@ -61,6 +61,9 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.34 2019/01/10 22:02:16 christos Exp $
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/kauth.h>
+#include <sys/compat_stub.h>
+
+#include <compat/common/compat_sysv_mod.h> /* for sysctl routine vector */
/*
* Values in support of System V compatible shared memory. XXX
@@ -124,10 +127,6 @@ struct msginfo msginfo = {
};
#endif
-#if defined(COMPAT_50)
-int sysctl_kern_sysvipc50(SYSCTLFN_PROTO);
-#endif
-
MODULE(MODULE_CLASS_EXEC, sysv_ipc, NULL);
SYSCTL_SETUP_PROTO(sysctl_ipc_setup);
@@ -140,15 +139,6 @@ static const struct syscall_package sysvipc_syscalls[] = {
{ SYS_shmat, 0, (sy_call_t *)sys_shmat },
{ SYS_shmdt, 0, (sy_call_t *)sys_shmdt },
{ SYS_shmget, 0, (sy_call_t *)sys_shmget },
-#if defined(COMPAT_10) && !defined(_LP64)
- { SYS_compat_10_oshmsys, 0, (sy_call_t *)compat_10_sys_shmsys },
-#endif
-#if defined(COMPAT_14)
- { SYS_compat_14_shmctl, 0, (sy_call_t *)compat_14_sys_shmctl },
-#endif
-#if defined(COMPAT_50)
- { SYS_compat_50___shmctl13, 0, (sy_call_t *)compat_50_sys___shmctl13 },
-#endif
#endif /* SYSVSHM */
#if defined(SYSVSEM)
@@ -156,15 +146,6 @@ static const struct syscall_package sysvipc_syscalls[] = {
{ SYS_semget, 0, (sy_call_t *)sys_semget },
{ SYS_semop, 0, (sy_call_t *)sys_semop },
{ SYS_semconfig, 0, (sy_call_t *)sys_semconfig },
-#if defined(COMPAT_10) && !defined(_LP64)
- { SYS_compat_10_osemsys, 0, (sy_call_t *)compat_10_sys_semsys },
-#endif
-#if defined(COMPAT_14)
- { SYS_compat_14___semctl, 0, (sy_call_t *)compat_14_sys___semctl },
-#endif
-#if defined(COMPAT_50)
- { SYS_compat_50_____semctl13, 0, (sy_call_t *)compat_50_sys_____semctl13 },
-#endif
#endif /* SYSVSEM */
#if defined(SYSVMSG)
@@ -172,15 +153,6 @@ static const struct syscall_package sysvipc_syscalls[] = {
{ SYS_msgget, 0, (sy_call_t *)sys_msgget },
{ SYS_msgsnd, 0, (sy_call_t *)sys_msgsnd },
{ SYS_msgrcv, 0, (sy_call_t *)sys_msgrcv },
-#if defined(COMPAT_10) && !defined(_LP64)
- { SYS_compat_10_omsgsys, 0, (sy_call_t *)compat_10_sys_msgsys },
-#endif
-#if defined(COMPAT_14)
- { SYS_compat_14_msgctl, 0, (sy_call_t *)compat_14_sys_msgctl },
-#endif
-#if defined(COMPAT_50)
- { SYS_compat_50___msgctl13, 0, (sy_call_t *)compat_50_sys___msgctl13 },
-#endif
#endif /* SYSVMSG */
{ 0, 0, NULL }
};
@@ -372,6 +344,12 @@ sysvipcinit(void)
}
static int
+stub_sysvipc50_sysctl(SYSCTLFN_ARGS)
+{
+ return EPASSTHROUGH;
+}
+
+static int
sysctl_kern_sysvipc(SYSCTLFN_ARGS)
{
void *where = oldp;
@@ -397,11 +375,10 @@ sysctl_kern_sysvipc(SYSCTLFN_ARGS)
* to the non-compat sysctl code.
*/
-#if defined(COMPAT_50)
- error = sysctl_kern_sysvipc50(SYSCTLFN_CALL(rnode));
+ MODULE_CALL_HOOK(sysvipc50_sysctl_hook, (SYSCTLFN_CALL(rnode)),
+ stub_sysvipc50_sysctl(SYSCTLFN_CALL(rnode)), error);
if (error != EPASSTHROUGH)
return error;
-#endif
if (namelen != 1)
return EINVAL;
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 00936a624bc..8df57521099 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.277 2018/09/03 16:29:35 riastradh Exp $ */
+/* $NetBSD: tty.c,v 1.278 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.277 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.278 2019/01/27 02:08:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -98,6 +98,7 @@ __KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.277 2018/09/03 16:29:35 riastradh Exp $");
#include <sys/ioctl_compat.h>
#include <sys/module.h>
#include <sys/bitops.h>
+#include <sys/compat_stub.h>
#ifdef COMPAT_60
#include <compat/sys/ttycom.h>
@@ -209,7 +210,8 @@ struct ttylist_head ttylist = TAILQ_HEAD_INITIALIZER(ttylist);
int tty_count;
kmutex_t tty_lock;
krwlock_t ttcompat_lock;
-int (*ttcompatvec)(struct tty *, u_long, void *, int, struct lwp *);
+
+struct ptm_pty *ptm = NULL;
uint64_t tk_cancc;
uint64_t tk_nin;
@@ -1408,24 +1410,24 @@ ttioctl(struct tty *tp, u_long cmd, void *data, int flag, struct lwp *l)
default:
break;
}
-#ifdef COMPAT_60
- error = compat_60_ttioctl(tp, cmd, data, flag, l);
- if (error != EPASSTHROUGH)
- return error;
-#endif /* COMPAT_60 */
- /* We may have to load the compat module for this. */
+ /* We may have to load the compat_60 module for this. */
for (;;) {
rw_enter(&ttcompat_lock, RW_READER);
- if (ttcompatvec != NULL) {
+ MODULE_CALL_HOOK(compat_60_ttioctl_hook,
+ (tp->t_dev, cmd, data, flag, l), enosys(), error);
+ if (error != ENOSYS) {
break;
}
rw_exit(&ttcompat_lock);
- (void)module_autoload("compat", MODULE_CLASS_ANY);
- if (ttcompatvec == NULL) {
+ (void)module_autoload("compat_60", MODULE_CLASS_EXEC);
+ rw_enter(&ttcompat_lock, RW_READER);
+ MODULE_CALL_HOOK(compat_60_ttioctl_hook,
+ (tp->t_dev, cmd, data, flag, l), enosys(), error);
+ if (error == ENOSYS) {
+ rw_exit(&ttcompat_lock);
return EPASSTHROUGH;
}
}
- error = (*ttcompatvec)(tp, cmd, data, flag, l);
rw_exit(&ttcompat_lock);
return error;
}
diff --git a/sys/kern/tty_ptm.c b/sys/kern/tty_ptm.c
index 41036316ba1..7ac582e1c00 100644
--- a/sys/kern/tty_ptm.c
+++ b/sys/kern/tty_ptm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_ptm.c,v 1.37 2015/08/24 22:50:32 pooka Exp $ */
+/* $NetBSD: tty_ptm.c,v 1.38 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.37 2015/08/24 22:50:32 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.38 2019/01/27 02:08:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -53,12 +53,11 @@ __KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.37 2015/08/24 22:50:32 pooka Exp $");
#include <sys/poll.h>
#include <sys/pty.h>
#include <sys/kauth.h>
+#include <sys/compat_stub.h>
#include <miscfs/specfs/specdev.h>
-#ifdef COMPAT_60
#include <compat/sys/ttycom.h>
-#endif /* COMPAT_60 */
#include "ioconf.h"
@@ -85,7 +84,6 @@ const struct cdevsw ptm_cdevsw = {
};
#else
-static struct ptm_pty *ptm;
int pts_major, ptc_major;
static dev_t pty_getfree(void);
@@ -405,11 +403,10 @@ ptmioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
goto bad2;
return 0;
default:
-#ifdef COMPAT_60
- error = compat_60_ptmioctl(dev, cmd, data, flag, l);
+ MODULE_CALL_HOOK(compat_60_ptmioctl_hook,
+ (dev, cmd, data, flag, l), EPASSTHROUGH, error);
if (error != EPASSTHROUGH)
return error;
-#endif /* COMPAT_60 */
DPRINTF(("ptmioctl EINVAL\n"));
return EINVAL;
}
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 95d0b5a5f6e..721c79ec5e6 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_usrreq.c,v 1.187 2018/11/08 04:30:37 roy Exp $ */
+/* $NetBSD: uipc_usrreq.c,v 1.188 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.187 2018/11/08 04:30:37 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.188 2019/01/27 02:08:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -123,10 +123,9 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.187 2018/11/08 04:30:37 roy Exp $"
#include <sys/uidinfo.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
+#include <sys/compat_stub.h>
-#ifdef COMPAT_70
#include <compat/sys/socket.h>
-#endif
/*
* Unix communications domain.
@@ -197,6 +196,20 @@ static lwp_t *unp_thread_lwp;
static SLIST_HEAD(,file) unp_thread_discard;
static int unp_defer;
+/* Compat interface */
+
+struct mbuf * stub_compat_70_unp_addsockcred(lwp_t *, struct mbuf *);
+
+struct mbuf * stub_compat_70_unp_addsockcred(struct lwp *lwp,
+ struct mbuf *control)
+{
+
+/* just copy our initial argument */
+ return control;
+}
+
+bool *compat70_ocreds_valid = false;
+
/*
* Initialize Unix protocols.
*/
@@ -336,10 +349,9 @@ unp_output(struct mbuf *m, struct mbuf *control, struct unpcb *unp)
sun = &sun_noname;
if (unp->unp_conn->unp_flags & UNP_WANTCRED)
control = unp_addsockcred(curlwp, control);
-#ifdef COMPAT_SOCKCRED70
if (unp->unp_conn->unp_flags & UNP_OWANTCRED)
- control = compat_70_unp_addsockcred(curlwp, control);
-#endif
+ MODULE_CALL_HOOK(compat_70_unp_hook, (curlwp, control),
+ stub_compat_70_unp_addsockcred(curlwp, control), control);
if (sbappendaddr(&so2->so_rcv, (const struct sockaddr *)sun, m,
control) == 0) {
unp_dispose(control);
@@ -514,16 +526,16 @@ unp_send(struct socket *so, struct mbuf *m, struct sockaddr *nam,
unp->unp_conn->unp_flags &= ~UNP_WANTCRED;
control = unp_addsockcred(l, control);
}
-#ifdef COMPAT_SOCKCRED70
if (unp->unp_conn->unp_flags & UNP_OWANTCRED) {
/*
* Credentials are passed only once on
* SOCK_STREAM and SOCK_SEQPACKET.
*/
unp->unp_conn->unp_flags &= ~UNP_OWANTCRED;
- control = compat_70_unp_addsockcred(l, control);
+ MODULE_CALL_HOOK(compat_70_unp_hook, (curlwp, control),
+ stub_compat_70_unp_addsockcred(curlwp, control),
+ control);
}
-#endif
/*
* Send to paired receive port, and then reduce
* send buffer hiwater marks to maintain backpressure.
@@ -597,11 +609,14 @@ uipc_ctloutput(int op, struct socket *so, struct sockopt *sopt)
case PRCO_SETOPT:
switch (sopt->sopt_name) {
+ case LOCAL_OCREDS:
+ if (!*compat70_ocreds_valid) {
+ error = ENOPROTOOPT;
+ break;
+ }
+ /* FALLTHROUGH */
case LOCAL_CREDS:
case LOCAL_CONNWAIT:
-#ifdef COMPAT_SOCKCRED70
- case LOCAL_OCREDS:
-#endif
error = sockopt_getint(sopt, &optval);
if (error)
break;
@@ -618,11 +633,9 @@ uipc_ctloutput(int op, struct socket *so, struct sockopt *sopt)
case LOCAL_CONNWAIT:
OPTSET(UNP_CONNWAIT);
break;
-#ifdef COMPAT_SOCKCRED70
case LOCAL_OCREDS:
OPTSET(UNP_OWANTCRED);
break;
-#endif
}
break;
#undef OPTSET
@@ -650,12 +663,13 @@ uipc_ctloutput(int op, struct socket *so, struct sockopt *sopt)
optval = OPTBIT(UNP_WANTCRED);
error = sockopt_setint(sopt, optval);
break;
-#ifdef COMPAT_SOCKCRED70
case LOCAL_OCREDS:
- optval = OPTBIT(UNP_OWANTCRED);
- error = sockopt_setint(sopt, optval);
- break;
-#endif
+ if (*compat70_ocreds_valid) {
+ optval = OPTBIT(UNP_OWANTCRED);
+ error = sockopt_setint(sopt, optval);
+ break;
+ }
+ /* FALLTHROUGH */
#undef OPTBIT
default:
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 0e428f19f4b..b4233c264aa 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.518 2018/01/09 03:31:13 christos Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.519 2019/01/27 02:08:43 pgoyette Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.518 2018/01/09 03:31:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.519 2019/01/27 02:08:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_fileassoc.h"
@@ -108,6 +108,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.518 2018/01/09 03:31:13 christos
#include <sys/module.h>
#include <sys/buf.h>
#include <sys/event.h>
+#include <sys/compat_stub.h>
#include <miscfs/genfs/genfs.h>
#include <miscfs/specfs/specdev.h>
@@ -141,7 +142,6 @@ static int fd_nameiat(struct lwp *, int, struct nameidata *);
static int fd_nameiat_simple_user(struct lwp *, int, const char *,
namei_simple_flags_t, struct vnode **);
-
/*
* This table is used to maintain compatibility with 4.3BSD
* and NetBSD 0.9 mount syscalls - and possibly other systems.
@@ -1624,10 +1624,6 @@ fd_open(const char *path, int open_flags, int open_mode, int *fd)
return error;
}
-/*
- * Check permissions, allocate an open file structure,
- * and call the device open routine if any.
- */
static int
do_sys_openat(lwp_t *l, int fdat, const char *path, int flags,
int mode, int *fd)
@@ -1637,14 +1633,12 @@ do_sys_openat(lwp_t *l, int fdat, const char *path, int flags,
struct pathbuf *pb;
int error;
-#ifdef COMPAT_10 /* XXX: and perhaps later */
if (path == NULL) {
- pb = pathbuf_create(".");
- if (pb == NULL)
- return ENOMEM;
- } else
-#endif
- {
+ MODULE_CALL_HOOK(compat_10_openat_hook, (&pb),
+ 0, error);
+ if (error)
+ return error;
+ } else {
error = pathbuf_copyin(path, &pb);
if (error)
return error;
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index f896b2e689d..1a04be8b801 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -1,10 +1,25 @@
-# $NetBSD: Makefile,v 1.215 2019/01/21 00:21:48 alnsn Exp $
+# $NetBSD: Makefile,v 1.216 2019/01/27 02:08:43 pgoyette Exp $
.include <bsd.own.mk>
# For all platforms
-SUBDIR= accf_dataready
+# Modules for compatability with earlier versions of NetBSD
+
+SUBDIR+= compat_util
+SUBDIR+= compat_43 compat_sysctl_09_43
+SUBDIR+= compat_09 compat_10 compat_12 compat_13 compat_14
+SUBDIR+= compat_16 compat_20 compat_30 compat_40 compat_50
+SUBDIR+= compat_60 compat_70 compat_80
+
+SUBDIR+= compat_sysv_10 compat_sysv_14 compat_sysv_50
+
+SUBDIR+= compat_raid_50
+SUBDIR+= compat_raid_80
+
+SUBDIR+= compat_crypto_50
+
+SUBDIR+= accf_dataready
SUBDIR+= accf_httpready
SUBDIR+= adosfs
SUBDIR+= aio
@@ -24,11 +39,10 @@ SUBDIR+= cd9660
SUBDIR+= cgd
SUBDIR+= chfs
SUBDIR+= clockctl
+SUBDIR+= compat_ossaudio
SUBDIR+= crypto
SUBDIR+= coda
SUBDIR+= coda5
-SUBDIR+= compat
-SUBDIR+= compat_ossaudio
SUBDIR+= coredump
SUBDIR+= dbcool
SUBDIR+= des
@@ -258,23 +272,28 @@ SUBDIR+= wmihp
SUBDIR+= wmimsi
.endif
-.if ${MACHINE_CPU} == "arm" \
+.if ${MACHINE_ARCH} == "x86_64" \
+ || ${MACHINE_CPU} == "arm" \
|| ${MACHINE_ARCH} == "sparc64" \
|| (!empty(MACHINE_ARCH:Mmips64*) && !defined(BSD_MK_COMPAT_FILE))
SUBDIR+= compat_netbsd32
+SUBDIR+= compat_netbsd32_09 compat_netbsd32_12
+SUBDIR+= compat_netbsd32_13 compat_netbsd32_16
+SUBDIR+= compat_netbsd32_20 compat_netbsd32_30
+SUBDIR+= compat_netbsd32_40 compat_netbsd32_50
+SUBDIR+= compat_netbsd32_60 compat_netbsd32_80
+SUBDIR+= compat_netbsd32_43
SUBDIR+= compat_netbsd32_mqueue
SUBDIR+= compat_netbsd32_nfssrv
SUBDIR+= compat_netbsd32_ptrace
SUBDIR+= compat_netbsd32_sysvipc
+SUBDIR+= compat_netbsd32_sysvipc_10
+SUBDIR+= compat_netbsd32_sysvipc_14
+SUBDIR+= compat_netbsd32_sysvipc_50
.endif
.if ${MACHINE_ARCH} == "x86_64"
SUBDIR+= compat_linux32
-SUBDIR+= compat_netbsd32
-SUBDIR+= compat_netbsd32_mqueue
-SUBDIR+= compat_netbsd32_nfssrv
-SUBDIR+= compat_netbsd32_ptrace
-SUBDIR+= compat_netbsd32_sysvipc
.endif
.if ${MACHINE_ARCH} == "i386"
diff --git a/sys/modules/arch/x86/amd64-xen/bsd.amd64-xen.mk b/sys/modules/arch/x86/amd64-xen/bsd.amd64-xen.mk
index 5a44f5a0367..c0ec313f30f 100644
--- a/sys/modules/arch/x86/amd64-xen/bsd.amd64-xen.mk
+++ b/sys/modules/arch/x86/amd64-xen/bsd.amd64-xen.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.amd64-xen.mk,v 1.1 2014/08/11 03:43:25 jnemeth Exp $
+# $NetBSD: bsd.amd64-xen.mk,v 1.2 2019/01/27 02:08:43 pgoyette Exp $
.ifndef _BSD_AMD64_XEN_MK_
_BSD_AMD64_XEN_MK_=1
@@ -7,4 +7,6 @@ KMODULEARCHDIR:= amd64-xen
XEN= 1
+#CPPFLAGS+= -DXEN
+
.endif # _BSD_AMD64_XEN_MK_
diff --git a/sys/modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk b/sys/modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk
index e4cff0f5664..0387604f77a 100644
--- a/sys/modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk
+++ b/sys/modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.i386pae-xen.mk,v 1.1 2014/08/11 03:43:26 jnemeth Exp $
+# $NetBSD: bsd.i386pae-xen.mk,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
.ifndef _BSD_I386PAE_XEN_MK_
_BSD_I386PAE_XEN_MK_=1
@@ -8,4 +8,6 @@ KMODULEARCHDIR:= i386pae-xen
XEN= 1
PAE= 1
+#CPPFLAGS+= -DPAE -DXEN
+
.endif # _BSD_I386PAE_XEN_MK_
diff --git a/sys/modules/clockctl/Makefile b/sys/modules/clockctl/Makefile
index 1f49df65c7e..3d3060fe838 100644
--- a/sys/modules/clockctl/Makefile
+++ b/sys/modules/clockctl/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2015/12/07 03:25:57 pgoyette Exp $
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
.include "../Makefile.inc"
@@ -8,6 +8,4 @@ KMOD= clockctl
IOCONF= clockctl.ioconf
SRCS= clockctl.c
-CPPFLAGS+= -DNTP -DCOMPAT_50
-
.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat/Makefile b/sys/modules/compat/Makefile
index ac39d127290..d5399aaca98 100644
--- a/sys/modules/compat/Makefile
+++ b/sys/modules/compat/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2018/03/18 00:51:46 christos Exp $
+# $NetBSD: Makefile,v 1.16 2019/01/27 02:08:44 pgoyette Exp $
.include "../Makefile.inc"
@@ -32,16 +32,24 @@ MACHINE_EXTRA= x86
MACHINE_EXTRA= none
.endif
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+= -DCPU_UCODE
+# pick up more for bsd.klinks.mk as needed.
+MACHINE_EXTRA= x86
+.else
+MACHINE_EXTRA= none
+.endif
+
.include "../../compat/common/Makefile.sysio"
-SRCS+= compat_mod.c
+SRCS+= compat_mod.c compat_exec.c compat_util.c
.PATH: ${S}/arch/${MACHINE}/${MACHINE}
.PATH: ${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
.PATH: ${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}
.PATH: ${S} ${S}/arch/${MACHINE_EXTRA}/${MACHINE_EXTRA}
-.for i in compat_13_machdep.c compat_16_machdep.c compat_60_cpu_ucode.c
+.for i in compat_13_machdep.c compat_16_machdep.c # compat_60_cpu_ucode.c
. if exists(${S}/arch/${MACHINE}/${MACHINE}/${i}) || \
exists(${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/${i}) || \
exists(${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}/${i}) || \
diff --git a/sys/modules/compat_09/Makefile b/sys/modules/compat_09/Makefile
new file mode 100644
index 00000000000..551c6a2250c
--- /dev/null
+++ b/sys/modules/compat_09/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_09
+
+CPPFLAGS+= -DCOMPAT_09 -DCOMPAT_10 -DCOMPAT_12
+CPPFLAGS+= -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_09_mod.c
+SRCS+= kern_info_09.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_10/Makefile b/sys/modules/compat_10/Makefile
new file mode 100644
index 00000000000..efd72b8d3e7
--- /dev/null
+++ b/sys/modules/compat_10/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_10
+
+CPPFLAGS+= -DCOMPAT_10 -DCOMPAT_12
+CPPFLAGS+= -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_10_mod.c
+SRCS+= vfs_syscalls_10.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_12/Makefile b/sys/modules/compat_12/Makefile
new file mode 100644
index 00000000000..f60bf9d4124
--- /dev/null
+++ b/sys/modules/compat_12/Makefile
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_12
+
+CPPFLAGS+= -DCOMPAT_12
+CPPFLAGS+= -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_12_mod.c
+SRCS+= vm_12.c kern_xxx_12.c vfs_syscalls_12.c
+
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_13/Makefile b/sys/modules/compat_13/Makefile
new file mode 100644
index 00000000000..1cb1c2efc5f
--- /dev/null
+++ b/sys/modules/compat_13/Makefile
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_13
+
+CPPFLAGS+= -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_13_mod.c
+SRCS+= uvm_13.c kern_sig_13.c
+
+.if ${MACHINE_ARCH} == "x86_64"
+.PATH: ${S}/arch/amd64/amd64
+
+SRCS+= compat_13_machdep.c
+.endif
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_14/Makefile b/sys/modules/compat_14/Makefile
new file mode 100644
index 00000000000..5534f4c2164
--- /dev/null
+++ b/sys/modules/compat_14/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_14
+
+CPPFLAGS+= -DCOMPAT_14 -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_14_mod.c
+SRCS+= rtsock_14.c
+
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_16/Makefile b/sys/modules/compat_16/Makefile
new file mode 100644
index 00000000000..17c04953fee
--- /dev/null
+++ b/sys/modules/compat_16/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_16
+
+CPPFLAGS+= -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_16_mod.c
+SRCS+= kern_sig_16.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_20/Makefile b/sys/modules/compat_20/Makefile
new file mode 100644
index 00000000000..800c401e64b
--- /dev/null
+++ b/sys/modules/compat_20/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_20
+
+CPPFLAGS+= -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_20_mod.c
+SRCS+= vfs_syscalls_20.c ieee80211_20.c if43_20.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_30/Makefile b/sys/modules/compat_30/Makefile
new file mode 100644
index 00000000000..77d6769fb24
--- /dev/null
+++ b/sys/modules/compat_30/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:44 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_30
+
+CPPFLAGS+= -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_30_mod.c
+SRCS+= vfs_syscalls_30.c uipc_syscalls_30.c kern_time_30.c bio_30.c vnd_30.c
+SRCS+= usb_subr_30.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_40/Makefile b/sys/modules/compat_40/Makefile
new file mode 100644
index 00000000000..d0796c8411f
--- /dev/null
+++ b/sys/modules/compat_40/Makefile
@@ -0,0 +1,18 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_40
+
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_40_mod.c
+SRCS+= vfs_syscalls_40.c uipc_syscalls_40.c
+
+.PATH: ${S}/dev/sysmon
+
+SRCS+= sysmon_power_40.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_43/Makefile b/sys/modules/compat_43/Makefile
new file mode 100644
index 00000000000..9b472b18fdf
--- /dev/null
+++ b/sys/modules/compat_43/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_43
+
+CPPFLAGS+= -DCOMPAT_43
+
+SRCS= compat_43_mod.c
+SRCS+= kern_exit_43.c kern_info_43.c kern_resource_43.c kern_sig_43.c \
+ tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c if_43.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_50/Makefile b/sys/modules/compat_50/Makefile
new file mode 100644
index 00000000000..e756dbe67cd
--- /dev/null
+++ b/sys/modules/compat_50/Makefile
@@ -0,0 +1,34 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_50
+
+CPPFLAGS+= -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_50_mod.c
+SRCS+= kern_50.c kern_time_50.c kern_select_50.c
+SRCS+= vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c
+SRCS+= rndpseudo_50.c clockctl_50.c if_spppsubr50.c
+
+CPPFLAGS+= -DINET -DINET6
+# XXX someday we'll need to add
+#CPPFLAGS+= -DSCTP -DNET_MPSAFE
+
+SRCS+= rtsock_50.c
+
+.PATH: ${S}/fs/puffs
+
+SRCS+= puffs_compat.c
+
+.PATH: ${S}/dev/wscons
+
+SRCS+= wsevent_50.c
+
+.PATH: ${S}/dev
+
+SRCS+= vnd_50.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_60/Makefile b/sys/modules/compat_60/Makefile
new file mode 100644
index 00000000000..7b119c4b59a
--- /dev/null
+++ b/sys/modules/compat_60/Makefile
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_60
+
+CPPFLAGS+= -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_60_mod.c kern_sa_60.c tty_60.c kern_time_60.c ccd_60.c \
+ kern_cpu_60.c
+
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+= -DCPU_UCODE
+
+.PATH: ${S}/arch/x86/x86
+SRCS+= compat_60_cpu_ucode.c
+.endif
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_70/Makefile b/sys/modules/compat_70/Makefile
new file mode 100644
index 00000000000..93541f5cd36
--- /dev/null
+++ b/sys/modules/compat_70/Makefile
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_70
+
+CPPFLAGS+= -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+= compat_70_mod.c rtsock_70.c uipc_usrreq_70.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_80/Makefile b/sys/modules/compat_80/Makefile
new file mode 100644
index 00000000000..eb9d81a2a3b
--- /dev/null
+++ b/sys/modules/compat_80/Makefile
@@ -0,0 +1,14 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_80
+
+CPPFLAGS+= -DCOMPAT_80
+
+SRCS+= compat_80_mod.c
+SRCS+= kern_mod_80.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_crypto_50/Makefile b/sys/modules/compat_crypto_50/Makefile
new file mode 100644
index 00000000000..5872dd20d6a
--- /dev/null
+++ b/sys/modules/compat_crypto_50/Makefile
@@ -0,0 +1,12 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+CPPFLAGS+= -DCOMPAT_50
+
+.PATH: ${S}/opencrypto
+
+KMOD= compat_crypto_50
+SRCS= ocryptodev.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32/Makefile b/sys/modules/compat_netbsd32/Makefile
index 51362f2ed21..fa8466535d6 100644
--- a/sys/modules/compat_netbsd32/Makefile
+++ b/sys/modules/compat_netbsd32/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 2018/11/26 08:48:43 mlelstv Exp $
+# $NetBSD: Makefile,v 1.22 2019/01/27 02:08:45 pgoyette Exp $
.include "../Makefile.inc"
.include "../Makefile.assym"
@@ -21,26 +21,23 @@ CPPFLAGS+= -DCOMPAT_43
CPPFLAGS+= -DCOMPAT_NETBSD32
CPPFLAGS+= -DEXEC_ELF32 -DEXEC_ELF64
CPPFLAGS+= -DCOREDUMP -DNTP -DVMSWAP
-CPPFLAGS+= -DNTP -DKTRACE -DMODULAR
+CPPFLAGS+= -DKTRACE -DMODULAR
CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
.PATH: ${S}/compat/netbsd32
-SRCS+= netbsd32_compat_09.c netbsd32_compat_10.c
-SRCS+= netbsd32_compat_12.c netbsd32_compat_13.c
-SRCS+= netbsd32_compat_14.c netbsd32_compat_20.c
-SRCS+= netbsd32_compat_30.c netbsd32_compat_43.c
-SRCS+= netbsd32_compat_50.c netbsd32_compat_60.c
-SRCS+= netbsd32_core.c netbsd32_event.c
-SRCS+= netbsd32_exec_elf32.c
-SRCS+= netbsd32_execve.c netbsd32_fs.c
-SRCS+= netbsd32_ioctl.c
-SRCS+= netbsd32_lwp.c netbsd32_netbsd.c
-SRCS+= netbsd32_select.c
-SRCS+= netbsd32_sem.c netbsd32_signal.c
-SRCS+= netbsd32_socket.c netbsd32_syscalls.c
-SRCS+= netbsd32_sysctl.c netbsd32_sysent.c
-SRCS+= netbsd32_time.c netbsd32_wait.c
-SRCS+= netbsd32_mod.c netbsd32_module.c
+SRCS+= netbsd32_core.c netbsd32_event.c
+SRCS+= netbsd32_exec_elf32.c netbsd32_execve.c
+SRCS+= netbsd32_fd.c netbsd32_fs.c
+SRCS+= netbsd32_ioctl.c netbsd32_kern_proc.c
+SRCS+= netbsd32_lwp.c netbsd32_mod.c
+SRCS+= netbsd32_netbsd.c netbsd32_quota.c
+SRCS+= netbsd32_rlimit.c netbsd32_select.c
+SRCS+= netbsd32_sem.c netbsd32_signal.c
+SRCS+= netbsd32_socket.c netbsd32_syscalls.c
+SRCS+= netbsd32_sysctl.c netbsd32_sysent.c
+SRCS+= netbsd32_time.c netbsd32_wait.c
+SRCS+= netbsd32_vm.c
+SRCS+= netbsd32_module.c
.if ${MACHINE_CPU} != "mips" && ${MACHINE_CPU} != "powerpc"
CPPFLAGS+= -DEXEC_AOUT -DCOMPAT_NOMID
@@ -49,12 +46,20 @@ SRCS+= netbsd32_exec_aout.c
.if ${MACHINE_ARCH} == "x86_64"
.PATH: ${S}/arch/amd64/amd64
-SRCS+= netbsd32_machdep.c netbsd32_sigcode.S netbsd32_syscall.c
+CPPFLAGS+= -DMTRR
+SRCS+= netbsd32_syscall.c
+SRCS+= netbsd32_machdep.c
.endif
.if ${MACHINE_ARCH} == "sparc64"
.PATH: ${S}/arch/sparc64/sparc64
-SRCS+= netbsd32_machdep.c netbsd32_sigcode.S
+SRCS+= netbsd32_sigcode.S
+SRCS+= netbsd32_machdep.c
+.endif
+
+.if ${MACHINE_ARCH} == "arm"
+.PATH: ${S}/arch/arm/arm32
+SRCS+= netbsd32_machdep.c
.endif
.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_09/Makefile b/sys/modules/compat_netbsd32_09/Makefile
new file mode 100644
index 00000000000..83cb439d389
--- /dev/null
+++ b/sys/modules/compat_netbsd32_09/Makefile
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_09
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_09 -DCOMPAT_10 -DCOMPAT_12
+CPPFLAGS+= -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_09.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_12/Makefile b/sys/modules/compat_netbsd32_12/Makefile
new file mode 100644
index 00000000000..ad1513b19c5
--- /dev/null
+++ b/sys/modules/compat_netbsd32_12/Makefile
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_12
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_12
+CPPFLAGS+= -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_12.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_13/Makefile b/sys/modules/compat_netbsd32_13/Makefile
new file mode 100644
index 00000000000..2fd4071811d
--- /dev/null
+++ b/sys/modules/compat_netbsd32_13/Makefile
@@ -0,0 +1,26 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_13
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_13.c
+
+.if ${MACHINE_ARCH} == "x86_64"
+.PATH: ${S}/arch/amd64/amd64
+SRCS+= netbsd32_machdep_13.c
+.endif
+
+.if ${MACHINE_ARCH} == "arm"
+.PATH: ${S}/arch/arm/arm32
+SRCS+= netbsd32_machdep_13.c
+.endif
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_16/Makefile b/sys/modules/compat_netbsd32_16/Makefile
new file mode 100644
index 00000000000..c822b528dbf
--- /dev/null
+++ b/sys/modules/compat_netbsd32_16/Makefile
@@ -0,0 +1,28 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+.include "../Makefile.assym"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_16
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_16.c
+
+.if ${MACHINE_ARCH} == "x86_64"
+.PATH: ${S}/arch/amd64/amd64
+SRCS+= netbsd32_sigcode.S
+SRCS+= netbsd32_machdep_16.c
+.endif
+
+.if ${MACHINE_ARCH} == "arm"
+.PATH: ${S}/arch/arm/arm32
+SRCS+= netbsd32_machdep_16.c
+.endif
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_20/Makefile b/sys/modules/compat_netbsd32_20/Makefile
new file mode 100644
index 00000000000..3c2452babc8
--- /dev/null
+++ b/sys/modules/compat_netbsd32_20/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_20
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_20.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_30/Makefile b/sys/modules/compat_netbsd32_30/Makefile
new file mode 100644
index 00000000000..2e7dcce9723
--- /dev/null
+++ b/sys/modules/compat_netbsd32_30/Makefile
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_30
+
+CPPFLAGS+= -DNTP
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_30
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_30.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_40/Makefile b/sys/modules/compat_netbsd32_40/Makefile
new file mode 100644
index 00000000000..21bd91c6db9
--- /dev/null
+++ b/sys/modules/compat_netbsd32_40/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_40
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_40.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_43/Makefile b/sys/modules/compat_netbsd32_43/Makefile
new file mode 100644
index 00000000000..4178f498882
--- /dev/null
+++ b/sys/modules/compat_netbsd32_43/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_43
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_43
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_43.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_50/Makefile b/sys/modules/compat_netbsd32_50/Makefile
new file mode 100644
index 00000000000..f3228fc2001
--- /dev/null
+++ b/sys/modules/compat_netbsd32_50/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_50
+
+CPPFLAGS+= -DNTP
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_50.c netbsd32_rndpseudo_50.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_60/Makefile b/sys/modules/compat_netbsd32_60/Makefile
new file mode 100644
index 00000000000..9686b93dc04
--- /dev/null
+++ b/sys/modules/compat_netbsd32_60/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_60
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_60.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_80/Makefile b/sys/modules/compat_netbsd32_80/Makefile
new file mode 100644
index 00000000000..7c16fa0ad73
--- /dev/null
+++ b/sys/modules/compat_netbsd32_80/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/netbsd32
+
+KMOD= compat_netbsd32_80
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_80
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+SRCS+= netbsd32_compat_80.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_sysvipc/Makefile b/sys/modules/compat_netbsd32_sysvipc/Makefile
index b214d974d68..826f7e74b9e 100644
--- a/sys/modules/compat_netbsd32_sysvipc/Makefile
+++ b/sys/modules/compat_netbsd32_sysvipc/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2018/11/26 08:48:43 mlelstv Exp $
+# $NetBSD: Makefile,v 1.3 2019/01/27 02:08:46 pgoyette Exp $
.include "../Makefile.inc"
.include "../Makefile.assym"
@@ -13,8 +13,5 @@ CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
.PATH: ${S}/compat/netbsd32
SRCS+= netbsd32_ipc.c
-SRCS+= netbsd32_compat_10.c
-SRCS+= netbsd32_compat_14.c
-SRCS+= netbsd32_compat_50_sysv.c
.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_sysvipc_10/Makefile b/sys/modules/compat_netbsd32_sysvipc_10/Makefile
new file mode 100644
index 00000000000..31d5a1f0eca
--- /dev/null
+++ b/sys/modules/compat_netbsd32_sysvipc_10/Makefile
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:46 pgoyette Exp $
+
+.include "../Makefile.inc"
+.include "../Makefile.assym"
+
+KMOD= compat_netbsd32_sysvipc_10
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_10 -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_50
+CPPFLAGS+= -DSYSVSHM -DSYSVSEM -DSYSVMSG
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+.PATH: ${S}/compat/netbsd32
+
+SRCS+= netbsd32_compat_10_sysv.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_sysvipc_14/Makefile b/sys/modules/compat_netbsd32_sysvipc_14/Makefile
new file mode 100644
index 00000000000..80701394eb2
--- /dev/null
+++ b/sys/modules/compat_netbsd32_sysvipc_14/Makefile
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+.include "../Makefile.assym"
+
+KMOD= compat_netbsd32_sysvipc_14
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_14 -DCOMPAT_50
+CPPFLAGS+= -DSYSVSHM -DSYSVSEM -DSYSVMSG
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+.PATH: ${S}/compat/netbsd32
+
+SRCS+= netbsd32_compat_14_sysv.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_netbsd32_sysvipc_50/Makefile b/sys/modules/compat_netbsd32_sysvipc_50/Makefile
new file mode 100644
index 00000000000..32e7e4e47df
--- /dev/null
+++ b/sys/modules/compat_netbsd32_sysvipc_50/Makefile
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+.include "../Makefile.assym"
+
+KMOD= compat_netbsd32_sysvipc_50
+
+CPPFLAGS+= -DCOMPAT_NETBSD32
+CPPFLAGS+= -DCOMPAT_50
+CPPFLAGS+= -DSYSVSHM -DSYSVSEM -DSYSVMSG
+CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
+
+.PATH: ${S}/compat/netbsd32
+
+SRCS+= netbsd32_compat_50_sysv.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_raid_50/Makefile b/sys/modules/compat_raid_50/Makefile
new file mode 100644
index 00000000000..1d8020b60f2
--- /dev/null
+++ b/sys/modules/compat_raid_50/Makefile
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+KMOD= compat_raid_50
+
+.PATH: ${S}/dev/raidframe
+
+SRCS+= rf_compat50.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_raid_80/Makefile b/sys/modules/compat_raid_80/Makefile
new file mode 100644
index 00000000000..6f78a7a8638
--- /dev/null
+++ b/sys/modules/compat_raid_80/Makefile
@@ -0,0 +1,12 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+KMOD= compat_raid_80
+CPPFLAGS+= -DCOMPAT_80
+
+.PATH: ${S}/dev/raidframe
+
+SRCS+= rf_compat80.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_sysctl_09_43/Makefile b/sys/modules/compat_sysctl_09_43/Makefile
new file mode 100644
index 00000000000..3446d9f96a2
--- /dev/null
+++ b/sys/modules/compat_sysctl_09_43/Makefile
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_sysctl_09_43
+
+CPPFLAGS+= -DCOMPAT_09 -DCOMPAT_43
+
+SRCS+= compat_sysctl_09_43.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_sysv_10/Makefile b/sys/modules/compat_sysv_10/Makefile
new file mode 100644
index 00000000000..999940649ae
--- /dev/null
+++ b/sys/modules/compat_sysv_10/Makefile
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/kern
+
+KMOD= compat_sysv_10
+
+CPPFLAGS+= -DSYSVSEM -DSYSVSHM -DSYSVMSG
+
+.PATH: ${S}/compat/common
+
+CPPFLAGS+= -DCOMPAT_10
+CPPFLAGS+= -DCOMPAT_13
+CPPFLAGS+= -DCOMPAT_14
+CPPFLAGS+= -DCOMPAT_50
+
+SRCS+= compat_sysv_10_mod.c
+SRCS+= kern_ipc_10.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_sysv_14/Makefile b/sys/modules/compat_sysv_14/Makefile
new file mode 100644
index 00000000000..47b913c8e51
--- /dev/null
+++ b/sys/modules/compat_sysv_14/Makefile
@@ -0,0 +1,19 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/kern
+
+KMOD= compat_sysv_14
+
+CPPFLAGS+= -DSYSVSEM -DSYSVSHM -DSYSVMSG
+
+.PATH: ${S}/compat/common
+
+CPPFLAGS+= -DCOMPAT_14
+CPPFLAGS+= -DCOMPAT_50
+
+SRCS+= compat_sysv_14_mod.c
+SRCS+= sysv_msg_14.c sysv_sem_14.c sysv_shm_14.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_sysv_50/Makefile b/sys/modules/compat_sysv_50/Makefile
new file mode 100644
index 00000000000..f8897708c15
--- /dev/null
+++ b/sys/modules/compat_sysv_50/Makefile
@@ -0,0 +1,18 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/kern
+
+KMOD= compat_sysv_50
+
+CPPFLAGS+= -DSYSVSEM -DSYSVSHM -DSYSVMSG
+
+.PATH: ${S}/compat/common
+
+CPPFLAGS+= -DCOMPAT_50
+
+SRCS+= compat_sysv_50_mod.c
+SRCS+= sysv_ipc_50.c sysv_msg_50.c sysv_sem_50.c sysv_shm_50.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/compat_util/Makefile b/sys/modules/compat_util/Makefile
new file mode 100644
index 00000000000..dd8e81dce72
--- /dev/null
+++ b/sys/modules/compat_util/Makefile
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile,v 1.2 2019/01/27 02:08:47 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_util
+
+SRCS+= compat_util.c compat_exec.c
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/crypto/Makefile b/sys/modules/crypto/Makefile
index b4cc4b16d2d..56c75c90acf 100644
--- a/sys/modules/crypto/Makefile
+++ b/sys/modules/crypto/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2015/08/20 11:05:01 christos Exp $
+# $NetBSD: Makefile,v 1.5 2019/01/27 02:08:47 pgoyette Exp $
.include "../Makefile.inc"
@@ -8,6 +8,6 @@ CPPFLAGS+= -DCOMPAT_50
KMOD= crypto
IOCONF= crypto.ioconf
-SRCS= cryptodev.c ocryptodev.c
+SRCS= cryptodev.c
.include <bsd.kmodule.mk>
diff --git a/sys/modules/sysv_ipc/Makefile b/sys/modules/sysv_ipc/Makefile
index f80e253257c..a81d5bd9189 100644
--- a/sys/modules/sysv_ipc/Makefile
+++ b/sys/modules/sysv_ipc/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2016/11/03 04:26:58 riastradh Exp $
+# $NetBSD: Makefile,v 1.4 2019/01/27 02:08:47 pgoyette Exp $
.include "../Makefile.inc"
@@ -10,13 +10,4 @@ CPPFLAGS+= -DSYSVSEM -DSYSVSHM -DSYSVMSG
SRCS+= sysv_ipc.c sysv_msg.c sysv_sem.c sysv_shm.c
-.PATH: ${S}/compat/common
-
-CPPFLAGS+= -DCOMPAT_10
-CPPFLAGS+= -DCOMPAT_13
-CPPFLAGS+= -DCOMPAT_14
-CPPFLAGS+= -DCOMPAT_50
-
-.include "../../compat/common/Makefile.sysv"
-
.include <bsd.kmodule.mk>
diff --git a/sys/modules/vnd/Makefile b/sys/modules/vnd/Makefile
index 90fda46e474..c7b38c7e00b 100644
--- a/sys/modules/vnd/Makefile
+++ b/sys/modules/vnd/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2015/08/20 11:05:02 christos Exp $
+# $NetBSD: Makefile,v 1.4 2019/01/27 02:08:48 pgoyette Exp $
.include "../Makefile.inc"
-CPPFLAGS+= -DVND_COMPRESSION -DCOMPAT_30 -DCOMPAT_50
+CPPFLAGS+= -DVND_COMPRESSION -DCOMPAT_50
.PATH: ${S}/dev
diff --git a/sys/net/if.c b/sys/net/if.c
index 4ebda36f4ca..64011a229dc 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.443 2018/12/21 08:58:08 msaitoh Exp $ */
+/* $NetBSD: if.c,v 1.444 2019/01/27 02:08:48 pgoyette Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.443 2018/12/21 08:58:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.444 2019/01/27 02:08:48 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -119,6 +119,7 @@ __KERNEL_RCSID(0, "$NetBSD: if.c,v 1.443 2018/12/21 08:58:08 msaitoh Exp $");
#include <sys/xcall.h>
#include <sys/cpu.h>
#include <sys/intr.h>
+#include <sys/compat_stub.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -245,13 +246,6 @@ static void sysctl_net_pktq_setup(struct sysctllog **, int);
static void if_sysctl_setup(struct sysctllog **);
-/* Compatibility vector functions */
-u_long (*vec_compat_cvtcmd)(u_long) = NULL;
-int (*vec_compat_ifioctl)(struct socket *, u_long, u_long, void *,
- struct lwp *) = NULL;
-int (*vec_compat_ifconf)(struct lwp *, u_long, void *) = (void *)enosys;
-int (*vec_compat_ifdatareq)(struct lwp *, u_long, void *) = (void *)enosys;
-
static int
if_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
void *arg0, void *arg1, void *arg2, void *arg3)
@@ -3131,15 +3125,11 @@ doifioctl(struct socket *so, u_long cmd, void *data, struct lwp *l)
{
struct ifnet *ifp;
struct ifreq *ifr;
- int error = 0;
-#if defined(COMPAT_OSOCK) || defined(COMPAT_OIFREQ)
+ int error = 0, hook;
u_long ocmd = cmd;
-#endif
short oif_flags;
-#ifdef COMPAT_OIFREQ
struct ifreq ifrb;
struct oifreq *oifr = NULL;
-#endif
int r;
struct psref psref;
int bound;
@@ -3150,26 +3140,27 @@ doifioctl(struct socket *so, u_long cmd, void *data, struct lwp *l)
case SIOCINITIFADDR:
return EPERM;
default:
- error = (*vec_compat_ifconf)(l, cmd, data);
+ MODULE_CALL_HOOK(uipc_syscalls_40_hook, (cmd, data), enosys(),
+ error);
if (error != ENOSYS)
return error;
- error = (*vec_compat_ifdatareq)(l, cmd, data);
+ MODULE_CALL_HOOK(uipc_syscalls_50_hook, (l, cmd, data),
+ enosys(), error);
if (error != ENOSYS)
return error;
+ error = 0;
break;
}
ifr = data;
-#ifdef COMPAT_OIFREQ
- if (vec_compat_cvtcmd) {
- cmd = (*vec_compat_cvtcmd)(cmd);
+ MODULE_CALL_HOOK(if_43_cvtcmd_hook, (&cmd, ocmd), enosys(), hook);
+ if (hook != ENOSYS) {
if (cmd != ocmd) {
oifr = data;
data = ifr = &ifrb;
ifreqo2n(oifr, ifr);
}
}
-#endif
switch (cmd) {
case SIOCIFCREATE:
@@ -3263,11 +3254,9 @@ doifioctl(struct socket *so, u_long cmd, void *data, struct lwp *l)
error = EOPNOTSUPP;
else {
KERNEL_LOCK_IF_IFP_MPSAFE(ifp);
-#ifdef COMPAT_OSOCK
- if (vec_compat_ifioctl != NULL)
- error = (*vec_compat_ifioctl)(so, ocmd, cmd, data, l);
- else
-#endif
+ MODULE_CALL_HOOK(if_43_ifioctl_hook,
+ (so, ocmd, cmd, data, l), enosys(), error);
+ if (error == ENOSYS)
error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so,
cmd, data, ifp);
KERNEL_UNLOCK_IF_IFP_MPSAFE(ifp);
@@ -3280,10 +3269,8 @@ doifioctl(struct socket *so, u_long cmd, void *data, struct lwp *l)
splx(s);
}
}
-#ifdef COMPAT_OIFREQ
if (cmd != ocmd)
ifreqn2o(oifr, ifr);
-#endif
IFNET_UNLOCK(ifp);
KERNEL_UNLOCK_UNLESS_IFP_MPSAFE(ifp);
@@ -3418,31 +3405,29 @@ int
ifreq_setaddr(u_long cmd, struct ifreq *ifr, const struct sockaddr *sa)
{
uint8_t len = sizeof(ifr->ifr_ifru.ifru_space);
-#ifdef COMPAT_OIFREQ
struct ifreq ifrb;
struct oifreq *oifr = NULL;
u_long ocmd = cmd;
+ int hook;
- if (vec_compat_cvtcmd) {
- cmd = (*vec_compat_cvtcmd)(cmd);
- if (cmd != ocmd) {
- oifr = (struct oifreq *)(void *)ifr;
- ifr = &ifrb;
- ifreqo2n(oifr, ifr);
- len = sizeof(oifr->ifr_addr);
- }
+ MODULE_CALL_HOOK(if_43_cvtcmd_hook, (&cmd, ocmd), enosys(), hook);
+ if (hook != ENOSYS) {
+ if (cmd != ocmd) {
+ oifr = (struct oifreq *)(void *)ifr;
+ ifr = &ifrb;
+ ifreqo2n(oifr, ifr);
+ len = sizeof(oifr->ifr_addr);
+ }
}
-#endif
+
if (len < sa->sa_len)
return EFBIG;
memset(&ifr->ifr_addr, 0, len);
sockaddr_copy(&ifr->ifr_addr, len, sa);
-#ifdef COMPAT_OIFREQ
if (cmd != ocmd)
ifreqn2o(oifr, ifr);
-#endif
return 0;
}
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 040813b476b..2444eb80d01 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_spppsubr.c,v 1.180 2018/03/30 13:29:19 mlelstv Exp $ */
+/* $NetBSD: if_spppsubr.c,v 1.181 2019/01/27 02:08:48 pgoyette Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.180 2018/03/30 13:29:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.181 2019/01/27 02:08:48 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -68,6 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.180 2018/03/30 13:29:19 mlelstv Ex
#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>
@@ -5911,52 +5912,17 @@ sppp_params(struct sppp *sp, u_long cmd, void *data)
SPPP_UNLOCK(sp);
}
break;
-#if defined(COMPAT_50) || defined(MODULAR)
- 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:
+ default:
{
- struct spppkeepalivesettings50 *settings =
- (struct spppkeepalivesettings50*)data;
+ int ret;
- SPPP_LOCK(sp, RW_WRITER);
- sp->pp_maxalive = settings->maxalive;
- sp->pp_max_noreceive = (time_t)settings->max_noreceive;
- SPPP_UNLOCK(sp);
- }
- break;
-#endif /* COMPAT_50 || MODULAR */
- default:
+ MODULE_CALL_HOOK(sppp_params_50_hook, (sp, cmd, data),
+ enosys(), ret);
+ if (ret != ENOSYS)
+ return ret;
return (EINVAL);
+ }
}
-
return (0);
}
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 1e9291bca10..95ecede42c5 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock.c,v 1.244 2018/11/13 07:45:43 maxv Exp $ */
+/* $NetBSD: rtsock.c,v 1.245 2019/01/27 02:08:48 pgoyette Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,14 +61,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.244 2018/11/13 07:45:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.245 2019/01/27 02:08:48 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
-#include "opt_mpls.h"
#include "opt_compat_netbsd.h"
-#include "opt_sctp.h"
-#include "opt_net_mpsafe.h"
#endif
#include <sys/param.h>
@@ -83,6 +80,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.244 2018/11/13 07:45:43 maxv Exp $");
#include <sys/kmem.h>
#include <sys/intr.h>
#include <sys/condvar.h>
+#include <sys/compat_stub.h>
#include <net/if.h>
#include <net/if_llatbl.h>
@@ -95,962 +93,18 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.244 2018/11/13 07:45:43 maxv Exp $");
#include <netmpls/mpls.h>
-#ifdef SCTP
-extern void sctp_add_ip_address(struct ifaddr *);
-extern void sctp_delete_ip_address(struct ifaddr *);
-#endif
-
-#if defined(COMPAT_14) || defined(COMPAT_50) || defined(COMPAT_70)
#include <compat/net/if.h>
#include <compat/net/route.h>
-#endif
-#ifdef COMPAT_RTSOCK
-#define RTM_XVERSION RTM_OVERSION
-#define RTM_XNEWADDR RTM_ONEWADDR
-#define RTM_XDELADDR RTM_ODELADDR
-#define RTM_XCHGADDR RTM_OCHGADDR
-#define RT_XADVANCE(a,b) RT_OADVANCE(a,b)
-#define RT_XROUNDUP(n) RT_OROUNDUP(n)
-#define PF_XROUTE PF_OROUTE
-#define rt_xmsghdr rt_msghdr50
-#define if_xmsghdr if_msghdr /* if_msghdr50 is for RTM_OIFINFO */
-#define ifa_xmsghdr ifa_msghdr50
-#define if_xannouncemsghdr if_announcemsghdr50
-#define COMPATNAME(x) compat_50_ ## x
-#define DOMAINNAME "oroute"
-CTASSERT(sizeof(struct ifa_xmsghdr) == 20);
-DOMAIN_DEFINE(compat_50_routedomain); /* forward declare and add to link set */
-#undef COMPAT_70
-#else /* COMPAT_RTSOCK */
-#define RTM_XVERSION RTM_VERSION
-#define RTM_XNEWADDR RTM_NEWADDR
-#define RTM_XDELADDR RTM_DELADDR
-#define RTM_XCHGADDR RTM_CHGADDR
-#define RT_XADVANCE(a,b) RT_ADVANCE(a,b)
-#define RT_XROUNDUP(n) RT_ROUNDUP(n)
-#define PF_XROUTE PF_ROUTE
-#define rt_xmsghdr rt_msghdr
-#define if_xmsghdr if_msghdr
-#define ifa_xmsghdr ifa_msghdr
-#define if_xannouncemsghdr if_announcemsghdr
-#define COMPATNAME(x) x
-#define DOMAINNAME "route"
-CTASSERT(sizeof(struct ifa_xmsghdr) == 32);
-#ifdef COMPAT_50
-#define COMPATCALL(name, args) compat_50_ ## name args
-#endif
-DOMAIN_DEFINE(routedomain); /* forward declare and add to link set */
-#undef COMPAT_50
-#undef COMPAT_14
-#endif /* COMPAT_RTSOCK */
-#ifndef COMPATCALL
-#define COMPATCALL(name, args) do { } while (/*CONSTCOND*/ 0)
+#ifdef COMPAT_RTSOCK
+#undef COMPAT_RTSOCK
#endif
-#ifdef RTSOCK_DEBUG
-#define RT_IN_PRINT(info, b, a) (in_print((b), sizeof(b), \
- &((const struct sockaddr_in *)(info)->rti_info[(a)])->sin_addr), (b))
-#endif /* RTSOCK_DEBUG */
-
-struct route_info COMPATNAME(route_info) = {
- .ri_dst = { .sa_len = 2, .sa_family = PF_XROUTE, },
- .ri_src = { .sa_len = 2, .sa_family = PF_XROUTE, },
- .ri_maxqlen = IFQ_MAXLEN,
-};
-
-static void COMPATNAME(route_init)(void);
-static int COMPATNAME(route_output)(struct mbuf *, struct socket *);
-
-static int rt_xaddrs(u_char, const char *, const char *, struct rt_addrinfo *);
-static struct mbuf *rt_makeifannouncemsg(struct ifnet *, int, int,
- struct rt_addrinfo *);
-static int rt_msg2(int, struct rt_addrinfo *, void *, struct rt_walkarg *, int *);
-static void _rt_setmetrics(int, const struct rt_xmsghdr *, struct rtentry *);
-static void rtm_setmetrics(const struct rtentry *, struct rt_xmsghdr *);
+static int if_addrflags(struct ifaddr *);
static void sysctl_net_route_setup(struct sysctllog **);
-static int sysctl_dumpentry(struct rtentry *, void *);
-static int sysctl_iflist(int, struct rt_walkarg *, int);
-static int sysctl_rtable(SYSCTLFN_PROTO);
-static void rt_adjustcount(int, int);
-
-static const struct protosw COMPATNAME(route_protosw)[];
-
-struct routecb {
- struct rawcb rocb_rcb;
- unsigned int rocb_msgfilter;
-#define RTMSGFILTER(m) (1U << (m))
-};
-#define sotoroutecb(so) ((struct routecb *)(so)->so_pcb)
-
-static struct rawcbhead rt_rawcb;
-#ifdef NET_MPSAFE
-static kmutex_t *rt_so_mtx;
-
-static bool rt_updating = false;
-static kcondvar_t rt_update_cv;
-#endif
-
-static void
-rt_adjustcount(int af, int cnt)
-{
- struct route_cb * const cb = &COMPATNAME(route_info).ri_cb;
-
- cb->any_count += cnt;
-
- switch (af) {
- case AF_INET:
- cb->ip_count += cnt;
- return;
-#ifdef INET6
- case AF_INET6:
- cb->ip6_count += cnt;
- return;
-#endif
- case AF_MPLS:
- cb->mpls_count += cnt;
- return;
- }
-}
-
-static int
-COMPATNAME(route_filter)(struct mbuf *m, struct sockproto *proto,
- struct rawcb *rp)
-{
- struct routecb *rop = (struct routecb *)rp;
- struct rt_xmsghdr *rtm;
-
- KASSERT(m != NULL);
- KASSERT(proto != NULL);
- KASSERT(rp != NULL);
-
- /* Wrong family for this socket. */
- if (proto->sp_family != PF_ROUTE)
- return ENOPROTOOPT;
-
- /* If no filter set, just return. */
- if (rop->rocb_msgfilter == 0)
- return 0;
-
- /* Ensure we can access rtm_type */
- if (m->m_len <
- offsetof(struct rt_xmsghdr, rtm_type) + sizeof(rtm->rtm_type))
- return EINVAL;
-
- rtm = mtod(m, struct rt_xmsghdr *);
- /* If the rtm type is filtered out, return a positive. */
- if (!(rop->rocb_msgfilter & RTMSGFILTER(rtm->rtm_type)))
- return EEXIST;
-
- /* Passed the filter. */
- return 0;
-}
-
-static void
-rt_pr_init(void)
-{
-
- LIST_INIT(&rt_rawcb);
-}
-
-static int
-COMPATNAME(route_attach)(struct socket *so, int proto)
-{
- struct rawcb *rp;
- struct routecb *rop;
- int s, error;
-
- KASSERT(sotorawcb(so) == NULL);
- rop = kmem_zalloc(sizeof(*rop), KM_SLEEP);
- rp = &rop->rocb_rcb;
- rp->rcb_len = sizeof(*rop);
- so->so_pcb = rp;
-
- s = splsoftnet();
-
-#ifdef NET_MPSAFE
- KASSERT(so->so_lock == NULL);
- mutex_obj_hold(rt_so_mtx);
- so->so_lock = rt_so_mtx;
- solock(so);
-#endif
-
- if ((error = raw_attach(so, proto, &rt_rawcb)) == 0) {
- rt_adjustcount(rp->rcb_proto.sp_protocol, 1);
- rp->rcb_laddr = &COMPATNAME(route_info).ri_src;
- rp->rcb_faddr = &COMPATNAME(route_info).ri_dst;
- rp->rcb_filter = COMPATNAME(route_filter);
- }
- splx(s);
-
- if (error) {
- kmem_free(rop, sizeof(*rop));
- so->so_pcb = NULL;
- return error;
- }
-
- soisconnected(so);
- so->so_options |= SO_USELOOPBACK;
- KASSERT(solocked(so));
-
- return error;
-}
-
-static void
-COMPATNAME(route_detach)(struct socket *so)
-{
- struct rawcb *rp = sotorawcb(so);
- int s;
-
- KASSERT(rp != NULL);
- KASSERT(solocked(so));
-
- s = splsoftnet();
- rt_adjustcount(rp->rcb_proto.sp_protocol, -1);
- raw_detach(so);
- splx(s);
-}
-
-static int
-COMPATNAME(route_accept)(struct socket *so, struct sockaddr *nam)
-{
- KASSERT(solocked(so));
-
- panic("route_accept");
-
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_bind)(struct socket *so, struct sockaddr *nam, struct lwp *l)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_listen)(struct socket *so, struct lwp *l)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_connect)(struct socket *so, struct sockaddr *nam, struct lwp *l)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_connect2)(struct socket *so, struct socket *so2)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_disconnect)(struct socket *so)
-{
- struct rawcb *rp = sotorawcb(so);
- int s;
-
- KASSERT(solocked(so));
- KASSERT(rp != NULL);
-
- s = splsoftnet();
- soisdisconnected(so);
- raw_disconnect(rp);
- splx(s);
-
- return 0;
-}
-
-static int
-COMPATNAME(route_shutdown)(struct socket *so)
-{
- int s;
-
- KASSERT(solocked(so));
-
- /*
- * Mark the connection as being incapable of further input.
- */
- s = splsoftnet();
- socantsendmore(so);
- splx(s);
- return 0;
-}
-
-static int
-COMPATNAME(route_abort)(struct socket *so)
-{
- KASSERT(solocked(so));
-
- panic("route_abort");
-
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_ioctl)(struct socket *so, u_long cmd, void *nam,
- struct ifnet * ifp)
-{
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_stat)(struct socket *so, struct stat *ub)
-{
- KASSERT(solocked(so));
-
- return 0;
-}
-
-static int
-COMPATNAME(route_peeraddr)(struct socket *so, struct sockaddr *nam)
-{
- struct rawcb *rp = sotorawcb(so);
-
- KASSERT(solocked(so));
- KASSERT(rp != NULL);
- KASSERT(nam != NULL);
-
- if (rp->rcb_faddr == NULL)
- return ENOTCONN;
-
- raw_setpeeraddr(rp, nam);
- return 0;
-}
-
-static int
-COMPATNAME(route_sockaddr)(struct socket *so, struct sockaddr *nam)
-{
- struct rawcb *rp = sotorawcb(so);
-
- KASSERT(solocked(so));
- KASSERT(rp != NULL);
- KASSERT(nam != NULL);
-
- if (rp->rcb_faddr == NULL)
- return ENOTCONN;
-
- raw_setsockaddr(rp, nam);
- return 0;
-}
-
-static int
-COMPATNAME(route_rcvd)(struct socket *so, int flags, struct lwp *l)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_recvoob)(struct socket *so, struct mbuf *m, int flags)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-COMPATNAME(route_send)(struct socket *so, struct mbuf *m,
- struct sockaddr *nam, struct mbuf *control, struct lwp *l)
-{
- int error = 0;
- int s;
-
- KASSERT(solocked(so));
- KASSERT(so->so_proto == &COMPATNAME(route_protosw)[0]);
-
- s = splsoftnet();
- error = raw_send(so, m, nam, control, l, &COMPATNAME(route_output));
- splx(s);
-
- return error;
-}
-
-static int
-COMPATNAME(route_sendoob)(struct socket *so, struct mbuf *m,
- struct mbuf *control)
-{
- KASSERT(solocked(so));
-
- m_freem(m);
- m_freem(control);
-
- return EOPNOTSUPP;
-}
-static int
-COMPATNAME(route_purgeif)(struct socket *so, struct ifnet *ifp)
-{
-
- panic("route_purgeif");
-
- return EOPNOTSUPP;
-}
-
-#if defined(INET) || defined(INET6)
-static int
-route_get_sdl_index(struct rt_addrinfo *info, int *sdl_index)
-{
- struct rtentry *nrt;
- int error;
-
- error = rtrequest1(RTM_GET, info, &nrt);
- if (error != 0)
- return error;
- /*
- * nrt->rt_ifp->if_index may not be correct
- * due to changing to ifplo0.
- */
- *sdl_index = satosdl(nrt->rt_gateway)->sdl_index;
- rt_unref(nrt);
-
- return 0;
-}
-#endif
-
-static void
-route_get_sdl(const struct ifnet *ifp, const struct sockaddr *dst,
- struct sockaddr_dl *sdl, int *flags)
-{
- struct llentry *la;
-
- KASSERT(ifp != NULL);
-
- IF_AFDATA_RLOCK(ifp);
- switch (dst->sa_family) {
- case AF_INET:
- la = lla_lookup(LLTABLE(ifp), 0, dst);
- break;
- case AF_INET6:
- la = lla_lookup(LLTABLE6(ifp), 0, dst);
- break;
- default:
- la = NULL;
- KASSERTMSG(0, "Invalid AF=%d\n", dst->sa_family);
- break;
- }
- IF_AFDATA_RUNLOCK(ifp);
-
- void *a = (LLE_IS_VALID(la) && (la->la_flags & LLE_VALID) == LLE_VALID)
- ? &la->ll_addr : NULL;
-
- a = sockaddr_dl_init(sdl, sizeof(*sdl), ifp->if_index, ifp->if_type,
- NULL, 0, a, ifp->if_addrlen);
- KASSERT(a != NULL);
-
- if (la != NULL) {
- *flags = la->la_flags;
- LLE_RUNLOCK(la);
- }
-}
-
-static int
-route_output_report(struct rtentry *rt, struct rt_addrinfo *info,
- struct rt_xmsghdr *rtm, struct rt_xmsghdr **new_rtm)
-{
- int len;
-
- if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) {
- const struct ifaddr *rtifa;
- const struct ifnet *ifp = rt->rt_ifp;
-
- info->rti_info[RTAX_IFP] = ifp->if_dl->ifa_addr;
- /* rtifa used to be simply rt->rt_ifa.
- * If rt->rt_ifa != NULL, then
- * rt_get_ifa() != NULL. So this
- * ought to still be safe. --dyoung
- */
- rtifa = rt_get_ifa(rt);
- info->rti_info[RTAX_IFA] = rtifa->ifa_addr;
-#ifdef RTSOCK_DEBUG
- if (info->rti_info[RTAX_IFA]->sa_family == AF_INET) {
- char ibuf[INET_ADDRSTRLEN];
- char abuf[INET_ADDRSTRLEN];
- printf("%s: copying out RTAX_IFA %s "
- "for info->rti_info[RTAX_DST] %s "
- "ifa_getifa %p ifa_seqno %p\n",
- __func__,
- RT_IN_PRINT(info, ibuf, RTAX_IFA),
- RT_IN_PRINT(info, abuf, RTAX_DST),
- (void *)rtifa->ifa_getifa,
- rtifa->ifa_seqno);
- }
-#endif /* RTSOCK_DEBUG */
- if (ifp->if_flags & IFF_POINTOPOINT)
- info->rti_info[RTAX_BRD] = rtifa->ifa_dstaddr;
- else
- info->rti_info[RTAX_BRD] = NULL;
- rtm->rtm_index = ifp->if_index;
- }
- (void)rt_msg2(rtm->rtm_type, info, NULL, NULL, &len);
- if (len > rtm->rtm_msglen) {
- struct rt_xmsghdr *old_rtm = rtm;
- R_Malloc(*new_rtm, struct rt_xmsghdr *, len);
- if (*new_rtm == NULL)
- return ENOBUFS;
- (void)memcpy(*new_rtm, old_rtm, old_rtm->rtm_msglen);
- rtm = *new_rtm;
- }
- (void)rt_msg2(rtm->rtm_type, info, rtm, NULL, 0);
- rtm->rtm_flags = rt->rt_flags;
- rtm_setmetrics(rt, rtm);
- rtm->rtm_addrs = info->rti_addrs;
-
- return 0;
-}
-
-/*ARGSUSED*/
-int
-COMPATNAME(route_output)(struct mbuf *m, struct socket *so)
-{
- struct sockproto proto = { .sp_family = PF_XROUTE, };
- struct rt_xmsghdr *rtm = NULL;
- struct rt_xmsghdr *old_rtm = NULL, *new_rtm = NULL;
- struct rtentry *rt = NULL;
- struct rtentry *saved_nrt = NULL;
- struct rt_addrinfo info;
- int len, error = 0;
- sa_family_t family;
- struct sockaddr_dl sdl;
- int bound = curlwp_bind();
- bool do_rt_free = false;
- struct sockaddr_storage netmask;
-
-#define senderr(e) do { error = e; goto flush;} while (/*CONSTCOND*/ 0)
- if (m == NULL || ((m->m_len < sizeof(int32_t)) &&
- (m = m_pullup(m, sizeof(int32_t))) == NULL)) {
- error = ENOBUFS;
- goto out;
- }
- if ((m->m_flags & M_PKTHDR) == 0)
- panic("%s", __func__);
- len = m->m_pkthdr.len;
- if (len < sizeof(*rtm) ||
- len != mtod(m, struct rt_xmsghdr *)->rtm_msglen) {
- info.rti_info[RTAX_DST] = NULL;
- senderr(EINVAL);
- }
- R_Malloc(rtm, struct rt_xmsghdr *, len);
- if (rtm == NULL) {
- info.rti_info[RTAX_DST] = NULL;
- senderr(ENOBUFS);
- }
- m_copydata(m, 0, len, rtm);
- if (rtm->rtm_version != RTM_XVERSION) {
- info.rti_info[RTAX_DST] = NULL;
- senderr(EPROTONOSUPPORT);
- }
- rtm->rtm_pid = curproc->p_pid;
- memset(&info, 0, sizeof(info));
- info.rti_addrs = rtm->rtm_addrs;
- if (rt_xaddrs(rtm->rtm_type, (const char *)(rtm + 1), len + (char *)rtm,
- &info)) {
- senderr(EINVAL);
- }
- info.rti_flags = rtm->rtm_flags;
-#ifdef RTSOCK_DEBUG
- if (info.rti_info[RTAX_DST]->sa_family == AF_INET) {
- char abuf[INET_ADDRSTRLEN];
- printf("%s: extracted info.rti_info[RTAX_DST] %s\n", __func__,
- RT_IN_PRINT(&info, abuf, RTAX_DST));
- }
-#endif /* RTSOCK_DEBUG */
- if (info.rti_info[RTAX_DST] == NULL ||
- (info.rti_info[RTAX_DST]->sa_family >= AF_MAX)) {
- senderr(EINVAL);
- }
- if (info.rti_info[RTAX_GATEWAY] != NULL &&
- (info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) {
- senderr(EINVAL);
- }
-
- /*
- * Verify that the caller has the appropriate privilege; RTM_GET
- * is the only operation the non-superuser is allowed.
- */
- if (kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_ROUTE,
- 0, rtm, NULL, NULL) != 0)
- senderr(EACCES);
-
- /*
- * route(8) passes a sockaddr truncated with prefixlen.
- * The kernel doesn't expect such sockaddr and need to
- * use a buffer that is big enough for the sockaddr expected
- * (padded with 0's). We keep the original length of the sockaddr.
- */
- if (info.rti_info[RTAX_NETMASK]) {
- /*
- * Use the family of RTAX_DST, because RTAX_NETMASK
- * can have a zero family if it comes from the radix
- * tree via rt_mask().
- */
- socklen_t sa_len = sockaddr_getsize_by_family(
- info.rti_info[RTAX_DST]->sa_family);
- socklen_t masklen = sockaddr_getlen(
- info.rti_info[RTAX_NETMASK]);
- if (sa_len != 0 && sa_len > masklen) {
- KASSERT(sa_len <= sizeof(netmask));
- memcpy(&netmask, info.rti_info[RTAX_NETMASK], masklen);
- memset((char *)&netmask + masklen, 0, sa_len - masklen);
- info.rti_info[RTAX_NETMASK] = sstocsa(&netmask);
- }
- }
-
- switch (rtm->rtm_type) {
-
- case RTM_ADD:
- if (info.rti_info[RTAX_GATEWAY] == NULL) {
- senderr(EINVAL);
- }
-#if defined(INET) || defined(INET6)
- /* support for new ARP/NDP code with keeping backcompat */
- if (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) {
- const struct sockaddr_dl *sdlp =
- satocsdl(info.rti_info[RTAX_GATEWAY]);
-
- /* Allow routing requests by interface index */
- if (sdlp->sdl_nlen == 0 && sdlp->sdl_alen == 0
- && sdlp->sdl_slen == 0)
- goto fallback;
- /*
- * Old arp binaries don't set the sdl_index
- * so we have to complement it.
- */
- int sdl_index = sdlp->sdl_index;
- if (sdl_index == 0) {
- error = route_get_sdl_index(&info, &sdl_index);
- if (error != 0)
- goto fallback;
- } else if (
- info.rti_info[RTAX_DST]->sa_family == AF_INET) {
- /*
- * XXX workaround for SIN_PROXY case; proxy arp
- * entry should be in an interface that has
- * a network route including the destination,
- * not a local (link) route that may not be a
- * desired place, for example a tap.
- */
- const struct sockaddr_inarp *sina =
- (const struct sockaddr_inarp *)
- info.rti_info[RTAX_DST];
- if (sina->sin_other & SIN_PROXY) {
- error = route_get_sdl_index(&info,
- &sdl_index);
- if (error != 0)
- goto fallback;
- }
- }
- error = lla_rt_output(rtm->rtm_type, rtm->rtm_flags,
- rtm->rtm_rmx.rmx_expire, &info, sdl_index);
- break;
- }
- fallback:
-#endif /* defined(INET) || defined(INET6) */
- error = rtrequest1(rtm->rtm_type, &info, &saved_nrt);
- if (error == 0) {
- _rt_setmetrics(rtm->rtm_inits, rtm, saved_nrt);
- rt_unref(saved_nrt);
- }
- break;
-
- case RTM_DELETE:
-#if defined(INET) || defined(INET6)
- /* support for new ARP/NDP code */
- if (info.rti_info[RTAX_GATEWAY] &&
- (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) &&
- (rtm->rtm_flags & RTF_LLDATA) != 0) {
- const struct sockaddr_dl *sdlp =
- satocsdl(info.rti_info[RTAX_GATEWAY]);
- error = lla_rt_output(rtm->rtm_type, rtm->rtm_flags,
- rtm->rtm_rmx.rmx_expire, &info, sdlp->sdl_index);
- rtm->rtm_flags &= ~RTF_UP;
- break;
- }
-#endif
- error = rtrequest1(rtm->rtm_type, &info, &saved_nrt);
- if (error != 0)
- break;
-
- rt = saved_nrt;
- do_rt_free = true;
- info.rti_info[RTAX_DST] = rt_getkey(rt);
- info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
- info.rti_info[RTAX_NETMASK] = rt_mask(rt);
- info.rti_info[RTAX_TAG] = rt_gettag(rt);
- error = route_output_report(rt, &info, rtm, &new_rtm);
- if (error)
- senderr(error);
- if (new_rtm != NULL) {
- old_rtm = rtm;
- rtm = new_rtm;
- }
- break;
-
- case RTM_GET:
- case RTM_CHANGE:
- case RTM_LOCK:
- /* XXX This will mask info.rti_info[RTAX_DST] with
- * info.rti_info[RTAX_NETMASK] before
- * searching. It did not used to do that. --dyoung
- */
- rt = NULL;
- error = rtrequest1(RTM_GET, &info, &rt);
- if (error != 0)
- senderr(error);
- if (rtm->rtm_type != RTM_GET) {/* XXX: too grotty */
- if (memcmp(info.rti_info[RTAX_DST], rt_getkey(rt),
- info.rti_info[RTAX_DST]->sa_len) != 0)
- senderr(ESRCH);
- if (info.rti_info[RTAX_NETMASK] == NULL &&
- rt_mask(rt) != NULL)
- senderr(ETOOMANYREFS);
- }
-
- /*
- * XXX if arp/ndp requests an L2 entry, we have to obtain
- * it from lltable while for the route command we have to
- * return a route as it is. How to distinguish them?
- * For newer arp/ndp, RTF_LLDATA flag set by arp/ndp
- * indicates an L2 entry is requested. For old arp/ndp
- * binaries, we check RTF_UP flag is NOT set; it works
- * by the fact that arp/ndp don't set it while the route
- * command sets it.
- */
- if (((rtm->rtm_flags & RTF_LLDATA) != 0 ||
- (rtm->rtm_flags & RTF_UP) == 0) &&
- rtm->rtm_type == RTM_GET &&
- sockaddr_cmp(rt_getkey(rt), info.rti_info[RTAX_DST]) != 0) {
- int ll_flags = 0;
- route_get_sdl(rt->rt_ifp, info.rti_info[RTAX_DST], &sdl,
- &ll_flags);
- info.rti_info[RTAX_GATEWAY] = sstocsa(&sdl);
- error = route_output_report(rt, &info, rtm, &new_rtm);
- if (error)
- senderr(error);
- if (new_rtm != NULL) {
- old_rtm = rtm;
- rtm = new_rtm;
- }
- rtm->rtm_flags |= RTF_LLDATA;
- rtm->rtm_flags &= ~RTF_CONNECTED;
- rtm->rtm_flags |= (ll_flags & LLE_STATIC) ? RTF_STATIC : 0;
- break;
- }
-
- switch (rtm->rtm_type) {
- case RTM_GET:
- info.rti_info[RTAX_DST] = rt_getkey(rt);
- info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
- info.rti_info[RTAX_NETMASK] = rt_mask(rt);
- info.rti_info[RTAX_TAG] = rt_gettag(rt);
- error = route_output_report(rt, &info, rtm, &new_rtm);
- if (error)
- senderr(error);
- if (new_rtm != NULL) {
- old_rtm = rtm;
- rtm = new_rtm;
- }
- break;
-
- case RTM_CHANGE:
-#ifdef NET_MPSAFE
- /*
- * Release rt_so_mtx to avoid a deadlock with route_intr
- * and also serialize updating routes to avoid another.
- */
- if (rt_updating) {
- /* Release to allow the updater to proceed */
- rt_unref(rt);
- rt = NULL;
- }
- while (rt_updating) {
- error = cv_wait_sig(&rt_update_cv, rt_so_mtx);
- if (error != 0)
- goto flush;
- }
- if (rt == NULL) {
- error = rtrequest1(RTM_GET, &info, &rt);
- if (error != 0)
- goto flush;
- }
- rt_updating = true;
- mutex_exit(rt_so_mtx);
-
- error = rt_update_prepare(rt);
- if (error == 0) {
- error = rt_update(rt, &info, rtm);
- rt_update_finish(rt);
- }
- mutex_enter(rt_so_mtx);
- rt_updating = false;
- cv_broadcast(&rt_update_cv);
-#else
- error = rt_update(rt, &info, rtm);
-#endif
- if (error != 0)
- goto flush;
- /*FALLTHROUGH*/
- case RTM_LOCK:
- rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits);
- rt->rt_rmx.rmx_locks |=
- (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks);
- break;
- }
- break;
-
- default:
- senderr(EOPNOTSUPP);
- }
-
-flush:
- if (rtm) {
- if (error)
- rtm->rtm_errno = error;
- else
- rtm->rtm_flags |= RTF_DONE;
- }
- family = info.rti_info[RTAX_DST] ? info.rti_info[RTAX_DST]->sa_family :
- 0;
- /* We cannot free old_rtm until we have stopped using the
- * pointers in info, some of which may point to sockaddrs
- * in old_rtm.
- */
- if (old_rtm != NULL)
- Free(old_rtm);
- if (rt) {
- if (do_rt_free) {
-#ifdef NET_MPSAFE
- /*
- * Release rt_so_mtx to avoid a deadlock with
- * route_intr.
- */
- mutex_exit(rt_so_mtx);
- rt_free(rt);
- mutex_enter(rt_so_mtx);
-#else
- rt_free(rt);
-#endif
- } else
- rt_unref(rt);
- }
- {
- struct rawcb *rp = NULL;
- /*
- * Check to see if we don't want our own messages.
- */
- if ((so->so_options & SO_USELOOPBACK) == 0) {
- if (COMPATNAME(route_info).ri_cb.any_count <= 1) {
- if (rtm)
- Free(rtm);
- m_freem(m);
- goto out;
- }
- /* There is another listener, so construct message */
- rp = sotorawcb(so);
- }
- if (rtm) {
- m_copyback(m, 0, rtm->rtm_msglen, rtm);
- if (m->m_pkthdr.len < rtm->rtm_msglen) {
- m_freem(m);
- m = NULL;
- } else if (m->m_pkthdr.len > rtm->rtm_msglen)
- m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len);
- Free(rtm);
- }
- if (rp)
- rp->rcb_proto.sp_family = 0; /* Avoid us */
- if (family)
- proto.sp_protocol = family;
- if (m)
- raw_input(m, &proto, &COMPATNAME(route_info).ri_src,
- &COMPATNAME(route_info).ri_dst, &rt_rawcb);
- if (rp)
- rp->rcb_proto.sp_family = PF_XROUTE;
- }
-out:
- curlwp_bindx(bound);
- return error;
-}
-
-static int
-route_ctloutput(int op, struct socket *so, struct sockopt *sopt)
-{
- struct routecb *rop = sotoroutecb(so);
- int error = 0;
- unsigned char *rtm_type;
- size_t len;
- unsigned int msgfilter;
+#include <net/rtsock_shared.c>
- KASSERT(solocked(so));
-
- if (sopt->sopt_level != AF_ROUTE) {
- error = ENOPROTOOPT;
- } else switch (op) {
- case PRCO_SETOPT:
- switch (sopt->sopt_name) {
- case RO_MSGFILTER:
- msgfilter = 0;
- for (rtm_type = sopt->sopt_data, len = sopt->sopt_size;
- len != 0;
- rtm_type++, len -= sizeof(*rtm_type))
- {
- /* Guard against overflowing our storage. */
- if (*rtm_type >= sizeof(msgfilter) * CHAR_BIT) {
- error = EOVERFLOW;
- break;
- }
- msgfilter |= RTMSGFILTER(*rtm_type);
- }
- if (error == 0)
- rop->rocb_msgfilter = msgfilter;
- break;
- default:
- error = ENOPROTOOPT;
- break;
- }
- break;
- case PRCO_GETOPT:
- switch (sopt->sopt_name) {
- case RO_MSGFILTER:
- error = ENOTSUP;
- break;
- default:
- error = ENOPROTOOPT;
- break;
- }
- }
- return error;
-}
-
-static void
-_rt_setmetrics(int which, const struct rt_xmsghdr *in, struct rtentry *out)
-{
-#define metric(f, e) if (which & (f)) out->rt_rmx.e = in->rtm_rmx.e;
- metric(RTV_RPIPE, rmx_recvpipe);
- metric(RTV_SPIPE, rmx_sendpipe);
- metric(RTV_SSTHRESH, rmx_ssthresh);
- metric(RTV_RTT, rmx_rtt);
- metric(RTV_RTTVAR, rmx_rttvar);
- metric(RTV_HOPCOUNT, rmx_hopcount);
- metric(RTV_MTU, rmx_mtu);
-#undef metric
- if (which & RTV_EXPIRE) {
- out->rt_rmx.rmx_expire = in->rtm_rmx.rmx_expire ?
- time_wall_to_mono(in->rtm_rmx.rmx_expire) : 0;
- }
-}
-
-#ifndef COMPAT_RTSOCK
/*
* XXX avoid using void * once msghdr compat disappears.
*/
@@ -1061,335 +115,14 @@ rt_setmetrics(void *in, struct rtentry *out)
_rt_setmetrics(rtm->rtm_inits, rtm, out);
}
-#endif
-
-static void
-rtm_setmetrics(const struct rtentry *in, struct rt_xmsghdr *out)
-{
-#define metric(e) out->rtm_rmx.e = in->rt_rmx.e;
- metric(rmx_recvpipe);
- metric(rmx_sendpipe);
- metric(rmx_ssthresh);
- metric(rmx_rtt);
- metric(rmx_rttvar);
- metric(rmx_hopcount);
- metric(rmx_mtu);
- metric(rmx_locks);
-#undef metric
- out->rtm_rmx.rmx_expire = in->rt_rmx.rmx_expire ?
- time_mono_to_wall(in->rt_rmx.rmx_expire) : 0;
-}
-
-static int
-rt_xaddrs(u_char rtmtype, const char *cp, const char *cplim,
- struct rt_addrinfo *rtinfo)
-{
- const struct sockaddr *sa = NULL; /* Quell compiler warning */
- int i;
-
- for (i = 0; i < RTAX_MAX && cp < cplim; i++) {
- if ((rtinfo->rti_addrs & (1 << i)) == 0)
- continue;
- rtinfo->rti_info[i] = sa = (const struct sockaddr *)cp;
- RT_XADVANCE(cp, sa);
- }
-
- /*
- * Check for extra addresses specified, except RTM_GET asking
- * for interface info.
- */
- if (rtmtype == RTM_GET) {
- if (((rtinfo->rti_addrs &
- (~((1 << RTAX_IFP) | (1 << RTAX_IFA)))) & (~0U << i)) != 0)
- return 1;
- } else if ((rtinfo->rti_addrs & (~0U << i)) != 0)
- return 1;
- /* Check for bad data length. */
- if (cp != cplim) {
- if (i == RTAX_NETMASK + 1 && sa != NULL &&
- cp - RT_XROUNDUP(sa->sa_len) + sa->sa_len == cplim)
- /*
- * The last sockaddr was info.rti_info[RTAX_NETMASK].
- * We accept this for now for the sake of old
- * binaries or third party softwares.
- */
- ;
- else
- return 1;
- }
- return 0;
-}
-
-static int
-rt_getlen(int type)
-{
-#ifndef COMPAT_RTSOCK
- CTASSERT(__alignof(struct ifa_msghdr) >= sizeof(uint64_t));
- CTASSERT(__alignof(struct if_msghdr) >= sizeof(uint64_t));
- CTASSERT(__alignof(struct if_announcemsghdr) >= sizeof(uint64_t));
- CTASSERT(__alignof(struct rt_msghdr) >= sizeof(uint64_t));
-#endif
-
- switch (type) {
- case RTM_ODELADDR:
- case RTM_ONEWADDR:
- case RTM_OCHGADDR:
-#ifdef COMPAT_70
- return sizeof(struct ifa_msghdr70);
-#else
-#ifdef RTSOCK_DEBUG
- printf("%s: unsupported RTM type %d\n", __func__, type);
-#endif
- return -1;
-#endif
- case RTM_DELADDR:
- case RTM_NEWADDR:
- case RTM_CHGADDR:
- return sizeof(struct ifa_xmsghdr);
-
- case RTM_OOIFINFO:
-#ifdef COMPAT_14
- return sizeof(struct if_msghdr14);
-#else
-#ifdef RTSOCK_DEBUG
- printf("%s: unsupported RTM type RTM_OOIFINFO\n", __func__);
-#endif
- return -1;
-#endif
- case RTM_OIFINFO:
-#ifdef COMPAT_50
- return sizeof(struct if_msghdr50);
-#else
-#ifdef RTSOCK_DEBUG
- printf("%s: unsupported RTM type RTM_OIFINFO\n", __func__);
-#endif
- return -1;
-#endif
-
- case RTM_IFINFO:
- return sizeof(struct if_xmsghdr);
-
- case RTM_IFANNOUNCE:
- case RTM_IEEE80211:
- return sizeof(struct if_xannouncemsghdr);
-
- default:
- return sizeof(struct rt_xmsghdr);
- }
-}
-
-
-struct mbuf *
-COMPATNAME(rt_msg1)(int type, struct rt_addrinfo *rtinfo, void *data, int datalen)
-{
- struct rt_xmsghdr *rtm;
- struct mbuf *m;
- int i;
- const struct sockaddr *sa;
- int len, dlen;
-
- m = m_gethdr(M_DONTWAIT, MT_DATA);
- if (m == NULL)
- return m;
- MCLAIM(m, &COMPATNAME(routedomain).dom_mowner);
-
- if ((len = rt_getlen(type)) == -1)
- goto out;
- if (len > MHLEN + MLEN)
- panic("%s: message too long", __func__);
- else if (len > MHLEN) {
- m->m_next = m_get(M_DONTWAIT, MT_DATA);
- if (m->m_next == NULL)
- goto out;
- MCLAIM(m->m_next, m->m_owner);
- m->m_pkthdr.len = len;
- m->m_len = MHLEN;
- m->m_next->m_len = len - MHLEN;
- } else {
- m->m_pkthdr.len = m->m_len = len;
- }
- m_reset_rcvif(m);
- m_copyback(m, 0, datalen, data);
- if (len > datalen)
- (void)memset(mtod(m, char *) + datalen, 0, len - datalen);
- rtm = mtod(m, struct rt_xmsghdr *);
- for (i = 0; i < RTAX_MAX; i++) {
- if ((sa = rtinfo->rti_info[i]) == NULL)
- continue;
- rtinfo->rti_addrs |= (1 << i);
- dlen = RT_XROUNDUP(sa->sa_len);
- m_copyback(m, len, sa->sa_len, sa);
- if (dlen != sa->sa_len) {
- /*
- * Up to 7 + 1 nul's since roundup is to
- * sizeof(uint64_t) (8 bytes)
- */
- m_copyback(m, len + sa->sa_len,
- dlen - sa->sa_len, "\0\0\0\0\0\0\0");
- }
- len += dlen;
- }
- if (m->m_pkthdr.len != len)
- goto out;
- rtm->rtm_msglen = len;
- rtm->rtm_version = RTM_XVERSION;
- rtm->rtm_type = type;
- return m;
-out:
- m_freem(m);
- return NULL;
-}
-/*
- * rt_msg2
- *
- * fills 'cp' or 'w'.w_tmem with the routing socket message and
- * returns the length of the message in 'lenp'.
- *
- * if walkarg is 0, cp is expected to be 0 or a buffer large enough to hold
- * the message
- * otherwise walkarg's w_needed is updated and if the user buffer is
- * specified and w_needed indicates space exists the information is copied
- * into the temp space (w_tmem). w_tmem is [re]allocated if necessary,
- * if the allocation fails ENOBUFS is returned.
- */
-static int
-rt_msg2(int type, struct rt_addrinfo *rtinfo, void *cpv, struct rt_walkarg *w,
- int *lenp)
-{
- int i;
- int len, dlen, second_time = 0;
- char *cp0, *cp = cpv;
-
- rtinfo->rti_addrs = 0;
-again:
- if ((len = rt_getlen(type)) == -1)
- return EINVAL;
-
- if ((cp0 = cp) != NULL)
- cp += len;
- for (i = 0; i < RTAX_MAX; i++) {
- const struct sockaddr *sa;
-
- if ((sa = rtinfo->rti_info[i]) == NULL)
- continue;
- rtinfo->rti_addrs |= (1 << i);
- dlen = RT_XROUNDUP(sa->sa_len);
- if (cp) {
- int diff = dlen - sa->sa_len;
- (void)memcpy(cp, sa, (size_t)sa->sa_len);
- cp += sa->sa_len;
- if (diff > 0) {
- (void)memset(cp, 0, (size_t)diff);
- cp += diff;
- }
- }
- len += dlen;
- }
- if (cp == NULL && w != NULL && !second_time) {
- struct rt_walkarg *rw = w;
-
- rw->w_needed += len;
- if (rw->w_needed <= 0 && rw->w_where) {
- if (rw->w_tmemsize < len) {
- if (rw->w_tmem)
- kmem_free(rw->w_tmem, rw->w_tmemsize);
- rw->w_tmem = kmem_zalloc(len, KM_SLEEP);
- rw->w_tmemsize = len;
- }
- if (rw->w_tmem) {
- cp = rw->w_tmem;
- second_time = 1;
- goto again;
- } else {
- rw->w_tmemneeded = len;
- return ENOBUFS;
- }
- }
- }
- if (cp) {
- struct rt_xmsghdr *rtm = (struct rt_xmsghdr *)cp0;
-
- rtm->rtm_version = RTM_XVERSION;
- rtm->rtm_type = type;
- rtm->rtm_msglen = len;
- }
- if (lenp)
- *lenp = len;
- return 0;
-}
-
-#ifndef COMPAT_RTSOCK
int
rt_msg3(int type, struct rt_addrinfo *rtinfo, void *cpv, struct rt_walkarg *w,
int *lenp)
{
return rt_msg2(type, rtinfo, cpv, w, lenp);
}
-#endif
-
-/*
- * This routine is called to generate a message from the routing
- * socket indicating that a redirect has occurred, a routing lookup
- * has failed, or that a protocol has detected timeouts to a particular
- * destination.
- */
-void
-COMPATNAME(rt_missmsg)(int type, const struct rt_addrinfo *rtinfo, int flags,
- int error)
-{
- struct rt_xmsghdr rtm;
- struct mbuf *m;
- const struct sockaddr *sa = rtinfo->rti_info[RTAX_DST];
- struct rt_addrinfo info = *rtinfo;
-
- COMPATCALL(rt_missmsg, (type, rtinfo, flags, error));
- if (COMPATNAME(route_info).ri_cb.any_count == 0)
- return;
- memset(&rtm, 0, sizeof(rtm));
- rtm.rtm_pid = curproc->p_pid;
- rtm.rtm_flags = RTF_DONE | flags;
- rtm.rtm_errno = error;
- m = COMPATNAME(rt_msg1)(type, &info, &rtm, sizeof(rtm));
- if (m == NULL)
- return;
- mtod(m, struct rt_xmsghdr *)->rtm_addrs = info.rti_addrs;
- COMPATNAME(route_enqueue)(m, sa ? sa->sa_family : 0);
-}
-/*
- * This routine is called to generate a message from the routing
- * socket indicating that the status of a network interface has changed.
- */
-void
-COMPATNAME(rt_ifmsg)(struct ifnet *ifp)
-{
- struct if_xmsghdr ifm;
- struct mbuf *m;
- struct rt_addrinfo info;
-
- COMPATCALL(rt_ifmsg, (ifp));
- if (COMPATNAME(route_info).ri_cb.any_count == 0)
- return;
- (void)memset(&info, 0, sizeof(info));
- (void)memset(&ifm, 0, sizeof(ifm));
- ifm.ifm_index = ifp->if_index;
- ifm.ifm_flags = ifp->if_flags;
- ifm.ifm_data = ifp->if_data;
- ifm.ifm_addrs = 0;
- m = COMPATNAME(rt_msg1)(RTM_IFINFO, &info, &ifm, sizeof(ifm));
- if (m == NULL)
- return;
- COMPATNAME(route_enqueue)(m, 0);
-#ifdef COMPAT_14
- compat_14_rt_oifmsg(ifp);
-#endif
-#ifdef COMPAT_50
- compat_50_rt_oifmsg(ifp);
-#endif
-}
-
-#ifndef COMPAT_RTSOCK
static int
if_addrflags(struct ifaddr *ifa)
{
@@ -1407,204 +140,9 @@ if_addrflags(struct ifaddr *ifa)
return 0;
}
}
-#endif
-/*
- * This is called to generate messages from the routing socket
- * indicating a network interface has had addresses associated with it.
- * if we ever reverse the logic and replace messages TO the routing
- * socket indicate a request to configure interfaces, then it will
- * be unnecessary as the routing socket will automatically generate
- * copies of it.
- */
-void
-COMPATNAME(rt_newaddrmsg)(int cmd, struct ifaddr *ifa, int error,
- struct rtentry *rt)
-{
-#define cmdpass(__cmd, __pass) (((__cmd) << 2) | (__pass))
- struct rt_addrinfo info;
- const struct sockaddr *sa;
- int pass;
- struct mbuf *m;
- struct ifnet *ifp;
- struct rt_xmsghdr rtm;
- struct ifa_xmsghdr ifam;
- int ncmd;
-
- KASSERT(ifa != NULL);
- KASSERT(ifa->ifa_addr != NULL);
- ifp = ifa->ifa_ifp;
-#ifdef SCTP
- if (cmd == RTM_ADD) {
- sctp_add_ip_address(ifa);
- } else if (cmd == RTM_DELETE) {
- sctp_delete_ip_address(ifa);
- }
-#endif
-
- COMPATCALL(rt_newaddrmsg, (cmd, ifa, error, rt));
- if (COMPATNAME(route_info).ri_cb.any_count == 0)
- return;
- for (pass = 1; pass < 3; pass++) {
- memset(&info, 0, sizeof(info));
- switch (cmdpass(cmd, pass)) {
- case cmdpass(RTM_ADD, 1):
- case cmdpass(RTM_CHANGE, 1):
- case cmdpass(RTM_DELETE, 2):
- case cmdpass(RTM_NEWADDR, 1):
- case cmdpass(RTM_DELADDR, 1):
- case cmdpass(RTM_CHGADDR, 1):
- switch (cmd) {
- case RTM_ADD:
- ncmd = RTM_XNEWADDR;
- break;
- case RTM_DELETE:
- ncmd = RTM_XDELADDR;
- break;
- case RTM_CHANGE:
- ncmd = RTM_XCHGADDR;
- break;
- case RTM_NEWADDR:
- ncmd = RTM_XNEWADDR;
- break;
- case RTM_DELADDR:
- ncmd = RTM_XDELADDR;
- break;
- case RTM_CHGADDR:
- ncmd = RTM_XCHGADDR;
- break;
- default:
- panic("%s: unknown command %d", __func__, cmd);
- }
-#ifdef COMPAT_70
- compat_70_rt_newaddrmsg1(ncmd, ifa);
-#endif
- info.rti_info[RTAX_IFA] = sa = ifa->ifa_addr;
- KASSERT(ifp->if_dl != NULL);
- info.rti_info[RTAX_IFP] = ifp->if_dl->ifa_addr;
- info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
- info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr;
- memset(&ifam, 0, sizeof(ifam));
- ifam.ifam_index = ifp->if_index;
- ifam.ifam_metric = ifa->ifa_metric;
- ifam.ifam_flags = ifa->ifa_flags;
-#ifndef COMPAT_RTSOCK
- ifam.ifam_pid = curproc->p_pid;
- ifam.ifam_addrflags = if_addrflags(ifa);
-#endif
- m = COMPATNAME(rt_msg1)(ncmd, &info, &ifam, sizeof(ifam));
- if (m == NULL)
- continue;
- mtod(m, struct ifa_xmsghdr *)->ifam_addrs =
- info.rti_addrs;
- break;
- case cmdpass(RTM_ADD, 2):
- case cmdpass(RTM_CHANGE, 2):
- case cmdpass(RTM_DELETE, 1):
- if (rt == NULL)
- continue;
- info.rti_info[RTAX_NETMASK] = rt_mask(rt);
- info.rti_info[RTAX_DST] = sa = rt_getkey(rt);
- info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
- memset(&rtm, 0, sizeof(rtm));
- rtm.rtm_pid = curproc->p_pid;
- rtm.rtm_index = ifp->if_index;
- rtm.rtm_flags |= rt->rt_flags;
- rtm.rtm_errno = error;
- m = COMPATNAME(rt_msg1)(cmd, &info, &rtm, sizeof(rtm));
- if (m == NULL)
- continue;
- mtod(m, struct rt_xmsghdr *)->rtm_addrs = info.rti_addrs;
- break;
- default:
- continue;
- }
- KASSERTMSG(m != NULL, "called with wrong command");
- COMPATNAME(route_enqueue)(m, sa ? sa->sa_family : 0);
- }
-#undef cmdpass
-
-}
-
-static struct mbuf *
-rt_makeifannouncemsg(struct ifnet *ifp, int type, int what,
- struct rt_addrinfo *info)
-{
- struct if_xannouncemsghdr ifan;
-
- memset(info, 0, sizeof(*info));
- memset(&ifan, 0, sizeof(ifan));
- ifan.ifan_index = ifp->if_index;
- strlcpy(ifan.ifan_name, ifp->if_xname, sizeof(ifan.ifan_name));
- ifan.ifan_what = what;
- return COMPATNAME(rt_msg1)(type, info, &ifan, sizeof(ifan));
-}
-
-/*
- * This is called to generate routing socket messages indicating
- * network interface arrival and departure.
- */
-void
-COMPATNAME(rt_ifannouncemsg)(struct ifnet *ifp, int what)
-{
- struct mbuf *m;
- struct rt_addrinfo info;
-
- COMPATCALL(rt_ifannouncemsg, (ifp, what));
- if (COMPATNAME(route_info).ri_cb.any_count == 0)
- return;
- m = rt_makeifannouncemsg(ifp, RTM_IFANNOUNCE, what, &info);
- if (m == NULL)
- return;
- COMPATNAME(route_enqueue)(m, 0);
-}
/*
- * This is called to generate routing socket messages indicating
- * IEEE80211 wireless events.
- * XXX we piggyback on the RTM_IFANNOUNCE msg format in a clumsy way.
- */
-void
-COMPATNAME(rt_ieee80211msg)(struct ifnet *ifp, int what, void *data,
- size_t data_len)
-{
- struct mbuf *m;
- struct rt_addrinfo info;
-
- COMPATCALL(rt_ieee80211msg, (ifp, what, data, data_len));
- if (COMPATNAME(route_info).ri_cb.any_count == 0)
- return;
- m = rt_makeifannouncemsg(ifp, RTM_IEEE80211, what, &info);
- if (m == NULL)
- return;
- /*
- * Append the ieee80211 data. Try to stick it in the
- * mbuf containing the ifannounce msg; otherwise allocate
- * a new mbuf and append.
- *
- * NB: we assume m is a single mbuf.
- */
- if (data_len > M_TRAILINGSPACE(m)) {
- struct mbuf *n = m_get(M_NOWAIT, MT_DATA);
- if (n == NULL) {
- m_freem(m);
- return;
- }
- (void)memcpy(mtod(n, void *), data, data_len);
- n->m_len = data_len;
- m->m_next = n;
- } else if (data_len > 0) {
- (void)memcpy(mtod(m, uint8_t *) + m->m_len, data, data_len);
- m->m_len += data_len;
- }
- if (m->m_flags & M_PKTHDR)
- m->m_pkthdr.len += data_len;
- mtod(m, struct if_xannouncemsghdr *)->ifan_msglen += data_len;
- COMPATNAME(route_enqueue)(m, 0);
-}
-
-#ifndef COMPAT_RTSOCK
-/*
* Send a routing message as mimicing that a cloned route is added.
*/
void
@@ -1637,7 +175,12 @@ rt_clonedmsg(const struct sockaddr *dst, const struct ifnet *ifp,
#undef RTF_LLINFO
#undef RTF_CLONED
}
-#endif /* COMPAT_RTSOCK */
+
+
+/*
+ * The remaining code implements the routing-table sysctl node. It is
+ * compiled only for the non-COMPAT case.
+ */
/*
* This is used in dumping the kernel table via sysctl().
@@ -1721,10 +264,8 @@ sysctl_iflist_addr(struct rt_walkarg *w, struct ifaddr *ifa,
ifam->ifam_flags = ifa->ifa_flags;
ifam->ifam_metric = ifa->ifa_metric;
ifam->ifam_addrs = info->rti_addrs;
-#ifndef COMPAT_RTSOCK
ifam->ifam_pid = 0;
ifam->ifam_addrflags = if_addrflags(ifa);
-#endif
if ((error = copyout(w->w_tmem, w->w_where, len)) == 0)
w->w_where = (char *)w->w_where + len;
}
@@ -1738,10 +279,6 @@ sysctl_iflist(int af, struct rt_walkarg *w, int type)
struct ifaddr *ifa;
struct rt_addrinfo info;
int cmd, len, error = 0;
- int (*iflist_if)(struct ifnet *, struct rt_walkarg *,
- struct rt_addrinfo *, size_t);
- int (*iflist_addr)(struct rt_walkarg *, struct ifaddr *,
- struct rt_addrinfo *);
int s;
struct psref psref;
int bound;
@@ -1749,30 +286,16 @@ sysctl_iflist(int af, struct rt_walkarg *w, int type)
switch (type) {
case NET_RT_IFLIST:
cmd = RTM_IFINFO;
- iflist_if = sysctl_iflist_if;
- iflist_addr = sysctl_iflist_addr;
break;
-#ifdef COMPAT_14
case NET_RT_OOOIFLIST:
cmd = RTM_OOIFINFO;
- iflist_if = compat_14_iflist;
- iflist_addr = compat_70_iflist_addr;
break;
-#endif
-#ifdef COMPAT_50
case NET_RT_OOIFLIST:
cmd = RTM_OIFINFO;
- iflist_if = compat_50_iflist;
- iflist_addr = compat_70_iflist_addr;
break;
-#endif
-#ifdef COMPAT_70
case NET_RT_OIFLIST:
cmd = RTM_IFINFO;
- iflist_if = sysctl_iflist_if;
- iflist_addr = compat_70_iflist_addr;
break;
-#endif
default:
#ifdef RTSOCK_DEBUG
printf("%s: unsupported IFLIST type %d\n", __func__, type);
@@ -1799,8 +322,32 @@ sysctl_iflist(int af, struct rt_walkarg *w, int type)
goto release_exit;
info.rti_info[RTAX_IFP] = NULL;
if (w->w_where && w->w_tmem && w->w_needed <= 0) {
- if ((error = iflist_if(ifp, w, &info, len)) != 0)
+ switch (type) {
+ case NET_RT_OIFLIST: /* old _70 */
+ if (!rtsock_70_iflist_hook.hooked) {
+ error = EINVAL;
+ break;
+ }
+ /* FALLTHROUGH */
+ case NET_RT_IFLIST: /* current */
+ error = sysctl_iflist_if(ifp, w, &info, len);
+ break;
+ case NET_RT_OOIFLIST: /* old _50 */
+ MODULE_CALL_HOOK(rtsock_50_iflist_hook,
+ (ifp, w, &info, len), enosys(), error);
+ break;
+ case NET_RT_OOOIFLIST: /* old _14 */
+ MODULE_CALL_HOOK(rtsock_14_iflist_hook,
+ (ifp, w, &info, len), enosys(), error);
+ break;
+ default:
+ error = EINVAL;
+ }
+ if (error != 0) {
+ if (error == ENOSYS)
+ error = EINVAL;
goto release_exit;
+ }
}
_s = pserialize_read_enter();
IFADDR_READER_FOREACH(ifa, ifp) {
@@ -1813,7 +360,19 @@ sysctl_iflist(int af, struct rt_walkarg *w, int type)
info.rti_info[RTAX_IFA] = ifa->ifa_addr;
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr;
- error = iflist_addr(w, ifa, &info);
+ switch (type) {
+ case NET_RT_IFLIST:
+ error = sysctl_iflist_addr(w, ifa, &info);
+ break;
+ case NET_RT_OIFLIST:
+ case NET_RT_OOIFLIST:
+ case NET_RT_OOOIFLIST:
+ MODULE_CALL_HOOK(rtsock_70_iflist_hook,
+ (w, ifa, &info), enosys(), error);
+ break;
+ default:
+ error = EINVAL;
+ }
_s = pserialize_read_enter();
ifa_release(ifa, &_psref);
@@ -1911,22 +470,10 @@ again:
}
break;
-#ifdef COMPAT_14
- case NET_RT_OOOIFLIST:
- error = sysctl_iflist(af, &w, w.w_op);
- break;
-#endif
-#ifdef COMPAT_50
- case NET_RT_OOIFLIST:
- error = sysctl_iflist(af, &w, w.w_op);
- break;
-#endif
-#ifdef COMPAT_70
- case NET_RT_OIFLIST:
- error = sysctl_iflist(af, &w, w.w_op);
- break;
-#endif
- case NET_RT_IFLIST:
+ case NET_RT_OOOIFLIST: /* compat_14 */
+ case NET_RT_OOIFLIST: /* compat_50 */
+ case NET_RT_OIFLIST: /* compat_70 */
+ case NET_RT_IFLIST: /* current */
error = sysctl_iflist(af, &w, w.w_op);
break;
}
@@ -1949,136 +496,6 @@ again:
return error;
}
-/*
- * Routing message software interrupt routine
- */
-static void
-COMPATNAME(route_intr)(void *cookie)
-{
- struct sockproto proto = { .sp_family = PF_XROUTE, };
- struct route_info * const ri = &COMPATNAME(route_info);
- struct mbuf *m;
-
- SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
- for (;;) {
- IFQ_LOCK(&ri->ri_intrq);
- IF_DEQUEUE(&ri->ri_intrq, m);
- IFQ_UNLOCK(&ri->ri_intrq);
- if (m == NULL)
- break;
- proto.sp_protocol = M_GETCTX(m, uintptr_t);
-#ifdef NET_MPSAFE
- mutex_enter(rt_so_mtx);
-#endif
- raw_input(m, &proto, &ri->ri_src, &ri->ri_dst, &rt_rawcb);
-#ifdef NET_MPSAFE
- mutex_exit(rt_so_mtx);
-#endif
- }
- SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
-}
-
-/*
- * Enqueue a message to the software interrupt routine.
- */
-void
-COMPATNAME(route_enqueue)(struct mbuf *m, int family)
-{
- struct route_info * const ri = &COMPATNAME(route_info);
- int wasempty;
-
- IFQ_LOCK(&ri->ri_intrq);
- if (IF_QFULL(&ri->ri_intrq)) {
- printf("%s: queue full, dropped message\n", __func__);
- IF_DROP(&ri->ri_intrq);
- IFQ_UNLOCK(&ri->ri_intrq);
- m_freem(m);
- } else {
- wasempty = IF_IS_EMPTY(&ri->ri_intrq);
- M_SETCTX(m, (uintptr_t)family);
- IF_ENQUEUE(&ri->ri_intrq, m);
- IFQ_UNLOCK(&ri->ri_intrq);
- if (wasempty) {
- kpreempt_disable();
- softint_schedule(ri->ri_sih);
- kpreempt_enable();
- }
- }
-}
-
-static void
-COMPATNAME(route_init)(void)
-{
- struct route_info * const ri = &COMPATNAME(route_info);
-
-#ifndef COMPAT_RTSOCK
- rt_init();
-#endif
-#ifdef NET_MPSAFE
- rt_so_mtx = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
-
- cv_init(&rt_update_cv, "rtsock_cv");
-#endif
-
- sysctl_net_route_setup(NULL);
- ri->ri_intrq.ifq_maxlen = ri->ri_maxqlen;
- ri->ri_sih = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
- COMPATNAME(route_intr), NULL);
- IFQ_LOCK_INIT(&ri->ri_intrq);
-}
-
-/*
- * Definitions of protocols supported in the ROUTE domain.
- */
-#ifndef COMPAT_RTSOCK
-PR_WRAP_USRREQS(route);
-#else
-PR_WRAP_USRREQS(compat_50_route);
-#endif
-
-static const struct pr_usrreqs route_usrreqs = {
- .pr_attach = COMPATNAME(route_attach_wrapper),
- .pr_detach = COMPATNAME(route_detach_wrapper),
- .pr_accept = COMPATNAME(route_accept_wrapper),
- .pr_bind = COMPATNAME(route_bind_wrapper),
- .pr_listen = COMPATNAME(route_listen_wrapper),
- .pr_connect = COMPATNAME(route_connect_wrapper),
- .pr_connect2 = COMPATNAME(route_connect2_wrapper),
- .pr_disconnect = COMPATNAME(route_disconnect_wrapper),
- .pr_shutdown = COMPATNAME(route_shutdown_wrapper),
- .pr_abort = COMPATNAME(route_abort_wrapper),
- .pr_ioctl = COMPATNAME(route_ioctl_wrapper),
- .pr_stat = COMPATNAME(route_stat_wrapper),
- .pr_peeraddr = COMPATNAME(route_peeraddr_wrapper),
- .pr_sockaddr = COMPATNAME(route_sockaddr_wrapper),
- .pr_rcvd = COMPATNAME(route_rcvd_wrapper),
- .pr_recvoob = COMPATNAME(route_recvoob_wrapper),
- .pr_send = COMPATNAME(route_send_wrapper),
- .pr_sendoob = COMPATNAME(route_sendoob_wrapper),
- .pr_purgeif = COMPATNAME(route_purgeif_wrapper),
-};
-
-static const struct protosw COMPATNAME(route_protosw)[] = {
- {
- .pr_type = SOCK_RAW,
- .pr_domain = &COMPATNAME(routedomain),
- .pr_flags = PR_ATOMIC|PR_ADDR,
- .pr_ctlinput = raw_ctlinput,
- .pr_ctloutput = route_ctloutput,
- .pr_usrreqs = &route_usrreqs,
- .pr_init = rt_pr_init,
- },
-};
-
-struct domain COMPATNAME(routedomain) = {
- .dom_family = PF_XROUTE,
- .dom_name = DOMAINNAME,
- .dom_init = COMPATNAME(route_init),
- .dom_protosw = COMPATNAME(route_protosw),
- .dom_protoswNPROTOSW =
- &COMPATNAME(route_protosw)[__arraycount(COMPATNAME(route_protosw))],
-};
-
static void
sysctl_net_route_setup(struct sysctllog **clog)
{
diff --git a/sys/net/rtsock_shared.c b/sys/net/rtsock_shared.c
new file mode 100644
index 00000000000..87ef2cd55d5
--- /dev/null
+++ b/sys/net/rtsock_shared.c
@@ -0,0 +1,1677 @@
+/* $NetBSD: rtsock_shared.c,v 1.2 2019/01/27 02:08:48 pgoyette Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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 project 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 PROJECT 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 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.
+ */
+
+/*
+ * Copyright (c) 1988, 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.
+ *
+ * @(#)rtsock.c 8.7 (Berkeley) 10/12/95
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.2 2019/01/27 02:08:48 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_inet.h"
+#include "opt_net_mpsafe.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/domain.h>
+#include <sys/protosw.h>
+#include <sys/sysctl.h>
+#include <sys/kauth.h>
+#include <sys/kmem.h>
+#include <sys/intr.h>
+#include <sys/condvar.h>
+#include <sys/compat_stub.h>
+
+#include <net/if.h>
+#include <net/if_llatbl.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <net/raw_cb.h>
+
+#include <netinet/in_var.h>
+#include <netinet/if_inarp.h>
+
+#include <netmpls/mpls.h>
+
+#include <compat/net/if.h>
+#include <compat/net/route.h>
+
+#ifdef COMPAT_RTSOCK
+/*
+ * These are used when #include-d from compat/common/rtsock_50.c
+ */
+#define RTM_XVERSION RTM_OVERSION
+#define RTM_XNEWADDR RTM_ONEWADDR
+#define RTM_XDELADDR RTM_ODELADDR
+#define RTM_XCHGADDR RTM_OCHGADDR
+#define RT_XADVANCE(a,b) RT_OADVANCE(a,b)
+#define RT_XROUNDUP(n) RT_OROUNDUP(n)
+#define PF_XROUTE PF_OROUTE
+#define rt_xmsghdr rt_msghdr50
+#define if_xmsghdr if_msghdr /* if_msghdr50 is for RTM_OIFINFO */
+#define ifa_xmsghdr ifa_msghdr50
+#define if_xannouncemsghdr if_announcemsghdr50
+#define COMPATNAME(x) compat_50_ ## x
+#define DOMAINNAME "oroute"
+#define COMPATCALL(name, args) \
+ MODULE_CALL_VOID_HOOK(rtsock_50_ ## name ## _hook, args, __nothing);
+#define RTS_CTASSERT(x) __nothing
+CTASSERT(sizeof(struct ifa_xmsghdr) == 20);
+DOMAIN_DEFINE(compat_50_routedomain); /* forward declare and add to link set */
+#else /* COMPAT_RTSOCK */
+/*
+ * These are used when #include-d from compat/common/rtsock_50.c
+ */
+#define RTM_XVERSION RTM_VERSION
+#define RTM_XNEWADDR RTM_NEWADDR
+#define RTM_XDELADDR RTM_DELADDR
+#define RTM_XCHGADDR RTM_CHGADDR
+#define RT_XADVANCE(a,b) RT_ADVANCE(a,b)
+#define RT_XROUNDUP(n) RT_ROUNDUP(n)
+#define PF_XROUTE PF_ROUTE
+#define rt_xmsghdr rt_msghdr
+#define if_xmsghdr if_msghdr
+#define ifa_xmsghdr ifa_msghdr
+#define if_xannouncemsghdr if_announcemsghdr
+#define COMPATNAME(x) x
+#define DOMAINNAME "route"
+#define COMPATCALL(name, args) __nothing;
+#define RTS_CTASSERT(x) CTASSERT(x)
+CTASSERT(sizeof(struct ifa_xmsghdr) == 32);
+DOMAIN_DEFINE(routedomain); /* forward declare and add to link set */
+#endif /* COMPAT_RTSOCK */
+
+#ifdef RTSOCK_DEBUG
+#define RT_IN_PRINT(info, b, a) (in_print((b), sizeof(b), \
+ &((const struct sockaddr_in *)(info)->rti_info[(a)])->sin_addr), (b))
+#endif /* RTSOCK_DEBUG */
+
+struct route_info COMPATNAME(route_info) = {
+ .ri_dst = { .sa_len = 2, .sa_family = PF_XROUTE, },
+ .ri_src = { .sa_len = 2, .sa_family = PF_XROUTE, },
+ .ri_maxqlen = IFQ_MAXLEN,
+};
+
+static void COMPATNAME(route_init)(void);
+static int COMPATNAME(route_output)(struct mbuf *, struct socket *);
+
+static int rt_xaddrs(u_char, const char *, const char *, struct rt_addrinfo *);
+static struct mbuf *rt_makeifannouncemsg(struct ifnet *, int, int,
+ struct rt_addrinfo *);
+static int rt_msg2(int, struct rt_addrinfo *, void *, struct rt_walkarg *, int *);
+static void _rt_setmetrics(int, const struct rt_xmsghdr *, struct rtentry *);
+static void rtm_setmetrics(const struct rtentry *, struct rt_xmsghdr *);
+static void rt_adjustcount(int, int);
+
+static const struct protosw COMPATNAME(route_protosw)[];
+
+struct routecb {
+ struct rawcb rocb_rcb;
+ unsigned int rocb_msgfilter;
+#define RTMSGFILTER(m) (1U << (m))
+};
+#define sotoroutecb(so) ((struct routecb *)(so)->so_pcb)
+
+static struct rawcbhead rt_rawcb;
+#ifdef NET_MPSAFE
+static kmutex_t *rt_so_mtx;
+
+static bool rt_updating = false;
+static kcondvar_t rt_update_cv;
+#endif
+
+static void
+rt_adjustcount(int af, int cnt)
+{
+ struct route_cb * const cb = &COMPATNAME(route_info).ri_cb;
+
+ cb->any_count += cnt;
+
+ switch (af) {
+ case AF_INET:
+ cb->ip_count += cnt;
+ return;
+#ifdef INET6
+ case AF_INET6:
+ cb->ip6_count += cnt;
+ return;
+#endif
+ case AF_MPLS:
+ cb->mpls_count += cnt;
+ return;
+ }
+}
+
+static int
+COMPATNAME(route_filter)(struct mbuf *m, struct sockproto *proto,
+ struct rawcb *rp)
+{
+ struct routecb *rop = (struct routecb *)rp;
+ struct rt_xmsghdr *rtm;
+
+ KASSERT(m != NULL);
+ KASSERT(proto != NULL);
+ KASSERT(rp != NULL);
+
+ /* Wrong family for this socket. */
+ if (proto->sp_family != PF_ROUTE)
+ return ENOPROTOOPT;
+
+ /* If no filter set, just return. */
+ if (rop->rocb_msgfilter == 0)
+ return 0;
+
+ /* Ensure we can access rtm_type */
+ if (m->m_len <
+ offsetof(struct rt_xmsghdr, rtm_type) + sizeof(rtm->rtm_type))
+ return EINVAL;
+
+ rtm = mtod(m, struct rt_xmsghdr *);
+ /* If the rtm type is filtered out, return a positive. */
+ if (!(rop->rocb_msgfilter & RTMSGFILTER(rtm->rtm_type)))
+ return EEXIST;
+
+ /* Passed the filter. */
+ return 0;
+}
+
+static void
+rt_pr_init(void)
+{
+
+ LIST_INIT(&rt_rawcb);
+}
+
+static int
+COMPATNAME(route_attach)(struct socket *so, int proto)
+{
+ struct rawcb *rp;
+ struct routecb *rop;
+ int s, error;
+
+ KASSERT(sotorawcb(so) == NULL);
+ rop = kmem_zalloc(sizeof(*rop), KM_SLEEP);
+ rp = &rop->rocb_rcb;
+ rp->rcb_len = sizeof(*rop);
+ so->so_pcb = rp;
+
+ s = splsoftnet();
+
+#ifdef NET_MPSAFE
+ KASSERT(so->so_lock == NULL);
+ mutex_obj_hold(rt_so_mtx);
+ so->so_lock = rt_so_mtx;
+ solock(so);
+#endif
+
+ if ((error = raw_attach(so, proto, &rt_rawcb)) == 0) {
+ rt_adjustcount(rp->rcb_proto.sp_protocol, 1);
+ rp->rcb_laddr = &COMPATNAME(route_info).ri_src;
+ rp->rcb_faddr = &COMPATNAME(route_info).ri_dst;
+ rp->rcb_filter = COMPATNAME(route_filter);
+ }
+ splx(s);
+
+ if (error) {
+ kmem_free(rop, sizeof(*rop));
+ so->so_pcb = NULL;
+ return error;
+ }
+
+ soisconnected(so);
+ so->so_options |= SO_USELOOPBACK;
+ KASSERT(solocked(so));
+
+ return error;
+}
+
+static void
+COMPATNAME(route_detach)(struct socket *so)
+{
+ struct rawcb *rp = sotorawcb(so);
+ int s;
+
+ KASSERT(rp != NULL);
+ KASSERT(solocked(so));
+
+ s = splsoftnet();
+ rt_adjustcount(rp->rcb_proto.sp_protocol, -1);
+ raw_detach(so);
+ splx(s);
+}
+
+static int
+COMPATNAME(route_accept)(struct socket *so, struct sockaddr *nam)
+{
+ KASSERT(solocked(so));
+
+ panic("route_accept");
+
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_bind)(struct socket *so, struct sockaddr *nam, struct lwp *l)
+{
+ KASSERT(solocked(so));
+
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_listen)(struct socket *so, struct lwp *l)
+{
+ KASSERT(solocked(so));
+
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_connect)(struct socket *so, struct sockaddr *nam, struct lwp *l)
+{
+ KASSERT(solocked(so));
+
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_connect2)(struct socket *so, struct socket *so2)
+{
+ KASSERT(solocked(so));
+
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_disconnect)(struct socket *so)
+{
+ struct rawcb *rp = sotorawcb(so);
+ int s;
+
+ KASSERT(solocked(so));
+ KASSERT(rp != NULL);
+
+ s = splsoftnet();
+ soisdisconnected(so);
+ raw_disconnect(rp);
+ splx(s);
+
+ return 0;
+}
+
+static int
+COMPATNAME(route_shutdown)(struct socket *so)
+{
+ int s;
+
+ KASSERT(solocked(so));
+
+ /*
+ * Mark the connection as being incapable of further input.
+ */
+ s = splsoftnet();
+ socantsendmore(so);
+ splx(s);
+ return 0;
+}
+
+static int
+COMPATNAME(route_abort)(struct socket *so)
+{
+ KASSERT(solocked(so));
+
+ panic("route_abort");
+
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_ioctl)(struct socket *so, u_long cmd, void *nam,
+ struct ifnet * ifp)
+{
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_stat)(struct socket *so, struct stat *ub)
+{
+ KASSERT(solocked(so));
+
+ return 0;
+}
+
+static int
+COMPATNAME(route_peeraddr)(struct socket *so, struct sockaddr *nam)
+{
+ struct rawcb *rp = sotorawcb(so);
+
+ KASSERT(solocked(so));
+ KASSERT(rp != NULL);
+ KASSERT(nam != NULL);
+
+ if (rp->rcb_faddr == NULL)
+ return ENOTCONN;
+
+ raw_setpeeraddr(rp, nam);
+ return 0;
+}
+
+static int
+COMPATNAME(route_sockaddr)(struct socket *so, struct sockaddr *nam)
+{
+ struct rawcb *rp = sotorawcb(so);
+
+ KASSERT(solocked(so));
+ KASSERT(rp != NULL);
+ KASSERT(nam != NULL);
+
+ if (rp->rcb_faddr == NULL)
+ return ENOTCONN;
+
+ raw_setsockaddr(rp, nam);
+ return 0;
+}
+
+static int
+COMPATNAME(route_rcvd)(struct socket *so, int flags, struct lwp *l)
+{
+ KASSERT(solocked(so));
+
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_recvoob)(struct socket *so, struct mbuf *m, int flags)
+{
+ KASSERT(solocked(so));
+
+ return EOPNOTSUPP;
+}
+
+static int
+COMPATNAME(route_send)(struct socket *so, struct mbuf *m,
+ struct sockaddr *nam, struct mbuf *control, struct lwp *l)
+{
+ int error = 0;
+ int s;
+
+ KASSERT(solocked(so));
+ KASSERT(so->so_proto == &COMPATNAME(route_protosw)[0]);
+
+ s = splsoftnet();
+ error = raw_send(so, m, nam, control, l, &COMPATNAME(route_output));
+ splx(s);
+
+ return error;
+}
+
+static int
+COMPATNAME(route_sendoob)(struct socket *so, struct mbuf *m,
+ struct mbuf *control)
+{
+ KASSERT(solocked(so));
+
+ m_freem(m);
+ m_freem(control);
+
+ return EOPNOTSUPP;
+}
+static int
+COMPATNAME(route_purgeif)(struct socket *so, struct ifnet *ifp)
+{
+
+ panic("route_purgeif");
+
+ return EOPNOTSUPP;
+}
+
+#if defined(INET) || defined(INET6)
+static int
+route_get_sdl_index(struct rt_addrinfo *info, int *sdl_index)
+{
+ struct rtentry *nrt;
+ int error;
+
+ error = rtrequest1(RTM_GET, info, &nrt);
+ if (error != 0)
+ return error;
+ /*
+ * nrt->rt_ifp->if_index may not be correct
+ * due to changing to ifplo0.
+ */
+ *sdl_index = satosdl(nrt->rt_gateway)->sdl_index;
+ rt_unref(nrt);
+
+ return 0;
+}
+#endif
+
+static void
+route_get_sdl(const struct ifnet *ifp, const struct sockaddr *dst,
+ struct sockaddr_dl *sdl, int *flags)
+{
+ struct llentry *la;
+
+ KASSERT(ifp != NULL);
+
+ IF_AFDATA_RLOCK(ifp);
+ switch (dst->sa_family) {
+ case AF_INET:
+ la = lla_lookup(LLTABLE(ifp), 0, dst);
+ break;
+ case AF_INET6:
+ la = lla_lookup(LLTABLE6(ifp), 0, dst);
+ break;
+ default:
+ la = NULL;
+ KASSERTMSG(0, "Invalid AF=%d\n", dst->sa_family);
+ break;
+ }
+ IF_AFDATA_RUNLOCK(ifp);
+
+ void *a = (LLE_IS_VALID(la) && (la->la_flags & LLE_VALID) == LLE_VALID)
+ ? &la->ll_addr : NULL;
+
+ a = sockaddr_dl_init(sdl, sizeof(*sdl), ifp->if_index, ifp->if_type,
+ NULL, 0, a, ifp->if_addrlen);
+ KASSERT(a != NULL);
+
+ if (la != NULL) {
+ *flags = la->la_flags;
+ LLE_RUNLOCK(la);
+ }
+}
+
+static int
+route_output_report(struct rtentry *rt, struct rt_addrinfo *info,
+ struct rt_xmsghdr *rtm, struct rt_xmsghdr **new_rtm)
+{
+ int len;
+
+ if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) {
+ const struct ifaddr *rtifa;
+ const struct ifnet *ifp = rt->rt_ifp;
+
+ info->rti_info[RTAX_IFP] = ifp->if_dl->ifa_addr;
+ /* rtifa used to be simply rt->rt_ifa.
+ * If rt->rt_ifa != NULL, then
+ * rt_get_ifa() != NULL. So this
+ * ought to still be safe. --dyoung
+ */
+ rtifa = rt_get_ifa(rt);
+ info->rti_info[RTAX_IFA] = rtifa->ifa_addr;
+#ifdef RTSOCK_DEBUG
+ if (info->rti_info[RTAX_IFA]->sa_family == AF_INET) {
+ char ibuf[INET_ADDRSTRLEN];
+ char abuf[INET_ADDRSTRLEN];
+ printf("%s: copying out RTAX_IFA %s "
+ "for info->rti_info[RTAX_DST] %s "
+ "ifa_getifa %p ifa_seqno %p\n",
+ __func__,
+ RT_IN_PRINT(info, ibuf, RTAX_IFA),
+ RT_IN_PRINT(info, abuf, RTAX_DST),
+ (void *)rtifa->ifa_getifa,
+ rtifa->ifa_seqno);
+ }
+#endif /* RTSOCK_DEBUG */
+ if (ifp->if_flags & IFF_POINTOPOINT)
+ info->rti_info[RTAX_BRD] = rtifa->ifa_dstaddr;
+ else
+ info->rti_info[RTAX_BRD] = NULL;
+ rtm->rtm_index = ifp->if_index;
+ }
+ (void)rt_msg2(rtm->rtm_type, info, NULL, NULL, &len);
+ if (len > rtm->rtm_msglen) {
+ struct rt_xmsghdr *old_rtm = rtm;
+ R_Malloc(*new_rtm, struct rt_xmsghdr *, len);
+ if (*new_rtm == NULL)
+ return ENOBUFS;
+ (void)memcpy(*new_rtm, old_rtm, old_rtm->rtm_msglen);
+ rtm = *new_rtm;
+ }
+ (void)rt_msg2(rtm->rtm_type, info, rtm, NULL, 0);
+ rtm->rtm_flags = rt->rt_flags;
+ rtm_setmetrics(rt, rtm);
+ rtm->rtm_addrs = info->rti_addrs;
+
+ return 0;
+}
+
+/*ARGSUSED*/
+int
+COMPATNAME(route_output)(struct mbuf *m, struct socket *so)
+{
+ struct sockproto proto = { .sp_family = PF_XROUTE, };
+ struct rt_xmsghdr *rtm = NULL;
+ struct rt_xmsghdr *old_rtm = NULL, *new_rtm = NULL;
+ struct rtentry *rt = NULL;
+ struct rtentry *saved_nrt = NULL;
+ struct rt_addrinfo info;
+ int len, error = 0;
+ sa_family_t family;
+ struct sockaddr_dl sdl;
+ int bound = curlwp_bind();
+ bool do_rt_free = false;
+ struct sockaddr_storage netmask;
+
+#define senderr(e) do { error = e; goto flush;} while (/*CONSTCOND*/ 0)
+ if (m == NULL || ((m->m_len < sizeof(int32_t)) &&
+ (m = m_pullup(m, sizeof(int32_t))) == NULL)) {
+ error = ENOBUFS;
+ goto out;
+ }
+ if ((m->m_flags & M_PKTHDR) == 0)
+ panic("%s", __func__);
+ len = m->m_pkthdr.len;
+ if (len < sizeof(*rtm) ||
+ len != mtod(m, struct rt_xmsghdr *)->rtm_msglen) {
+ info.rti_info[RTAX_DST] = NULL;
+ senderr(EINVAL);
+ }
+ R_Malloc(rtm, struct rt_xmsghdr *, len);
+ if (rtm == NULL) {
+ info.rti_info[RTAX_DST] = NULL;
+ senderr(ENOBUFS);
+ }
+ m_copydata(m, 0, len, rtm);
+ if (rtm->rtm_version != RTM_XVERSION) {
+ info.rti_info[RTAX_DST] = NULL;
+ senderr(EPROTONOSUPPORT);
+ }
+ rtm->rtm_pid = curproc->p_pid;
+ memset(&info, 0, sizeof(info));
+ info.rti_addrs = rtm->rtm_addrs;
+ if (rt_xaddrs(rtm->rtm_type, (const char *)(rtm + 1), len + (char *)rtm,
+ &info)) {
+ senderr(EINVAL);
+ }
+ info.rti_flags = rtm->rtm_flags;
+#ifdef RTSOCK_DEBUG
+ if (info.rti_info[RTAX_DST]->sa_family == AF_INET) {
+ char abuf[INET_ADDRSTRLEN];
+ printf("%s: extracted info.rti_info[RTAX_DST] %s\n", __func__,
+ RT_IN_PRINT(&info, abuf, RTAX_DST));
+ }
+#endif /* RTSOCK_DEBUG */
+ if (info.rti_info[RTAX_DST] == NULL ||
+ (info.rti_info[RTAX_DST]->sa_family >= AF_MAX)) {
+ senderr(EINVAL);
+ }
+ if (info.rti_info[RTAX_GATEWAY] != NULL &&
+ (info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) {
+ senderr(EINVAL);
+ }
+
+ /*
+ * Verify that the caller has the appropriate privilege; RTM_GET
+ * is the only operation the non-superuser is allowed.
+ */
+ if (kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_ROUTE,
+ 0, rtm, NULL, NULL) != 0)
+ senderr(EACCES);
+
+ /*
+ * route(8) passes a sockaddr truncated with prefixlen.
+ * The kernel doesn't expect such sockaddr and need to
+ * use a buffer that is big enough for the sockaddr expected
+ * (padded with 0's). We keep the original length of the sockaddr.
+ */
+ if (info.rti_info[RTAX_NETMASK]) {
+ /*
+ * Use the family of RTAX_DST, because RTAX_NETMASK
+ * can have a zero family if it comes from the radix
+ * tree via rt_mask().
+ */
+ socklen_t sa_len = sockaddr_getsize_by_family(
+ info.rti_info[RTAX_DST]->sa_family);
+ socklen_t masklen = sockaddr_getlen(
+ info.rti_info[RTAX_NETMASK]);
+ if (sa_len != 0 && sa_len > masklen) {
+ KASSERT(sa_len <= sizeof(netmask));
+ memcpy(&netmask, info.rti_info[RTAX_NETMASK], masklen);
+ memset((char *)&netmask + masklen, 0, sa_len - masklen);
+ info.rti_info[RTAX_NETMASK] = sstocsa(&netmask);
+ }
+ }
+
+ switch (rtm->rtm_type) {
+
+ case RTM_ADD:
+ if (info.rti_info[RTAX_GATEWAY] == NULL) {
+ senderr(EINVAL);
+ }
+#if defined(INET) || defined(INET6)
+ /* support for new ARP/NDP code with keeping backcompat */
+ if (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) {
+ const struct sockaddr_dl *sdlp =
+ satocsdl(info.rti_info[RTAX_GATEWAY]);
+
+ /* Allow routing requests by interface index */
+ if (sdlp->sdl_nlen == 0 && sdlp->sdl_alen == 0
+ && sdlp->sdl_slen == 0)
+ goto fallback;
+ /*
+ * Old arp binaries don't set the sdl_index
+ * so we have to complement it.
+ */
+ int sdl_index = sdlp->sdl_index;
+ if (sdl_index == 0) {
+ error = route_get_sdl_index(&info, &sdl_index);
+ if (error != 0)
+ goto fallback;
+ } else if (
+ info.rti_info[RTAX_DST]->sa_family == AF_INET) {
+ /*
+ * XXX workaround for SIN_PROXY case; proxy arp
+ * entry should be in an interface that has
+ * a network route including the destination,
+ * not a local (link) route that may not be a
+ * desired place, for example a tap.
+ */
+ const struct sockaddr_inarp *sina =
+ (const struct sockaddr_inarp *)
+ info.rti_info[RTAX_DST];
+ if (sina->sin_other & SIN_PROXY) {
+ error = route_get_sdl_index(&info,
+ &sdl_index);
+ if (error != 0)
+ goto fallback;
+ }
+ }
+ error = lla_rt_output(rtm->rtm_type, rtm->rtm_flags,
+ rtm->rtm_rmx.rmx_expire, &info, sdl_index);
+ break;
+ }
+ fallback:
+#endif /* defined(INET) || defined(INET6) */
+ error = rtrequest1(rtm->rtm_type, &info, &saved_nrt);
+ if (error == 0) {
+ _rt_setmetrics(rtm->rtm_inits, rtm, saved_nrt);
+ rt_unref(saved_nrt);
+ }
+ break;
+
+ case RTM_DELETE:
+#if defined(INET) || defined(INET6)
+ /* support for new ARP/NDP code */
+ if (info.rti_info[RTAX_GATEWAY] &&
+ (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) &&
+ (rtm->rtm_flags & RTF_LLDATA) != 0) {
+ const struct sockaddr_dl *sdlp =
+ satocsdl(info.rti_info[RTAX_GATEWAY]);
+ error = lla_rt_output(rtm->rtm_type, rtm->rtm_flags,
+ rtm->rtm_rmx.rmx_expire, &info, sdlp->sdl_index);
+ rtm->rtm_flags &= ~RTF_UP;
+ break;
+ }
+#endif
+ error = rtrequest1(rtm->rtm_type, &info, &saved_nrt);
+ if (error != 0)
+ break;
+
+ rt = saved_nrt;
+ do_rt_free = true;
+ info.rti_info[RTAX_DST] = rt_getkey(rt);
+ info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
+ info.rti_info[RTAX_NETMASK] = rt_mask(rt);
+ info.rti_info[RTAX_TAG] = rt_gettag(rt);
+ error = route_output_report(rt, &info, rtm, &new_rtm);
+ if (error)
+ senderr(error);
+ if (new_rtm != NULL) {
+ old_rtm = rtm;
+ rtm = new_rtm;
+ }
+ break;
+
+ case RTM_GET:
+ case RTM_CHANGE:
+ case RTM_LOCK:
+ /* XXX This will mask info.rti_info[RTAX_DST] with
+ * info.rti_info[RTAX_NETMASK] before
+ * searching. It did not used to do that. --dyoung
+ */
+ rt = NULL;
+ error = rtrequest1(RTM_GET, &info, &rt);
+ if (error != 0)
+ senderr(error);
+ if (rtm->rtm_type != RTM_GET) {/* XXX: too grotty */
+ if (memcmp(info.rti_info[RTAX_DST], rt_getkey(rt),
+ info.rti_info[RTAX_DST]->sa_len) != 0)
+ senderr(ESRCH);
+ if (info.rti_info[RTAX_NETMASK] == NULL &&
+ rt_mask(rt) != NULL)
+ senderr(ETOOMANYREFS);
+ }
+
+ /*
+ * XXX if arp/ndp requests an L2 entry, we have to obtain
+ * it from lltable while for the route command we have to
+ * return a route as it is. How to distinguish them?
+ * For newer arp/ndp, RTF_LLDATA flag set by arp/ndp
+ * indicates an L2 entry is requested. For old arp/ndp
+ * binaries, we check RTF_UP flag is NOT set; it works
+ * by the fact that arp/ndp don't set it while the route
+ * command sets it.
+ */
+ if (((rtm->rtm_flags & RTF_LLDATA) != 0 ||
+ (rtm->rtm_flags & RTF_UP) == 0) &&
+ rtm->rtm_type == RTM_GET &&
+ sockaddr_cmp(rt_getkey(rt), info.rti_info[RTAX_DST]) != 0) {
+ int ll_flags = 0;
+ route_get_sdl(rt->rt_ifp, info.rti_info[RTAX_DST], &sdl,
+ &ll_flags);
+ info.rti_info[RTAX_GATEWAY] = sstocsa(&sdl);
+ error = route_output_report(rt, &info, rtm, &new_rtm);
+ if (error)
+ senderr(error);
+ if (new_rtm != NULL) {
+ old_rtm = rtm;
+ rtm = new_rtm;
+ }
+ rtm->rtm_flags |= RTF_LLDATA;
+ rtm->rtm_flags &= ~RTF_CONNECTED;
+ rtm->rtm_flags |= (ll_flags & LLE_STATIC) ? RTF_STATIC : 0;
+ break;
+ }
+
+ switch (rtm->rtm_type) {
+ case RTM_GET:
+ info.rti_info[RTAX_DST] = rt_getkey(rt);
+ info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
+ info.rti_info[RTAX_NETMASK] = rt_mask(rt);
+ info.rti_info[RTAX_TAG] = rt_gettag(rt);
+ error = route_output_report(rt, &info, rtm, &new_rtm);
+ if (error)
+ senderr(error);
+ if (new_rtm != NULL) {
+ old_rtm = rtm;
+ rtm = new_rtm;
+ }
+ break;
+
+ case RTM_CHANGE:
+#ifdef NET_MPSAFE
+ /*
+ * Release rt_so_mtx to avoid a deadlock with route_intr
+ * and also serialize updating routes to avoid another.
+ */
+ if (rt_updating) {
+ /* Release to allow the updater to proceed */
+ rt_unref(rt);
+ rt = NULL;
+ }
+ while (rt_updating) {
+ error = cv_wait_sig(&rt_update_cv, rt_so_mtx);
+ if (error != 0)
+ goto flush;
+ }
+ if (rt == NULL) {
+ error = rtrequest1(RTM_GET, &info, &rt);
+ if (error != 0)
+ goto flush;
+ }
+ rt_updating = true;
+ mutex_exit(rt_so_mtx);
+
+ error = rt_update_prepare(rt);
+ if (error == 0) {
+ error = rt_update(rt, &info, rtm);
+ rt_update_finish(rt);
+ }
+
+ mutex_enter(rt_so_mtx);
+ rt_updating = false;
+ cv_broadcast(&rt_update_cv);
+#else
+ error = rt_update(rt, &info, rtm);
+#endif
+ if (error != 0)
+ goto flush;
+ /*FALLTHROUGH*/
+ case RTM_LOCK:
+ rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits);
+ rt->rt_rmx.rmx_locks |=
+ (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks);
+ break;
+ }
+ break;
+
+ default:
+ senderr(EOPNOTSUPP);
+ }
+
+flush:
+ if (rtm) {
+ if (error)
+ rtm->rtm_errno = error;
+ else
+ rtm->rtm_flags |= RTF_DONE;
+ }
+ family = info.rti_info[RTAX_DST] ? info.rti_info[RTAX_DST]->sa_family :
+ 0;
+ /* We cannot free old_rtm until we have stopped using the
+ * pointers in info, some of which may point to sockaddrs
+ * in old_rtm.
+ */
+ if (old_rtm != NULL)
+ Free(old_rtm);
+ if (rt) {
+ if (do_rt_free) {
+#ifdef NET_MPSAFE
+ /*
+ * Release rt_so_mtx to avoid a deadlock with
+ * route_intr.
+ */
+ mutex_exit(rt_so_mtx);
+ rt_free(rt);
+ mutex_enter(rt_so_mtx);
+#else
+ rt_free(rt);
+#endif
+ } else
+ rt_unref(rt);
+ }
+ {
+ struct rawcb *rp = NULL;
+ /*
+ * Check to see if we don't want our own messages.
+ */
+ if ((so->so_options & SO_USELOOPBACK) == 0) {
+ if (COMPATNAME(route_info).ri_cb.any_count <= 1) {
+ if (rtm)
+ Free(rtm);
+ m_freem(m);
+ goto out;
+ }
+ /* There is another listener, so construct message */
+ rp = sotorawcb(so);
+ }
+ if (rtm) {
+ m_copyback(m, 0, rtm->rtm_msglen, rtm);
+ if (m->m_pkthdr.len < rtm->rtm_msglen) {
+ m_freem(m);
+ m = NULL;
+ } else if (m->m_pkthdr.len > rtm->rtm_msglen)
+ m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len);
+ Free(rtm);
+ }
+ if (rp)
+ rp->rcb_proto.sp_family = 0; /* Avoid us */
+ if (family)
+ proto.sp_protocol = family;
+ if (m)
+ raw_input(m, &proto, &COMPATNAME(route_info).ri_src,
+ &COMPATNAME(route_info).ri_dst, &rt_rawcb);
+ if (rp)
+ rp->rcb_proto.sp_family = PF_XROUTE;
+ }
+out:
+ curlwp_bindx(bound);
+ return error;
+}
+
+static int
+route_ctloutput(int op, struct socket *so, struct sockopt *sopt)
+{
+ struct routecb *rop = sotoroutecb(so);
+ int error = 0;
+ unsigned char *rtm_type;
+ size_t len;
+ unsigned int msgfilter;
+
+ KASSERT(solocked(so));
+
+ if (sopt->sopt_level != AF_ROUTE) {
+ error = ENOPROTOOPT;
+ } else switch (op) {
+ case PRCO_SETOPT:
+ switch (sopt->sopt_name) {
+ case RO_MSGFILTER:
+ msgfilter = 0;
+ for (rtm_type = sopt->sopt_data, len = sopt->sopt_size;
+ len != 0;
+ rtm_type++, len -= sizeof(*rtm_type))
+ {
+ /* Guard against overflowing our storage. */
+ if (*rtm_type >= sizeof(msgfilter) * CHAR_BIT) {
+ error = EOVERFLOW;
+ break;
+ }
+ msgfilter |= RTMSGFILTER(*rtm_type);
+ }
+ if (error == 0)
+ rop->rocb_msgfilter = msgfilter;
+ break;
+ default:
+ error = ENOPROTOOPT;
+ break;
+ }
+ break;
+ case PRCO_GETOPT:
+ switch (sopt->sopt_name) {
+ case RO_MSGFILTER:
+ error = ENOTSUP;
+ break;
+ default:
+ error = ENOPROTOOPT;
+ break;
+ }
+ }
+ return error;
+}
+
+static void
+_rt_setmetrics(int which, const struct rt_xmsghdr *in, struct rtentry *out)
+{
+#define metric(f, e) if (which & (f)) out->rt_rmx.e = in->rtm_rmx.e;
+ metric(RTV_RPIPE, rmx_recvpipe);
+ metric(RTV_SPIPE, rmx_sendpipe);
+ metric(RTV_SSTHRESH, rmx_ssthresh);
+ metric(RTV_RTT, rmx_rtt);
+ metric(RTV_RTTVAR, rmx_rttvar);
+ metric(RTV_HOPCOUNT, rmx_hopcount);
+ metric(RTV_MTU, rmx_mtu);
+#undef metric
+ if (which & RTV_EXPIRE) {
+ out->rt_rmx.rmx_expire = in->rtm_rmx.rmx_expire ?
+ time_wall_to_mono(in->rtm_rmx.rmx_expire) : 0;
+ }
+}
+
+static void
+rtm_setmetrics(const struct rtentry *in, struct rt_xmsghdr *out)
+{
+#define metric(e) out->rtm_rmx.e = in->rt_rmx.e;
+ metric(rmx_recvpipe);
+ metric(rmx_sendpipe);
+ metric(rmx_ssthresh);
+ metric(rmx_rtt);
+ metric(rmx_rttvar);
+ metric(rmx_hopcount);
+ metric(rmx_mtu);
+ metric(rmx_locks);
+#undef metric
+ out->rtm_rmx.rmx_expire = in->rt_rmx.rmx_expire ?
+ time_mono_to_wall(in->rt_rmx.rmx_expire) : 0;
+}
+
+static int
+rt_xaddrs(u_char rtmtype, const char *cp, const char *cplim,
+ struct rt_addrinfo *rtinfo)
+{
+ const struct sockaddr *sa = NULL; /* Quell compiler warning */
+ int i;
+
+ for (i = 0; i < RTAX_MAX && cp < cplim; i++) {
+ if ((rtinfo->rti_addrs & (1 << i)) == 0)
+ continue;
+ rtinfo->rti_info[i] = sa = (const struct sockaddr *)cp;
+ RT_XADVANCE(cp, sa);
+ }
+
+ /*
+ * Check for extra addresses specified, except RTM_GET asking
+ * for interface info.
+ */
+ if (rtmtype == RTM_GET) {
+ if (((rtinfo->rti_addrs &
+ (~((1 << RTAX_IFP) | (1 << RTAX_IFA)))) & (~0U << i)) != 0)
+ return 1;
+ } else if ((rtinfo->rti_addrs & (~0U << i)) != 0)
+ return 1;
+ /* Check for bad data length. */
+ if (cp != cplim) {
+ if (i == RTAX_NETMASK + 1 && sa != NULL &&
+ cp - RT_XROUNDUP(sa->sa_len) + sa->sa_len == cplim)
+ /*
+ * The last sockaddr was info.rti_info[RTAX_NETMASK].
+ * We accept this for now for the sake of old
+ * binaries or third party softwares.
+ */
+ ;
+ else
+ return 1;
+ }
+ return 0;
+}
+
+static int
+rt_getlen(int type)
+{
+ RTS_CTASSERT(__alignof(struct ifa_msghdr) >= sizeof(uint64_t));
+ RTS_CTASSERT(__alignof(struct if_msghdr) >= sizeof(uint64_t));
+ RTS_CTASSERT(__alignof(struct if_announcemsghdr) >= sizeof(uint64_t));
+ RTS_CTASSERT(__alignof(struct rt_msghdr) >= sizeof(uint64_t));
+
+ switch (type) {
+ case RTM_ODELADDR:
+ case RTM_ONEWADDR:
+ case RTM_OCHGADDR:
+ if (rtsock_70_iflist_hook.hooked)
+ return sizeof(struct ifa_msghdr70);
+ else {
+#ifdef RTSOCK_DEBUG
+ printf("%s: unsupported RTM type %d\n", __func__, type);
+#endif
+ return -1;
+ }
+
+ case RTM_DELADDR:
+ case RTM_NEWADDR:
+ case RTM_CHGADDR:
+ return sizeof(struct ifa_xmsghdr);
+
+ case RTM_OOIFINFO:
+ if (rtsock_14_iflist_hook.hooked)
+ return sizeof(struct if_msghdr14);
+ else {
+#ifdef RTSOCK_DEBUG
+ printf("%s: unsupported RTM type RTM_OOIFINFO\n",
+ __func__);
+#endif
+ return -1;
+ }
+
+ case RTM_OIFINFO:
+ if (rtsock_50_iflist_hook.hooked)
+ return sizeof(struct if_msghdr50);
+ else {
+#ifdef RTSOCK_DEBUG
+ printf("%s: unsupported RTM type RTM_OIFINFO\n",
+ __func__);
+#endif
+ return -1;
+ }
+
+ case RTM_IFINFO:
+ return sizeof(struct if_xmsghdr);
+
+ case RTM_IFANNOUNCE:
+ case RTM_IEEE80211:
+ return sizeof(struct if_xannouncemsghdr);
+
+ default:
+ return sizeof(struct rt_xmsghdr);
+ }
+}
+
+
+struct mbuf *
+COMPATNAME(rt_msg1)(int type, struct rt_addrinfo *rtinfo, void *data, int datalen)
+{
+ struct rt_xmsghdr *rtm;
+ struct mbuf *m;
+ int i;
+ const struct sockaddr *sa;
+ int len, dlen;
+
+ m = m_gethdr(M_DONTWAIT, MT_DATA);
+ if (m == NULL)
+ return m;
+ MCLAIM(m, &COMPATNAME(routedomain).dom_mowner);
+
+ if ((len = rt_getlen(type)) == -1)
+ goto out;
+ if (len > MHLEN + MLEN)
+ panic("%s: message too long", __func__);
+ else if (len > MHLEN) {
+ m->m_next = m_get(M_DONTWAIT, MT_DATA);
+ if (m->m_next == NULL)
+ goto out;
+ MCLAIM(m->m_next, m->m_owner);
+ m->m_pkthdr.len = len;
+ m->m_len = MHLEN;
+ m->m_next->m_len = len - MHLEN;
+ } else {
+ m->m_pkthdr.len = m->m_len = len;
+ }
+ m_reset_rcvif(m);
+ m_copyback(m, 0, datalen, data);
+ if (len > datalen)
+ (void)memset(mtod(m, char *) + datalen, 0, len - datalen);
+ rtm = mtod(m, struct rt_xmsghdr *);
+ for (i = 0; i < RTAX_MAX; i++) {
+ if ((sa = rtinfo->rti_info[i]) == NULL)
+ continue;
+ rtinfo->rti_addrs |= (1 << i);
+ dlen = RT_XROUNDUP(sa->sa_len);
+ m_copyback(m, len, sa->sa_len, sa);
+ if (dlen != sa->sa_len) {
+ /*
+ * Up to 7 + 1 nul's since roundup is to
+ * sizeof(uint64_t) (8 bytes)
+ */
+ m_copyback(m, len + sa->sa_len,
+ dlen - sa->sa_len, "\0\0\0\0\0\0\0");
+ }
+ len += dlen;
+ }
+ if (m->m_pkthdr.len != len)
+ goto out;
+ rtm->rtm_msglen = len;
+ rtm->rtm_version = RTM_XVERSION;
+ rtm->rtm_type = type;
+ return m;
+out:
+ m_freem(m);
+ return NULL;
+}
+
+/*
+ * rt_msg2
+ *
+ * fills 'cp' or 'w'.w_tmem with the routing socket message and
+ * returns the length of the message in 'lenp'.
+ *
+ * if walkarg is 0, cp is expected to be 0 or a buffer large enough to hold
+ * the message
+ * otherwise walkarg's w_needed is updated and if the user buffer is
+ * specified and w_needed indicates space exists the information is copied
+ * into the temp space (w_tmem). w_tmem is [re]allocated if necessary,
+ * if the allocation fails ENOBUFS is returned.
+ */
+static int
+rt_msg2(int type, struct rt_addrinfo *rtinfo, void *cpv, struct rt_walkarg *w,
+ int *lenp)
+{
+ int i;
+ int len, dlen, second_time = 0;
+ char *cp0, *cp = cpv;
+
+ rtinfo->rti_addrs = 0;
+again:
+ if ((len = rt_getlen(type)) == -1)
+ return EINVAL;
+
+ if ((cp0 = cp) != NULL)
+ cp += len;
+ for (i = 0; i < RTAX_MAX; i++) {
+ const struct sockaddr *sa;
+
+ if ((sa = rtinfo->rti_info[i]) == NULL)
+ continue;
+ rtinfo->rti_addrs |= (1 << i);
+ dlen = RT_XROUNDUP(sa->sa_len);
+ if (cp) {
+ int diff = dlen - sa->sa_len;
+ (void)memcpy(cp, sa, (size_t)sa->sa_len);
+ cp += sa->sa_len;
+ if (diff > 0) {
+ (void)memset(cp, 0, (size_t)diff);
+ cp += diff;
+ }
+ }
+ len += dlen;
+ }
+ if (cp == NULL && w != NULL && !second_time) {
+ struct rt_walkarg *rw = w;
+
+ rw->w_needed += len;
+ if (rw->w_needed <= 0 && rw->w_where) {
+ if (rw->w_tmemsize < len) {
+ if (rw->w_tmem)
+ kmem_free(rw->w_tmem, rw->w_tmemsize);
+ rw->w_tmem = kmem_zalloc(len, KM_SLEEP);
+ rw->w_tmemsize = len;
+ }
+ if (rw->w_tmem) {
+ cp = rw->w_tmem;
+ second_time = 1;
+ goto again;
+ } else {
+ rw->w_tmemneeded = len;
+ return ENOBUFS;
+ }
+ }
+ }
+ if (cp) {
+ struct rt_xmsghdr *rtm = (struct rt_xmsghdr *)cp0;
+
+ rtm->rtm_version = RTM_XVERSION;
+ rtm->rtm_type = type;
+ rtm->rtm_msglen = len;
+ }
+ if (lenp)
+ *lenp = len;
+ return 0;
+}
+
+/*
+ * This routine is called to generate a message from the routing
+ * socket indicating that a redirect has occurred, a routing lookup
+ * has failed, or that a protocol has detected timeouts to a particular
+ * destination.
+ */
+void
+COMPATNAME(rt_missmsg)(int type, const struct rt_addrinfo *rtinfo, int flags,
+ int error)
+{
+ struct rt_xmsghdr rtm;
+ struct mbuf *m;
+ const struct sockaddr *sa = rtinfo->rti_info[RTAX_DST];
+ struct rt_addrinfo info = *rtinfo;
+
+ COMPATCALL(rt_missmsg, (type, rtinfo, flags, error));
+ if (COMPATNAME(route_info).ri_cb.any_count == 0)
+ return;
+ memset(&rtm, 0, sizeof(rtm));
+ rtm.rtm_pid = curproc->p_pid;
+ rtm.rtm_flags = RTF_DONE | flags;
+ rtm.rtm_errno = error;
+ m = COMPATNAME(rt_msg1)(type, &info, &rtm, sizeof(rtm));
+ if (m == NULL)
+ return;
+ mtod(m, struct rt_xmsghdr *)->rtm_addrs = info.rti_addrs;
+ COMPATNAME(route_enqueue)(m, sa ? sa->sa_family : 0);
+}
+
+/*
+ * This routine is called to generate a message from the routing
+ * socket indicating that the status of a network interface has changed.
+ */
+void
+COMPATNAME(rt_ifmsg)(struct ifnet *ifp)
+{
+ struct if_xmsghdr ifm;
+ struct mbuf *m;
+ struct rt_addrinfo info;
+
+ COMPATCALL(rt_ifmsg, (ifp));
+ if (COMPATNAME(route_info).ri_cb.any_count == 0)
+ return;
+ (void)memset(&info, 0, sizeof(info));
+ (void)memset(&ifm, 0, sizeof(ifm));
+ ifm.ifm_index = ifp->if_index;
+ ifm.ifm_flags = ifp->if_flags;
+ ifm.ifm_data = ifp->if_data;
+ ifm.ifm_addrs = 0;
+ m = COMPATNAME(rt_msg1)(RTM_IFINFO, &info, &ifm, sizeof(ifm));
+ if (m == NULL)
+ return;
+ COMPATNAME(route_enqueue)(m, 0);
+ MODULE_CALL_VOID_HOOK(rtsock_14_oifmsg_hook, (ifp), __nothing);
+ MODULE_CALL_VOID_HOOK(rtsock_50_oifmsg_hook, (ifp), __nothing);
+}
+
+/*
+ * This is called to generate messages from the routing socket
+ * indicating a network interface has had addresses associated with it.
+ * if we ever reverse the logic and replace messages TO the routing
+ * socket indicate a request to configure interfaces, then it will
+ * be unnecessary as the routing socket will automatically generate
+ * copies of it.
+ */
+void
+COMPATNAME(rt_newaddrmsg)(int cmd, struct ifaddr *ifa, int error,
+ struct rtentry *rt)
+{
+#define cmdpass(__cmd, __pass) (((__cmd) << 2) | (__pass))
+ struct rt_addrinfo info;
+ const struct sockaddr *sa;
+ int pass;
+ struct mbuf *m;
+ struct ifnet *ifp;
+ struct rt_xmsghdr rtm;
+ struct ifa_xmsghdr ifam;
+ int ncmd;
+
+ KASSERT(ifa != NULL);
+ KASSERT(ifa->ifa_addr != NULL);
+ ifp = ifa->ifa_ifp;
+ if (cmd == RTM_ADD && vec_sctp_add_ip_address != NULL) {
+ (*vec_sctp_add_ip_address)(ifa);
+ } else if (cmd == RTM_DELETE && vec_sctp_delete_ip_address != NULL) {
+ (*vec_sctp_delete_ip_address)(ifa);
+ }
+
+ COMPATCALL(rt_newaddrmsg, (cmd, ifa, error, rt));
+ if (COMPATNAME(route_info).ri_cb.any_count == 0)
+ return;
+ for (pass = 1; pass < 3; pass++) {
+ memset(&info, 0, sizeof(info));
+ switch (cmdpass(cmd, pass)) {
+ case cmdpass(RTM_ADD, 1):
+ case cmdpass(RTM_CHANGE, 1):
+ case cmdpass(RTM_DELETE, 2):
+ case cmdpass(RTM_NEWADDR, 1):
+ case cmdpass(RTM_DELADDR, 1):
+ case cmdpass(RTM_CHGADDR, 1):
+ switch (cmd) {
+ case RTM_ADD:
+ ncmd = RTM_XNEWADDR;
+ break;
+ case RTM_DELETE:
+ ncmd = RTM_XDELADDR;
+ break;
+ case RTM_CHANGE:
+ ncmd = RTM_XCHGADDR;
+ break;
+ case RTM_NEWADDR:
+ ncmd = RTM_XNEWADDR;
+ break;
+ case RTM_DELADDR:
+ ncmd = RTM_XDELADDR;
+ break;
+ case RTM_CHGADDR:
+ ncmd = RTM_XCHGADDR;
+ break;
+ default:
+ panic("%s: unknown command %d", __func__, cmd);
+ }
+ MODULE_CALL_VOID_HOOK(rtsock_70_newaddr_hook,
+ (ncmd, ifa), __nothing);
+ info.rti_info[RTAX_IFA] = sa = ifa->ifa_addr;
+ KASSERT(ifp->if_dl != NULL);
+ info.rti_info[RTAX_IFP] = ifp->if_dl->ifa_addr;
+ info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
+ info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr;
+ memset(&ifam, 0, sizeof(ifam));
+ ifam.ifam_index = ifp->if_index;
+ ifam.ifam_metric = ifa->ifa_metric;
+ ifam.ifam_flags = ifa->ifa_flags;
+#ifndef COMPAT_RTSOCK
+ ifam.ifam_pid = curproc->p_pid;
+ ifam.ifam_addrflags = if_addrflags(ifa);
+#endif
+ m = COMPATNAME(rt_msg1)(ncmd, &info, &ifam, sizeof(ifam));
+ if (m == NULL)
+ continue;
+ mtod(m, struct ifa_xmsghdr *)->ifam_addrs =
+ info.rti_addrs;
+ break;
+ case cmdpass(RTM_ADD, 2):
+ case cmdpass(RTM_CHANGE, 2):
+ case cmdpass(RTM_DELETE, 1):
+ if (rt == NULL)
+ continue;
+ info.rti_info[RTAX_NETMASK] = rt_mask(rt);
+ info.rti_info[RTAX_DST] = sa = rt_getkey(rt);
+ info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
+ memset(&rtm, 0, sizeof(rtm));
+ rtm.rtm_pid = curproc->p_pid;
+ rtm.rtm_index = ifp->if_index;
+ rtm.rtm_flags |= rt->rt_flags;
+ rtm.rtm_errno = error;
+ m = COMPATNAME(rt_msg1)(cmd, &info, &rtm, sizeof(rtm));
+ if (m == NULL)
+ continue;
+ mtod(m, struct rt_xmsghdr *)->rtm_addrs = info.rti_addrs;
+ break;
+ default:
+ continue;
+ }
+ KASSERTMSG(m != NULL, "called with wrong command");
+ COMPATNAME(route_enqueue)(m, sa ? sa->sa_family : 0);
+ }
+#undef cmdpass
+}
+
+static struct mbuf *
+rt_makeifannouncemsg(struct ifnet *ifp, int type, int what,
+ struct rt_addrinfo *info)
+{
+ struct if_xannouncemsghdr ifan;
+
+ memset(info, 0, sizeof(*info));
+ memset(&ifan, 0, sizeof(ifan));
+ ifan.ifan_index = ifp->if_index;
+ strlcpy(ifan.ifan_name, ifp->if_xname, sizeof(ifan.ifan_name));
+ ifan.ifan_what = what;
+ return COMPATNAME(rt_msg1)(type, info, &ifan, sizeof(ifan));
+}
+
+/*
+ * This is called to generate routing socket messages indicating
+ * network interface arrival and departure.
+ */
+void
+COMPATNAME(rt_ifannouncemsg)(struct ifnet *ifp, int what)
+{
+ struct mbuf *m;
+ struct rt_addrinfo info;
+
+ COMPATCALL(rt_ifannouncemsg, (ifp, what));
+ if (COMPATNAME(route_info).ri_cb.any_count == 0)
+ return;
+ m = rt_makeifannouncemsg(ifp, RTM_IFANNOUNCE, what, &info);
+ if (m == NULL)
+ return;
+ COMPATNAME(route_enqueue)(m, 0);
+}
+
+/*
+ * This is called to generate routing socket messages indicating
+ * IEEE80211 wireless events.
+ * XXX we piggyback on the RTM_IFANNOUNCE msg format in a clumsy way.
+ */
+void
+COMPATNAME(rt_ieee80211msg)(struct ifnet *ifp, int what, void *data,
+ size_t data_len)
+{
+ struct mbuf *m;
+ struct rt_addrinfo info;
+
+ COMPATCALL(rt_ieee80211msg, (ifp, what, data, data_len));
+ if (COMPATNAME(route_info).ri_cb.any_count == 0)
+ return;
+ m = rt_makeifannouncemsg(ifp, RTM_IEEE80211, what, &info);
+ if (m == NULL)
+ return;
+ /*
+ * Append the ieee80211 data. Try to stick it in the
+ * mbuf containing the ifannounce msg; otherwise allocate
+ * a new mbuf and append.
+ *
+ * NB: we assume m is a single mbuf.
+ */
+ if (data_len > M_TRAILINGSPACE(m)) {
+ struct mbuf *n = m_get(M_NOWAIT, MT_DATA);
+ if (n == NULL) {
+ m_freem(m);
+ return;
+ }
+ (void)memcpy(mtod(n, void *), data, data_len);
+ n->m_len = data_len;
+ m->m_next = n;
+ } else if (data_len > 0) {
+ (void)memcpy(mtod(m, uint8_t *) + m->m_len, data, data_len);
+ m->m_len += data_len;
+ }
+ if (m->m_flags & M_PKTHDR)
+ m->m_pkthdr.len += data_len;
+ mtod(m, struct if_xannouncemsghdr *)->ifan_msglen += data_len;
+ COMPATNAME(route_enqueue)(m, 0);
+}
+
+/*
+ * Routing message software interrupt routine
+ */
+static void
+COMPATNAME(route_intr)(void *cookie)
+{
+ struct sockproto proto = { .sp_family = PF_XROUTE, };
+ struct route_info * const ri = &COMPATNAME(route_info);
+ struct mbuf *m;
+
+ SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
+ for (;;) {
+ IFQ_LOCK(&ri->ri_intrq);
+ IF_DEQUEUE(&ri->ri_intrq, m);
+ IFQ_UNLOCK(&ri->ri_intrq);
+ if (m == NULL)
+ break;
+ proto.sp_protocol = M_GETCTX(m, uintptr_t);
+#ifdef NET_MPSAFE
+ mutex_enter(rt_so_mtx);
+#endif
+ raw_input(m, &proto, &ri->ri_src, &ri->ri_dst, &rt_rawcb);
+#ifdef NET_MPSAFE
+ mutex_exit(rt_so_mtx);
+#endif
+ }
+ SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
+}
+
+/*
+ * Enqueue a message to the software interrupt routine.
+ */
+void
+COMPATNAME(route_enqueue)(struct mbuf *m, int family)
+{
+ struct route_info * const ri = &COMPATNAME(route_info);
+ int wasempty;
+
+ IFQ_LOCK(&ri->ri_intrq);
+ if (IF_QFULL(&ri->ri_intrq)) {
+ printf("%s: queue full, dropped message\n", __func__);
+ IF_DROP(&ri->ri_intrq);
+ IFQ_UNLOCK(&ri->ri_intrq);
+ m_freem(m);
+ } else {
+ wasempty = IF_IS_EMPTY(&ri->ri_intrq);
+ M_SETCTX(m, (uintptr_t)family);
+ IF_ENQUEUE(&ri->ri_intrq, m);
+ IFQ_UNLOCK(&ri->ri_intrq);
+ if (wasempty) {
+ kpreempt_disable();
+ softint_schedule(ri->ri_sih);
+ kpreempt_enable();
+ }
+ }
+}
+
+static void
+COMPATNAME(route_init)(void)
+{
+ struct route_info * const ri = &COMPATNAME(route_info);
+
+#ifndef COMPAT_RTSOCK
+ rt_init();
+#endif
+#ifdef NET_MPSAFE
+ rt_so_mtx = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
+
+ cv_init(&rt_update_cv, "rtsock_cv");
+#endif
+
+#ifndef COMPAT_RTSOCK
+ sysctl_net_route_setup(NULL);
+#endif
+ ri->ri_intrq.ifq_maxlen = ri->ri_maxqlen;
+ ri->ri_sih = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
+ COMPATNAME(route_intr), NULL);
+ IFQ_LOCK_INIT(&ri->ri_intrq);
+}
+
+/*
+ * Definitions of protocols supported in the ROUTE domain.
+ */
+#ifndef COMPAT_RTSOCK
+PR_WRAP_USRREQS(route);
+#else
+PR_WRAP_USRREQS(compat_50_route);
+#endif
+
+static const struct pr_usrreqs route_usrreqs = {
+ .pr_attach = COMPATNAME(route_attach_wrapper),
+ .pr_detach = COMPATNAME(route_detach_wrapper),
+ .pr_accept = COMPATNAME(route_accept_wrapper),
+ .pr_bind = COMPATNAME(route_bind_wrapper),
+ .pr_listen = COMPATNAME(route_listen_wrapper),
+ .pr_connect = COMPATNAME(route_connect_wrapper),
+ .pr_connect2 = COMPATNAME(route_connect2_wrapper),
+ .pr_disconnect = COMPATNAME(route_disconnect_wrapper),
+ .pr_shutdown = COMPATNAME(route_shutdown_wrapper),
+ .pr_abort = COMPATNAME(route_abort_wrapper),
+ .pr_ioctl = COMPATNAME(route_ioctl_wrapper),
+ .pr_stat = COMPATNAME(route_stat_wrapper),
+ .pr_peeraddr = COMPATNAME(route_peeraddr_wrapper),
+ .pr_sockaddr = COMPATNAME(route_sockaddr_wrapper),
+ .pr_rcvd = COMPATNAME(route_rcvd_wrapper),
+ .pr_recvoob = COMPATNAME(route_recvoob_wrapper),
+ .pr_send = COMPATNAME(route_send_wrapper),
+ .pr_sendoob = COMPATNAME(route_sendoob_wrapper),
+ .pr_purgeif = COMPATNAME(route_purgeif_wrapper),
+};
+
+static const struct protosw COMPATNAME(route_protosw)[] = {
+ {
+ .pr_type = SOCK_RAW,
+ .pr_domain = &COMPATNAME(routedomain),
+ .pr_flags = PR_ATOMIC|PR_ADDR,
+ .pr_ctlinput = raw_ctlinput,
+ .pr_ctloutput = route_ctloutput,
+ .pr_usrreqs = &route_usrreqs,
+ .pr_init = rt_pr_init,
+ },
+};
+
+struct domain COMPATNAME(routedomain) = {
+ .dom_family = PF_XROUTE,
+ .dom_name = DOMAINNAME,
+ .dom_init = COMPATNAME(route_init),
+ .dom_protosw = COMPATNAME(route_protosw),
+ .dom_protoswNPROTOSW =
+ &COMPATNAME(route_protosw)[__arraycount(COMPATNAME(route_protosw))],
+};
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 90bafeba747..908ea128234 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_ioctl.c,v 1.60 2015/08/24 22:21:26 pooka Exp $ */
+/* $netBSD: ieee80211_ioctl.c,v 1.60.16.1 2018/03/28 00:30:05 pgoyette Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
__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_ioctl.c,v 1.60 2015/08/24 22:21:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.61 2019/01/27 02:08:48 pgoyette Exp $");
#endif
/*
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.60 2015/08/24 22:21:26 pooka E
#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>
@@ -72,12 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.60 2015/08/24 22:21:26 pooka E
#include <dev/ic/wi_ieee.h>
-#if defined(COMPAT_09) || defined(COMPAT_10) || defined(COMPAT_11) || \
- defined(COMPAT_12) || defined(COMPAT_13) || defined(COMPAT_14) || \
- defined(COMPAT_15) || defined(COMPAT_16) || defined(COMPAT_20) || \
- defined(COMPAT_30) || defined(COMPAT_40)
#include <compat/sys/sockio.h>
-#endif
#ifdef __FreeBSD__
#define IS_UP(_ic) \
@@ -2559,29 +2555,8 @@ ieee80211_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
}
#endif /* __FreeBSD__ */
-#ifdef COMPAT_20
-static void
-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);
-}
-#endif /* COMPAT_20 */
-
#ifdef __NetBSD__
+
int
ieee80211_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
{
@@ -2596,9 +2571,6 @@ ieee80211_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
struct ieee80211chanreq *chanreq;
struct ieee80211_channel *chan;
uint32_t oflags;
-#ifdef COMPAT_20
- struct ieee80211_ostats ostats;
-#endif /* COMPAT_20 */
static const u_int8_t zerobssid[IEEE80211_ADDR_LEN];
u_int8_t tmpkey[IEEE80211_WEP_NKID][IEEE80211_KEYBUF_SIZE];
@@ -2877,18 +2849,24 @@ ieee80211_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
break;
error = ieee80211_cfgset(ic, cmd, data);
break;
-#ifdef COMPAT_20
case OSIOCG80211STATS:
case OSIOCG80211ZSTATS:
+ {
+ struct ieee80211_ostats ostats;
+
ifr = (struct ifreq *)data;
s = splnet();
- ieee80211_get_ostats(&ostats, &ic->ic_stats);
- error = copyout(&ostats, ifr->ifr_data, sizeof(ostats));
+ MODULE_CALL_HOOK(ieee80211_ostats_hook,
+ (&ostats, &ic->ic_stats), enosys(), error);
+ if (error == ENOSYS)
+ error = EINVAL;
+ if (error == 0)
+ error = copyout(&ostats, ifr->ifr_data, sizeof(ostats));
if (error == 0 && cmd == OSIOCG80211ZSTATS)
(void)memset(&ic->ic_stats, 0, sizeof(ic->ic_stats));
splx(s);
break;
-#endif /* COMPAT_20 */
+ }
case SIOCG80211ZSTATS:
case SIOCG80211STATS:
ifr = (struct ifreq *)data;
diff --git a/sys/net80211/ieee80211_ioctl.h b/sys/net80211/ieee80211_ioctl.h
index 8968a69d5e1..f67764a5a57 100644
--- a/sys/net80211/ieee80211_ioctl.h
+++ b/sys/net80211/ieee80211_ioctl.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_ioctl.h,v 1.24 2018/05/04 11:25:24 maxv Exp $ */
+/* $NetBSD: ieee80211_ioctl.h,v 1.25 2019/01/27 02:08:48 pgoyette Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -91,7 +91,6 @@ struct ieee80211_nodestats {
u_int32_t ns_tx_disassoc_code; /* last disassociation reason */
};
-#ifdef COMPAT_20
struct ieee80211_ostats {
u_int32_t is_rx_badversion; /* rx frame with bad version */
u_int32_t is_rx_tooshort; /* rx frame too short */
@@ -135,7 +134,6 @@ struct ieee80211_ostats {
u_int32_t is_node_timeout; /* nodes timed out inactivity */
u_int32_t is_crypto_nomem; /* no memory for crypto ctx */
};
-#endif /* COMPAT_20 */
/*
* Summary statistics.
@@ -429,10 +427,8 @@ struct ieee80211req {
#define SIOCG80211 _IOWR('i', 245, struct ieee80211req)
#define SIOCG80211STATS _IOWR('i', 246, struct ifreq)
#define SIOCG80211ZSTATS _IOWR('i', 247, struct ifreq)
-#ifdef COMPAT_20
#define OSIOCG80211STATS _IOWR('i', 242, struct ifreq)
#define OSIOCG80211ZSTATS _IOWR('i', 243, struct ifreq)
-#endif /* COMPAT_20 */
#endif /* __NetBSD__ */
#if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
diff --git a/sys/netipsec/ipsec.c b/sys/netipsec/ipsec.c
index 9540291f55c..ab041d055fb 100644
--- a/sys/netipsec/ipsec.c
+++ b/sys/netipsec/ipsec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.167 2018/11/22 04:48:34 knakahara Exp $ */
+/* $NetBSD: ipsec.c,v 1.168 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
/* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.167 2018/11/22 04:48:34 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.168 2019/01/27 02:08:48 pgoyette Exp $");
/*
* IPsec controller part.
diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c
index b8ffdc3921c..a5ce54aec96 100644
--- a/sys/netipsec/ipsec_input.c
+++ b/sys/netipsec/ipsec_input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec_input.c,v 1.74 2019/01/17 02:47:15 knakahara Exp $ */
+/* $NetBSD: ipsec_input.c,v 1.75 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $ */
/* $OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $ */
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.74 2019/01/17 02:47:15 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.75 2019/01/27 02:08:48 pgoyette Exp $");
/*
* IPsec input processing.
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index b2ace07a4d4..efcf917ae10 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.260 2018/12/26 08:58:51 knakahara Exp $ */
+/* $NetBSD: key.c,v 1.261 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.260 2018/12/26 08:58:51 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.261 2019/01/27 02:08:48 pgoyette Exp $");
/*
* This code is referred to RFC 2367
diff --git a/sys/netipsec/key_debug.c b/sys/netipsec/key_debug.c
index 377b4f76a4b..d3f417fc95c 100644
--- a/sys/netipsec/key_debug.c
+++ b/sys/netipsec/key_debug.c
@@ -1,4 +1,4 @@
-/* $NetBSD: key_debug.c,v 1.22 2018/04/19 08:27:38 maxv Exp $ */
+/* $NetBSD: key_debug.c,v 1.23 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: key_debug.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */
/* $KAME: key_debug.c,v 1.26 2001/06/27 10:46:50 sakane Exp $ */
@@ -33,7 +33,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key_debug.c,v 1.22 2018/04/19 08:27:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key_debug.c,v 1.23 2019/01/27 02:08:48 pgoyette Exp $");
#endif
#if defined(_KERNEL_OPT)
diff --git a/sys/netipsec/keysock.c b/sys/netipsec/keysock.c
index b2725b7d06f..a13870fd839 100644
--- a/sys/netipsec/keysock.c
+++ b/sys/netipsec/keysock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: keysock.c,v 1.67 2018/12/24 15:57:15 maxv Exp $ */
+/* $NetBSD: keysock.c,v 1.68 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */
/* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.67 2018/12/24 15:57:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.68 2019/01/27 02:08:48 pgoyette Exp $");
/* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */
diff --git a/sys/netipsec/xform_ah.c b/sys/netipsec/xform_ah.c
index 203813cd013..2ee4de48d2d 100644
--- a/sys/netipsec/xform_ah.c
+++ b/sys/netipsec/xform_ah.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xform_ah.c,v 1.106 2018/05/31 06:25:41 maxv Exp $ */
+/* $NetBSD: xform_ah.c,v 1.107 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
/*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.106 2018/05/31 06:25:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.107 2019/01/27 02:08:48 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c
index 653ade48ced..b1eac5d398c 100644
--- a/sys/netipsec/xform_esp.c
+++ b/sys/netipsec/xform_esp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xform_esp.c,v 1.96 2018/05/31 06:14:18 maxv Exp $ */
+/* $NetBSD: xform_esp.c,v 1.97 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.96 2018/05/31 06:14:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.97 2019/01/27 02:08:48 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
diff --git a/sys/netipsec/xform_ipcomp.c b/sys/netipsec/xform_ipcomp.c
index 7a85627baf0..213fc81a63d 100644
--- a/sys/netipsec/xform_ipcomp.c
+++ b/sys/netipsec/xform_ipcomp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xform_ipcomp.c,v 1.66 2018/05/13 18:34:59 maxv Exp $ */
+/* $NetBSD: xform_ipcomp.c,v 1.67 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.66 2018/05/13 18:34:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.67 2019/01/27 02:08:48 pgoyette Exp $");
/* IP payload compression protocol (IPComp), see RFC 2393 */
#if defined(_KERNEL_OPT)
diff --git a/sys/netipsec/xform_ipip.c b/sys/netipsec/xform_ipip.c
index 3e12a51015f..20ba8f0f034 100644
--- a/sys/netipsec/xform_ipip.c
+++ b/sys/netipsec/xform_ipip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xform_ipip.c,v 1.74 2018/05/07 09:33:51 maxv Exp $ */
+/* $NetBSD: xform_ipip.c,v 1.75 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.74 2018/05/07 09:33:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.75 2019/01/27 02:08:48 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
diff --git a/sys/netipsec/xform_tcp.c b/sys/netipsec/xform_tcp.c
index a00f22be246..e0ba16f97b6 100644
--- a/sys/netipsec/xform_tcp.c
+++ b/sys/netipsec/xform_tcp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xform_tcp.c,v 1.21 2018/05/14 02:16:29 ozaki-r Exp $ */
+/* $NetBSD: xform_tcp.c,v 1.22 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: xform_tcp.c,v 1.1.2.1 2004/02/14 22:24:09 bms Exp $ */
/*
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_tcp.c,v 1.21 2018/05/14 02:16:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_tcp.c,v 1.22 2019/01/27 02:08:48 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c
index 2304ad1ac88..7693efedb11 100644
--- a/sys/opencrypto/cryptodev.c
+++ b/sys/opencrypto/cryptodev.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cryptodev.c,v 1.98 2018/02/08 09:05:20 dholland Exp $ */
+/* $NetBSD: cryptodev.c,v 1.99 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */
/* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98 2018/02/08 09:05:20 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.99 2019/01/27 02:08:48 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98 2018/02/08 09:05:20 dholland Exp
#include <sys/atomic.h>
#include <sys/stat.h>
#include <sys/module.h>
+#include <sys/compat_stub.h>
#ifdef _KERNEL_OPT
#include "opt_ocf.h"
@@ -93,6 +94,7 @@ __KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98 2018/02/08 09:05:20 dholland Exp
#endif
#include <opencrypto/cryptodev.h>
+#include <opencrypto/ocryptodev.h>
#include <opencrypto/cryptodev_internal.h>
#include <opencrypto/xform.h>
@@ -196,10 +198,6 @@ static int cryptodev_getmstatus(struct fcrypt *, struct crypt_result *,
int);
static int cryptodev_getstatus(struct fcrypt *, struct crypt_result *);
-#ifdef COMPAT_50
-extern int ocryptof_ioctl(struct file *, u_long, void *);
-#endif
-
/*
* sysctl-able control variables for /dev/crypto now defined in crypto.c:
* crypto_usercrypto, crypto_userasmcrypto, crypto_devallowsoft.
@@ -441,12 +439,13 @@ reterr:
error = cryptodev_getstatus(fcr, (struct crypt_result *)data);
break;
default:
-#ifdef COMPAT_50
/* Check for backward compatible commands */
- error = ocryptof_ioctl(fp, cmd, data);
-#else
- return EINVAL;
-#endif
+
+ MODULE_CALL_HOOK(ocryptof_50_hook, (fp, cmd, data),
+ enosys(), error);
+ if (error == ENOSYS)
+ error = EINVAL;
+ return error;
}
return error;
}
diff --git a/sys/opencrypto/files.opencrypto b/sys/opencrypto/files.opencrypto
index 228ec79f415..e1bf2a8a796 100644
--- a/sys/opencrypto/files.opencrypto
+++ b/sys/opencrypto/files.opencrypto
@@ -1,4 +1,4 @@
-# $NetBSD: files.opencrypto,v 1.26 2017/05/24 10:05:09 knakahara Exp $
+# $NetBSD: files.opencrypto,v 1.27 2019/01/27 02:08:48 pgoyette Exp $
#
#
@@ -25,7 +25,7 @@ file opencrypto/gmac.c swcrypto
# (and thus crypto hardware accelerators).
defpseudo crypto: opencrypto
file opencrypto/cryptodev.c crypto
-file opencrypto/ocryptodev.c crypto & compat_50
+file opencrypto/ocryptodev.c compat_50 & crypto
defflag opt_ocf.h CRYPTO_DEBUG CRYPTO_TIMING
defparam opt_ocf.h CRYPTO_RET_Q_MAXLEN CRYPTO_RET_KQ_MAXLEN
diff --git a/sys/opencrypto/ocryptodev.c b/sys/opencrypto/ocryptodev.c
index 46d853d7493..9033caedb13 100644
--- a/sys/opencrypto/ocryptodev.c
+++ b/sys/opencrypto/ocryptodev.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ocryptodev.c,v 1.11 2017/07/28 17:14:04 riastradh Exp $ */
+/* $NetBSD: ocryptodev.c,v 1.12 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */
/* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.11 2017/07/28 17:14:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.12 2019/01/27 02:08:48 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -89,6 +89,8 @@ __KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.11 2017/07/28 17:14:04 riastradh Ex
#include <sys/select.h>
#include <sys/poll.h>
#include <sys/atomic.h>
+#include <sys/compat_stub.h>
+#include <sys/module.h>
#ifdef _KERNEL_OPT
#include "opt_ocf.h"
@@ -104,7 +106,8 @@ static int ocryptodev_op(struct csession *, struct ocrypt_op *,
static int ocryptodev_mop(struct fcrypt *, struct ocrypt_n_op *, int,
struct lwp *);
static int ocryptodev_session(struct fcrypt *, struct osession_op *);
-static int ocryptodev_msession(struct fcrypt *, struct osession_n_op *, int);
+static int ocryptodev_msession(struct fcrypt *, struct osession_n_op *,
+ int);
int
ocryptof_ioctl(struct file *fp, u_long cmd, void *data)
@@ -174,7 +177,8 @@ mbail:
error = copyin(omop->reqs, ocnop,
(omop->count * sizeof(struct ocrypt_n_op)));
if(!error) {
- error = ocryptodev_mop(fcr, ocnop, omop->count, curlwp);
+ error = ocryptodev_mop(fcr, ocnop, omop->count,
+ curlwp);
if (!error) {
error = copyout(ocnop, omop->reqs,
(omop->count * sizeof(struct ocrypt_n_op)));
@@ -209,9 +213,8 @@ ocryptodev_op(struct csession *cse, struct ocrypt_op *ocop, struct lwp *l)
};
static int
-ocryptodev_mop(struct fcrypt *fcr,
- struct ocrypt_n_op *ocnop,
- int count, struct lwp *l)
+ocryptodev_mop(struct fcrypt *fcr, struct ocrypt_n_op *ocnop, int count,
+ struct lwp *l)
{
int res;
@@ -242,7 +245,7 @@ ocryptodev_mop(struct fcrypt *fcr,
static int
-ocryptodev_session(struct fcrypt *fcr, struct osession_op *osop)
+ocryptodev_session(struct fcrypt *fcr, struct osession_op *osop)
{
struct session_op sop;
int res;
@@ -283,3 +286,36 @@ ocryptodev_msession(struct fcrypt *fcr, struct osession_n_op *osn_ops,
return 0;
}
+
+static void
+crypto_50_init(void)
+{
+
+ MODULE_SET_HOOK(ocryptof_50_hook, "cryp50", ocryptof_ioctl);
+}
+
+static void
+crypto_50_fini(void)
+{
+
+ MODULE_UNSET_HOOK(ocryptof_50_hook);
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_crypto_50, "crypto,compat_50");
+
+static int
+compat_crypto_50_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ crypto_50_init();
+ return 0;
+ case MODULE_CMD_FINI:
+ crypto_50_fini();
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+
diff --git a/sys/opencrypto/ocryptodev.h b/sys/opencrypto/ocryptodev.h
index 9ed3cae5aa5..aa07fe7643a 100644
--- a/sys/opencrypto/ocryptodev.h
+++ b/sys/opencrypto/ocryptodev.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ocryptodev.h,v 1.3 2015/09/06 06:01:02 dholland Exp $ */
+/* $NetBSD: ocryptodev.h,v 1.4 2019/01/27 02:08:48 pgoyette Exp $ */
/* $FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $ */
/* $OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $ */
@@ -170,6 +170,12 @@ struct ocrypt_mop {
#define OCIOCCRYPT _IOWR('c', 103, struct ocrypt_op)
#define OCIOCNCRYPTM _IOWR('c', 107, struct ocrypt_mop)
+struct fcrypt;
+struct session_op;
+struct csession;
+struct crypt_op;
+struct crypt_n_op;
+
int ocryptof_ioctl(struct file *, u_long, void *);
#endif /* _CRYPTO_OCRYPTODEV_H_ */
diff --git a/sys/rump/dev/lib/libnetsmb/netsmb_user.c b/sys/rump/dev/lib/libnetsmb/netsmb_user.c
index 4b330e5a879..350a0f2ff38 100644
--- a/sys/rump/dev/lib/libnetsmb/netsmb_user.c
+++ b/sys/rump/dev/lib/libnetsmb/netsmb_user.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netsmb_user.c,v 1.4 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: netsmb_user.c,v 1.5 2019/01/27 02:08:48 pgoyette Exp $ */
/*
* Copyright (c) 2014 Takeshi Nakayama.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netsmb_user.c,v 1.4 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netsmb_user.c,v 1.5 2019/01/27 02:08:48 pgoyette Exp $");
#ifndef _KERNEL
#include <stddef.h>
diff --git a/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c b/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
index ab6bf5c4fd6..1627004a972 100644
--- a/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
+++ b/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpdev_bus_dma.c,v 1.7 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: rumpdev_bus_dma.c,v 1.8 2019/01/27 02:08:48 pgoyette Exp $ */
/*-
* Copyright (c) 2013 Antti Kantee
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_dma.c,v 1.7 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_dma.c,v 1.8 2019/01/27 02:08:48 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/rump/dev/lib/libpci/rumpdev_bus_space.c b/sys/rump/dev/lib/libpci/rumpdev_bus_space.c
index 477ccced2ef..dfc3f03dead 100644
--- a/sys/rump/dev/lib/libpci/rumpdev_bus_space.c
+++ b/sys/rump/dev/lib/libpci/rumpdev_bus_space.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpdev_bus_space.c,v 1.9 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: rumpdev_bus_space.c,v 1.10 2019/01/27 02:08:48 pgoyette Exp $ */
/*-
* Copyright (c) 2013 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_space.c,v 1.9 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_space.c,v 1.10 2019/01/27 02:08:48 pgoyette Exp $");
#include <sys/atomic.h>
diff --git a/sys/rump/dev/lib/libscsipi/scsipi_component.c b/sys/rump/dev/lib/libscsipi/scsipi_component.c
index a596dade7e2..910f39a4941 100644
--- a/sys/rump/dev/lib/libscsipi/scsipi_component.c
+++ b/sys/rump/dev/lib/libscsipi/scsipi_component.c
@@ -1,7 +1,10 @@
-/* $NetBSD: scsipi_component.c,v 1.3 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: scsipi_component.c,v 1.4 2019/01/27 02:08:48 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_component.c,v 1.3 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_component.c,v 1.4 2019/01/27 02:08:48 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: scsipi_component.c,v 1.4 2019/01/27 02:08:48 pgoyette Exp $");
#include <sys/param.h>
#include <sys/conf.h>
diff --git a/sys/rump/dev/lib/libucom/ucom_at_usb.c b/sys/rump/dev/lib/libucom/ucom_at_usb.c
index f581bf60d01..b74f437f024 100644
--- a/sys/rump/dev/lib/libucom/ucom_at_usb.c
+++ b/sys/rump/dev/lib/libucom/ucom_at_usb.c
@@ -1,7 +1,10 @@
-/* $NetBSD: ucom_at_usb.c,v 1.9 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: ucom_at_usb.c,v 1.10 2019/01/27 02:08:48 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom_at_usb.c,v 1.9 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom_at_usb.c,v 1.10 2019/01/27 02:08:48 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ucom_at_usb.c,v 1.10 2019/01/27 02:08:48 pgoyette Exp $");
#include <sys/param.h>
#include <sys/types.h>
diff --git a/sys/rump/dev/lib/libugenhc/ugenhc_user.c b/sys/rump/dev/lib/libugenhc/ugenhc_user.c
index a806ec4ee95..3e3e2462f9f 100644
--- a/sys/rump/dev/lib/libugenhc/ugenhc_user.c
+++ b/sys/rump/dev/lib/libugenhc/ugenhc_user.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ugenhc_user.c,v 1.2 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: ugenhc_user.c,v 1.3 2019/01/27 02:08:49 pgoyette Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugenhc_user.c,v 1.2 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugenhc_user.c,v 1.3 2019/01/27 02:08:49 pgoyette Exp $");
#ifndef _KERNEL
#include <sys/types.h>
diff --git a/sys/rump/dev/lib/libulpt/ulpt_at_usb.c b/sys/rump/dev/lib/libulpt/ulpt_at_usb.c
index 2cd21746601..f5c41d78ab3 100644
--- a/sys/rump/dev/lib/libulpt/ulpt_at_usb.c
+++ b/sys/rump/dev/lib/libulpt/ulpt_at_usb.c
@@ -1,7 +1,10 @@
-/* $NetBSD: ulpt_at_usb.c,v 1.7 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: ulpt_at_usb.c,v 1.8 2019/01/27 02:08:49 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulpt_at_usb.c,v 1.7 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulpt_at_usb.c,v 1.8 2019/01/27 02:08:49 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ulpt_at_usb.c,v 1.8 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
#include <sys/conf.h>
diff --git a/sys/rump/dev/lib/libumass/umass_component.c b/sys/rump/dev/lib/libumass/umass_component.c
index f8cd0447568..0ef683b172a 100644
--- a/sys/rump/dev/lib/libumass/umass_component.c
+++ b/sys/rump/dev/lib/libumass/umass_component.c
@@ -1,7 +1,10 @@
-/* $NetBSD: umass_component.c,v 1.3 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: umass_component.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass_component.c,v 1.3 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_component.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: umass_component.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
#include <sys/conf.h>
diff --git a/sys/rump/dev/lib/libwscons/wscons_component.c b/sys/rump/dev/lib/libwscons/wscons_component.c
index 6574df8cda3..cd1d2f820df 100644
--- a/sys/rump/dev/lib/libwscons/wscons_component.c
+++ b/sys/rump/dev/lib/libwscons/wscons_component.c
@@ -1,7 +1,10 @@
-/* $NetBSD: wscons_component.c,v 1.3 2018/12/12 00:48:43 alnsn Exp $ */
+/* $NetBSD: wscons_component.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wscons_component.c,v 1.3 2018/12/12 00:48:43 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wscons_component.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: wscons_component.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
#include <sys/conf.h>
diff --git a/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_compat.c b/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_compat.c
index 20c11532ee8..1ed53b68ad7 100644
--- a/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_compat.c
+++ b/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_compat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_cygwin_compat.c,v 1.2 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: rump_cygwin_compat.c,v 1.3 2019/01/27 02:08:49 pgoyette Exp $ */
/*
* Copyright (c) 2013 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_cygwin_compat.c,v 1.2 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_cygwin_compat.c,v 1.3 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
diff --git a/sys/rump/kern/lib/libsys_cygwin/sys_cygwin_component.c b/sys/rump/kern/lib/libsys_cygwin/sys_cygwin_component.c
index 115981ab530..5b4a310516b 100644
--- a/sys/rump/kern/lib/libsys_cygwin/sys_cygwin_component.c
+++ b/sys/rump/kern/lib/libsys_cygwin/sys_cygwin_component.c
@@ -1,7 +1,10 @@
-/* $NetBSD: sys_cygwin_component.c,v 1.4 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: sys_cygwin_component.c,v 1.5 2019/01/27 02:08:49 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_cygwin_component.c,v 1.4 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_cygwin_component.c,v 1.5 2019/01/27 02:08:49 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: sys_cygwin_component.c,v 1.5 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
#include <sys/proc.h>
diff --git a/sys/rump/kern/lib/libsys_linux/linux_rump.c b/sys/rump/kern/lib/libsys_linux/linux_rump.c
index d7cf116ef91..1aeef6c4df5 100644
--- a/sys/rump/kern/lib/libsys_linux/linux_rump.c
+++ b/sys/rump/kern/lib/libsys_linux/linux_rump.c
@@ -1,7 +1,10 @@
-/* $NetBSD: linux_rump.c,v 1.3 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: linux_rump.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_rump.c,v 1.3 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_rump.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: linux_rump.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
diff --git a/sys/rump/kern/lib/libsys_linux/sys_linux_component.c b/sys/rump/kern/lib/libsys_linux/sys_linux_component.c
index 61f43eb6193..a891b9c5fb8 100644
--- a/sys/rump/kern/lib/libsys_linux/sys_linux_component.c
+++ b/sys/rump/kern/lib/libsys_linux/sys_linux_component.c
@@ -1,7 +1,10 @@
-/* $NetBSD: sys_linux_component.c,v 1.5 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: sys_linux_component.c,v 1.6 2019/01/27 02:08:49 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_linux_component.c,v 1.5 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_linux_component.c,v 1.6 2019/01/27 02:08:49 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: sys_linux_component.c,v 1.6 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
#include <sys/proc.h>
diff --git a/sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c b/sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c
index 62bdc35b9be..8e234ca0d3b 100644
--- a/sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c
+++ b/sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_sunos_compat.c,v 1.3 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: rump_sunos_compat.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $ */
/*
* Copyright (c) 2013 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_sunos_compat.c,v 1.3 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_sunos_compat.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
diff --git a/sys/rump/kern/lib/libsys_sunos/sys_sunos_component.c b/sys/rump/kern/lib/libsys_sunos/sys_sunos_component.c
index dc93676ab82..aef26349eb9 100644
--- a/sys/rump/kern/lib/libsys_sunos/sys_sunos_component.c
+++ b/sys/rump/kern/lib/libsys_sunos/sys_sunos_component.c
@@ -1,7 +1,10 @@
-/* $NetBSD: sys_sunos_component.c,v 1.4 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: sys_sunos_component.c,v 1.5 2019/01/27 02:08:49 pgoyette Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_sunos_component.c,v 1.4 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_sunos_component.c,v 1.5 2019/01/27 02:08:49 pgoyette Exp $");
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: sys_sunos_component.c,v 1.5 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/param.h>
#include <sys/proc.h>
diff --git a/sys/rump/librump/rumpkern/Makefile.rumpkern b/sys/rump/librump/rumpkern/Makefile.rumpkern
index 580b4dc39a5..0dd50642981 100644
--- a/sys/rump/librump/rumpkern/Makefile.rumpkern
+++ b/sys/rump/librump/rumpkern/Makefile.rumpkern
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.rumpkern,v 1.173 2018/12/24 16:58:54 thorpej Exp $
+# $NetBSD: Makefile.rumpkern,v 1.174 2019/01/27 02:08:49 pgoyette Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@@ -67,6 +67,7 @@ SRCS+= devsw.c
#
# sys/kern
SRCS+= init_sysctl_base.c \
+ compat_stub.c \
kern_auth.c \
kern_cfglock.c \
kern_clock.c \
diff --git a/sys/rump/librump/rumpkern/arch/generic/rump_generic_directmap.c b/sys/rump/librump/rumpkern/arch/generic/rump_generic_directmap.c
index 57e44fd5b9f..750b6972327 100644
--- a/sys/rump/librump/rumpkern/arch/generic/rump_generic_directmap.c
+++ b/sys/rump/librump/rumpkern/arch/generic/rump_generic_directmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_generic_directmap.c,v 1.2 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: rump_generic_directmap.c,v 1.3 2019/01/27 02:08:49 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_generic_directmap.c,v 1.2 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_generic_directmap.c,v 1.3 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/types.h>
diff --git a/sys/rump/librump/rumpkern/rump_syscalls.c b/sys/rump/librump/rumpkern/rump_syscalls.c
index 879b663cd6b..def5e26722e 100644
--- a/sys/rump/librump/rumpkern/rump_syscalls.c
+++ b/sys/rump/librump/rumpkern/rump_syscalls.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.c,v 1.140 2018/08/10 21:47:16 pgoyette Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.141 2019/01/27 02:08:49 pgoyette Exp $ */
/*
* System call vector and marshalling for rump.
@@ -15,7 +15,7 @@
#ifdef __NetBSD__
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.140 2018/08/10 21:47:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.141 2019/01/27 02:08:49 pgoyette Exp $");
#include <sys/fstypes.h>
#include <sys/proc.h>
@@ -7244,7 +7244,8 @@ struct sysent rump_sysent[] = {
.sy_call = (sy_call_t *)rumpns_enosys,
}, /* 174 = pwrite */
{
- .sy_call = (sy_call_t *)rumpns_enosys,
+ .sy_flags = SYCALL_NOSYS,
+ .sy_call = (sy_call_t *)rumpns_sys_nomodule,
}, /* 175 = ntp_gettime */
#if defined(NTP) || !defined(_KERNEL_OPT)
{
@@ -7833,22 +7834,28 @@ struct sysent rump_sysent[] = {
.sy_call = (sy_call_t *)rumpns_enosys,
}, /* 329 = filler */
{
- .sy_call = (sy_call_t *)rumpns_enosys,
+ .sy_flags = SYCALL_NOSYS,
+ .sy_call = (sy_call_t *)rumpns_sys_nomodule,
}, /* 330 = sa_register */
{
- .sy_call = (sy_call_t *)rumpns_enosys,
+ .sy_flags = SYCALL_NOSYS,
+ .sy_call = (sy_call_t *)rumpns_sys_nomodule,
}, /* 331 = sa_stacks */
{
- .sy_call = (sy_call_t *)rumpns_enosys,
+ .sy_flags = SYCALL_NOSYS,
+ .sy_call = (sy_call_t *)rumpns_sys_nomodule,
}, /* 332 = sa_enable */
{
- .sy_call = (sy_call_t *)rumpns_enosys,
+ .sy_flags = SYCALL_NOSYS,
+ .sy_call = (sy_call_t *)rumpns_sys_nomodule,
}, /* 333 = sa_setconcurrency */
{
- .sy_call = (sy_call_t *)rumpns_enosys,
+ .sy_flags = SYCALL_NOSYS,
+ .sy_call = (sy_call_t *)rumpns_sys_nomodule,
}, /* 334 = sa_yield */
{
- .sy_call = (sy_call_t *)rumpns_enosys,
+ .sy_flags = SYCALL_NOSYS,
+ .sy_call = (sy_call_t *)rumpns_sys_nomodule,
}, /* 335 = sa_preempt */
{
.sy_flags = SYCALL_NOSYS,
diff --git a/sys/rump/net/lib/libpppoe/Makefile b/sys/rump/net/lib/libpppoe/Makefile
index 57a5c328a07..f6ecfdff9bc 100644
--- a/sys/rump/net/lib/libpppoe/Makefile
+++ b/sys/rump/net/lib/libpppoe/Makefile
@@ -5,7 +5,7 @@ LIB= rumpnet_pppoe
COMPONENT= PPP over Ethernet protocol network interface
IOCONF= PPPOE.ioconf
-SRCS= if_pppoe.c
+SRCS= if_pppoe.c if_spppsubr.c
SRCS+= pppoe_component.c
diff --git a/sys/rump/net/lib/libshmif/shmif_user.c b/sys/rump/net/lib/libshmif/shmif_user.c
index 4a07dabe055..c8bb52cc625 100644
--- a/sys/rump/net/lib/libshmif/shmif_user.c
+++ b/sys/rump/net/lib/libshmif/shmif_user.c
@@ -1,4 +1,4 @@
-/* $NetBSD: shmif_user.c,v 1.3 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: shmif_user.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $ */
/*-
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: shmif_user.c,v 1.3 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shmif_user.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
#ifndef _KERNEL
#include <sys/types.h>
diff --git a/sys/rump/net/lib/libsockin/sockin_user.c b/sys/rump/net/lib/libsockin/sockin_user.c
index d71ec63fc1c..0623cc7d270 100644
--- a/sys/rump/net/lib/libsockin/sockin_user.c
+++ b/sys/rump/net/lib/libsockin/sockin_user.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sockin_user.c,v 1.2 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: sockin_user.c,v 1.3 2019/01/27 02:08:50 pgoyette Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sockin_user.c,v 1.2 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sockin_user.c,v 1.3 2019/01/27 02:08:50 pgoyette Exp $");
/* for struct msghdr content visibility */
#define _XOPEN_SOURCE 4
diff --git a/sys/rump/net/lib/libvirtif/virtif_user.c b/sys/rump/net/lib/libvirtif/virtif_user.c
index 19fdddeb451..ff61b1bb192 100644
--- a/sys/rump/net/lib/libvirtif/virtif_user.c
+++ b/sys/rump/net/lib/libvirtif/virtif_user.c
@@ -1,4 +1,4 @@
-/* $NetBSD: virtif_user.c,v 1.4 2018/12/12 00:48:44 alnsn Exp $ */
+/* $NetBSD: virtif_user.c,v 1.5 2019/01/27 02:08:50 pgoyette Exp $ */
/*
* Copyright (c) 2013 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtif_user.c,v 1.4 2018/12/12 00:48:44 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtif_user.c,v 1.5 2019/01/27 02:08:50 pgoyette Exp $");
#ifndef _KERNEL
#include <sys/types.h>
diff --git a/sys/sys/compat_stub.h b/sys/sys/compat_stub.h
new file mode 100644
index 00000000000..bd9625d78e7
--- /dev/null
+++ b/sys/sys/compat_stub.h
@@ -0,0 +1,320 @@
+/* $NetBSD: compat_stub.h,v 1.2 2019/01/27 02:08:50 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 _SYS_COMPAT_STUB_H
+#define _SYS_COMPAT_STUB_H
+
+#include <sys/module_hook.h>
+#include <sys/param.h>
+
+/*
+ * Routine hooks for compat_50___sys_ntp_gettime
+ *
+ * MP-hooks not needed since the NTP code is not modular
+ */
+
+struct ntptimeval;
+struct timex;
+
+extern void (*vec_ntp_gettime)(struct ntptimeval *);
+extern int (*vec_ntp_timestatus)(void);
+extern void (*vec_ntp_adjtime1)(struct timex *);
+
+/*
+MODULE_HOOK(ntp_gettime_hook, int, (struct ntptimeval *));
+MODULE_HOOK(ntp_timestatus_hook, int, (void);
+MODULE_HOOK(ntp_adjtime1_hook, int, (struct timex *));
+*/
+
+/*
+ * Routine hooks for SCTP code - used by rtsock
+ *
+ * MP-hooks not needed since the SCTP code is not modular
+ */
+struct ifaddr;
+extern void (*vec_sctp_add_ip_address)(struct ifaddr *);
+extern void (*vec_sctp_delete_ip_address)(struct ifaddr *);
+
+/*
+MODULE_HOOK(sctp_add_ip_address, int, struct ifaddr *);
+MODULE_HOOK(sctp_delete_ip_address, int, struct ifaddr *);
+*/
+
+
+/*
+ * usb devinfo compatability
+ */
+
+struct usbd_device;
+struct usb_device_info_old;
+struct usb_event;
+struct usb_event_old;
+struct uio;
+MODULE_HOOK(usb_subr_30_fill_hook, int,
+ (struct usbd_device *, struct usb_device_info_old *, int,
+ void (*)(struct usbd_device *, char *, size_t, char *, size_t, int, int),
+ int (*)(char *, size_t, int)));
+MODULE_HOOK(usb_subr_30_copy_hook, int,
+ (struct usb_event *, struct usb_event_old *, struct uio *));
+
+/*
+ * Routine vector for dev/ccd ioctl()
+ */
+
+MODULE_HOOK(ccd_ioctl_60_hook, int, (dev_t, u_long, void *, int, struct lwp *,
+ int (*f)(dev_t, u_long, void *, int, struct lwp *)))
+
+/*
+ * Routine vector for dev/clockctl ioctl()
+ */
+
+MODULE_HOOK(clockctl_ioctl_50_hook, int,
+ (dev_t, u_long, void *, int, struct lwp *));
+
+/*
+ * if_sppp device compatability ioctl subroutine
+ */
+
+struct sppp;
+MODULE_HOOK(sppp_params_50_hook, int, (struct sppp *, u_long, void *));
+
+/*
+ * cryptodev compatability ioctl
+ */
+
+struct fcrypt;
+struct session_op;
+struct csession;
+struct crypt_op;
+struct crypt_n_op;
+struct kmutex_t;
+MODULE_HOOK(ocryptof_50_hook, int, (struct file *, u_long, void *));
+
+/*
+ * raidframe compatability
+ */
+
+struct RF_Config_s;
+struct RF_Raid_s;
+MODULE_HOOK(raidframe50_ioctl_hook, int,
+ (int, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **));
+MODULE_HOOK(raidframe80_ioctl_hook, int,
+ (int, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **));
+
+/*
+ * puffs compatability
+ */
+
+struct puffs_req;
+MODULE_HOOK(puffs_50_out_hook, int,
+ (struct puffs_req *, struct puffs_req **, ssize_t *)); /* outgoing */
+MODULE_HOOK(puffs_50_in_hook, void,
+ (struct puffs_req *, struct puffs_req *)); /* incoming */
+
+/*
+ * wsevents compatability
+ */
+
+struct wscons_event;
+struct uio;
+MODULE_HOOK(wsevent_50_copyout_events_hook, int,
+ (const struct wscons_event *, int, struct uio *));
+
+/*
+ * sysmon_power compatability
+ */
+
+struct power_event;
+struct sysmon_pswitch;
+MODULE_HOOK(compat_sysmon_power_40_hook, void,
+ (struct power_event *, struct sysmon_pswitch *, int));
+
+/*
+ * compat_bio indirect function pointer
+ */
+
+MODULE_HOOK(compat_bio_30_hook, int,
+ (void *, u_long, void *, int(*)(void *, u_long, void *)));
+
+/*
+ * vnd_30 ioctl compatability
+ */
+struct vattr;
+MODULE_HOOK(compat_vndioctl_30_hook, int, (u_long, struct lwp *, void *, int,
+ struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *)));
+
+/*
+ * vnd_50 ioctl compatability
+ */
+struct vattr;
+MODULE_HOOK(compat_vndioctl_50_hook, int, (u_long, struct lwp *, void *, int,
+ struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *)));
+
+/*
+ * ieee80211 ioctl compatability
+ */
+struct ieee80211_ostats;
+struct ieee80211_stats;
+
+MODULE_HOOK(ieee80211_ostats_hook, int,
+ (struct ieee80211_ostats *, struct ieee80211_stats *));
+
+/*
+ * if_43 compatability
+ */
+struct socket;
+
+MODULE_HOOK(if_43_cvtcmd_hook, int, (u_long *, u_long));
+MODULE_HOOK(if_43_ifioctl_hook, int,
+ (struct socket *, u_long, u_long, void *, struct lwp *));
+
+/*
+ * if43_20 compatability
+ */
+MODULE_HOOK(if43_20_hook, int, (u_long));
+
+/*
+ * uipc_syscalls_40 compatability
+ */
+
+MODULE_HOOK(uipc_syscalls_40_hook, int, (u_long, void *));
+
+/*
+ * uipc_syscalls_50 compatability
+ */
+
+MODULE_HOOK(uipc_syscalls_50_hook, int, (struct lwp *, u_long, void *));
+
+/*
+ * rtsock 14 compatability
+ */
+struct ifnet;
+struct rt_walkarg;
+struct rt_addrinfo;
+MODULE_HOOK(rtsock_14_oifmsg_hook, void, (struct ifnet *));
+MODULE_HOOK(rtsock_14_iflist_hook, int,
+ (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t));
+
+/*
+ * Hooks for rtsock_50
+ */
+
+struct rtentry;
+struct ifaddr;
+MODULE_HOOK(rtsock_50_oifmsg_hook, void, (struct ifnet *));
+MODULE_HOOK(rtsock_50_iflist_hook, int,
+ (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t));
+MODULE_HOOK(rtsock_50_rt_missmsg_hook, void,
+ (int, const struct rt_addrinfo *, int, int));
+MODULE_HOOK(rtsock_50_rt_ifmsg_hook, void, (struct ifnet *));
+MODULE_HOOK(rtsock_50_rt_newaddrmsg_hook, void,
+ (int, struct ifaddr *, int, struct rtentry *));
+MODULE_HOOK(rtsock_50_rt_ifannouncemsg_hook, void, (struct ifnet *, int));
+MODULE_HOOK(rtsock_50_rt_ieee80211msg_hook, void,
+ (struct ifnet *, int, void *, size_t));
+
+/*
+ * Hooks for rtsock_70
+ */
+struct ifaddr;
+MODULE_HOOK(rtsock_70_newaddr_hook, void, (int, struct ifaddr *));
+MODULE_HOOK(rtsock_70_iflist_hook, int,
+ (struct rt_walkarg *, struct ifaddr *, struct rt_addrinfo *));
+
+/*
+ * modctl handler for old style OSTAT
+ */
+struct iovec;
+MODULE_HOOK(compat_modstat_80_hook, int, (int, struct iovec *, void *));
+
+/*
+ * mask for kern_sig_43's killpg
+ */
+extern int kern_sig_43_pgid_mask;
+
+/*
+ * Hooks for kern_proc.c for netbsd32 compat
+ */
+struct ps_strings;
+MODULE_HOOK(kern_proc_32_copyin_hook, int,
+ (struct proc *, struct ps_strings *));
+MODULE_HOOK(kern_proc_32_base_hook, vaddr_t, (char **, size_t));
+
+/*
+ * Hook to allow sparc fpu code to see if a process is using sunos
+ * emulation, and select proper fup codes
+ */
+struct emul;
+MODULE_HOOK(get_emul_sunos_hook, int, (const struct emul **));
+
+/*
+ * Hooks for rnd_ioctl_50
+ */
+MODULE_HOOK(rnd_ioctl_50_hook, int, (struct file *, u_long, void *));
+MODULE_HOOK(rnd_ioctl_50_32_hook, int, (struct file *, u_long, void *));
+
+/*
+ * Hooks for compat_60 ttioctl and ptmioctl
+ */
+MODULE_HOOK(compat_60_ttioctl_hook, int,
+ (dev_t, u_long, void *, int, struct lwp *));
+MODULE_HOOK(compat_60_ptmioctl_hook, int,
+ (dev_t, u_long, void *, int, struct lwp *));
+
+/*
+ * Hook for compat_10 openat
+ */
+struct pathbuf;
+MODULE_HOOK(compat_10_openat_hook, int, (struct pathbuf **));
+
+/*
+ * Hook for compat_70_unp_addsockcred
+ */
+struct mbuf;
+MODULE_HOOK(compat_70_unp_hook, struct mbuf *,
+ (struct lwp *, struct mbuf *));
+
+/*
+ * Hook for sysvipc50 sysctl
+ */
+#include <sys/sysctl.h>
+MODULE_HOOK(sysvipc50_sysctl_hook, int, (SYSCTLFN_PROTO));
+
+/*
+ * Hook for 32-bit machine name
+ *
+ * This probably would be better placed in compat/netbsd32/netbsd32_mod.c
+ * but the consumer code in linux32_exec_elf32.c is sometimes included in
+ * the main kernel, and not in a compat_netbsd32 module. (In particular,
+ * this is true for i386 and sgimips.)
+ */
+MODULE_HOOK(netbsd32_machine32_hook, const char *, (void));
+#endif /* _SYS_COMPAT_STUB_H */
diff --git a/sys/sys/exec.h b/sys/sys/exec.h
index 1035880885b..99744f0fd2f 100644
--- a/sys/sys/exec.h
+++ b/sys/sys/exec.h
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.h,v 1.153 2018/04/27 18:33:24 christos Exp $ */
+/* $NetBSD: exec.h,v 1.154 2019/01/27 02:08:50 pgoyette Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -316,6 +316,12 @@ int exec_makepathbuf(struct lwp *, const char *, enum uio_seg,
extern int maxexec;
+/*
+ * Utility functions
+ */
+void emul_find_root(struct lwp *, struct exec_package *);
+int emul_find_interp(struct lwp *, struct exec_package *, const char *);
+
#endif /* _KERNEL */
#endif /* !_SYS_EXEC_H_ */
diff --git a/sys/sys/module.h b/sys/sys/module.h
index 4528fe6e972..fd283254300 100644
--- a/sys/sys/module.h
+++ b/sys/sys/module.h
@@ -1,4 +1,4 @@
-/* $NetBSD: module.h,v 1.42 2018/05/28 21:04:40 chs Exp $ */
+/* $NetBSD: module.h,v 1.43 2019/01/27 02:08:50 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -74,11 +74,11 @@ typedef enum modcmd {
/* Module header structure. */
typedef struct modinfo {
- u_int mi_version;
- modclass_t mi_class;
- int (*mi_modcmd)(modcmd_t, void *);
- const char *mi_name;
- const char *mi_required;
+ u_int mi_version;
+ modclass_t mi_class;
+ int (*mi_modcmd)(modcmd_t, void *);
+ const char *mi_name;
+ const char *mi_required;
} const modinfo_t;
/* Per module information, maintained by kern_module.c */
@@ -90,8 +90,9 @@ typedef struct module {
const modinfo_t *mod_info;
struct kobj *mod_kobj;
TAILQ_ENTRY(module) mod_chain;
- struct module *mod_required[MAXMODDEPS];
+ struct module *(*mod_required)[MAXMODDEPS];
u_int mod_nrequired;
+ u_int mod_arequired;
modsrc_t mod_source;
time_t mod_autotime;
specificdata_reference mod_sdref;
@@ -217,6 +218,10 @@ void module_print(const char *, ...) __printflike(1, 2);
extern char module_base[MODULE_BASE_SIZE];
extern const char *module_machine;
+struct netbsd32_modctl_args;
+extern int compat32_80_modctl_compat_stub(struct lwp *,
+ const struct netbsd32_modctl_args *, register_t *);
+
#else /* _KERNEL */
#include <stdint.h>
@@ -237,24 +242,41 @@ typedef struct modctl_load {
enum modctl {
MODCTL_LOAD, /* modctl_load_t *ml */
MODCTL_UNLOAD, /* char *name */
- MODCTL_STAT, /* struct iovec *buffer */
- MODCTL_EXISTS /* enum: 0: load, 1: autoload */
+ MODCTL_OSTAT, /* struct iovec *buffer */
+ MODCTL_EXISTS, /* enum: 0: load, 1: autoload */
+ MODCTL_STAT /* struct iovec *buffer */
};
/*
* This structure intentionally has the same layout for 32 and 64
* bit builds.
*/
+typedef struct omodstat {
+ char oms_name[MAXMODNAME];
+ char oms_required[MAXMODNAME * MAXMODDEPS];
+ uint64_t oms_addr;
+ modsrc_t oms_source;
+ modclass_t oms_class;
+ u_int oms_size;
+ u_int oms_refcnt;
+ u_int oms_flags;
+ u_int oms_reserved[3];
+} omodstat_t;
+
+/*
+ * This structure is used with the newer version of MODCTL_STAT, which
+ * exports strings of arbitrary length for the list of required modules.
+ */
typedef struct modstat {
char ms_name[MAXMODNAME];
- char ms_required[MAXMODNAME * MAXMODDEPS];
uint64_t ms_addr;
modsrc_t ms_source;
modclass_t ms_class;
u_int ms_size;
u_int ms_refcnt;
u_int ms_flags;
- u_int ms_reserved[3];
+ u_int ms_reqoffset; /* offset to module's required list
+ from beginning of iovec buffer! */
} modstat_t;
int modctl(int, void *);
diff --git a/sys/sys/module_hook.h b/sys/sys/module_hook.h
new file mode 100644
index 00000000000..60a5ee47523
--- /dev/null
+++ b/sys/sys/module_hook.h
@@ -0,0 +1,150 @@
+/* $NetBSD: module_hook.h,v 1.2 2019/01/27 02:08:50 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 _SYS_MODULE_HOOK_H
+#define _SYS_MODULE_HOOK_H
+
+#include <sys/param.h> /* for COHERENCY_UNIT, for __cacheline_aligned */
+#include <sys/mutex.h>
+#include <sys/localcount.h>
+#include <sys/condvar.h>
+#include <sys/pserialize.h>
+#include <sys/atomic.h>
+
+/*
+ * Macros for creating MP-safe vectored function calls, where
+ * the function implementations are in modules which could be
+ * unloaded.
+ */
+
+#define MODULE_HOOK(hook, type, args) \
+extern struct hook ## _t { \
+ kmutex_t mtx; \
+ kcondvar_t cv; \
+ struct localcount lc; \
+ pserialize_t psz; \
+ bool hooked; \
+ type (*f)args; \
+} hook __cacheline_aligned;
+
+#define MODULE_SET_HOOK(hook, waitchan, func) \
+do { \
+ \
+ KASSERT(!hook.hooked); \
+ \
+ hook.psz = pserialize_create(); \
+ mutex_init(&hook.mtx, MUTEX_DEFAULT, IPL_NONE); \
+ cv_init(&hook.cv, waitchan); \
+ localcount_init(&hook.lc); \
+ hook.f = func; \
+ \
+ /* Make sure it's initialized before anyone uses it */ \
+ membar_producer(); \
+ \
+ /* Let them use it */ \
+ hook.hooked = true; \
+} while /* CONSTCOND */ (0)
+
+#define MODULE_UNSET_HOOK(hook) \
+do { \
+ \
+ KASSERT(kernconfig_is_held()); \
+ KASSERT(hook.hooked); \
+ KASSERT(hook.f); \
+ \
+ /* Grab the mutex */ \
+ mutex_enter(&hook.mtx); \
+ \
+ /* Prevent new localcount_acquire calls. */ \
+ hook.hooked = false; \
+ \
+ /* \
+ * Wait for localcount_acquire calls already under way \
+ * to finish. \
+ */ \
+ pserialize_perform(hook.psz); \
+ \
+ /* Wait for existing localcount references to drain. */\
+ localcount_drain(&hook.lc, &hook.cv, &hook.mtx); \
+ \
+ /* Release the mutex and clean up all resources */ \
+ mutex_exit(&hook.mtx); \
+ localcount_fini(&hook.lc); \
+ cv_destroy(&hook.cv); \
+ mutex_destroy(&hook.mtx); \
+ pserialize_destroy(hook.psz); \
+} while /* CONSTCOND */ (0)
+
+#define MODULE_CALL_HOOK(hook, args, default, retval) \
+do { \
+ bool __hooked; \
+ int __hook_s; \
+ \
+ __hook_s = pserialize_read_enter(); \
+ __hooked = hook.hooked; \
+ if (__hooked) { \
+ membar_consumer(); \
+ localcount_acquire(&hook.lc); \
+ } \
+ pserialize_read_exit(__hook_s); \
+ \
+ if (__hooked) { \
+ retval = (*hook.f)args; \
+ localcount_release(&hook.lc, &hook.cv, \
+ &hook.mtx); \
+ } else { \
+ retval = default; \
+ } \
+} while /* CONSTCOND */ (0)
+
+#define MODULE_CALL_VOID_HOOK(hook, args, default) \
+do { \
+ bool __hooked; \
+ int __hook_s; \
+ \
+ __hook_s = pserialize_read_enter(); \
+ __hooked = hook.hooked; \
+ if (__hooked) { \
+ membar_consumer(); \
+ localcount_acquire(&hook.lc); \
+ } \
+ pserialize_read_exit(__hook_s); \
+ \
+ if (__hooked) { \
+ (*hook.f)args; \
+ localcount_release(&hook.lc, &hook.cv, \
+ &hook.mtx); \
+ } else { \
+ default; \
+ } \
+} while /* CONSTCOND */ (0)
+
+#endif /* _SYS_MODULE_HOOK_H */
diff --git a/sys/sys/param.h b/sys/sys/param.h
index c24c1620655..00ff9d425fb 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.578 2019/01/23 07:05:52 msaitoh Exp $ */
+/* $NetBSD: param.h,v 1.579 2019/01/27 02:08:50 pgoyette Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -87,7 +87,7 @@
#define NetBSD 199905 /* NetBSD version (year & month). */
/*
- * There macros determine if we are running in protected mode or not.
+ * These macros determine if we are running in protected mode or not.
* _HARDKERNEL: code uses kernel namespace and runs in hw priviledged mode
* _SOFTKERNEL: code uses kernel namespace but runs without hw priviledges
*/
diff --git a/sys/sys/tty.h b/sys/sys/tty.h
index ac99126b1ca..47a8a29e6c4 100644
--- a/sys/sys/tty.h
+++ b/sys/sys/tty.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.h,v 1.94 2017/10/31 10:45:19 martin Exp $ */
+/* $NetBSD: tty.h,v 1.95 2019/01/27 02:08:50 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -313,7 +313,10 @@ bool ttypull(struct tty *);
int clalloc(struct clist *, int, int);
void clfree(struct clist *);
-extern int (*ttcompatvec)(struct tty *, u_long, void *, int, struct lwp *);
+/* overwritten to be non-null if ptm(4) is present */
+
+struct ptm_pty;
+extern struct ptm_pty *ptm;
unsigned char tty_getctrlchar(struct tty *, unsigned /*which*/);
void tty_setctrlchar(struct tty *, unsigned /*which*/, unsigned char /*val*/);
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index f522694664b..46be4645b20 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_swap.c,v 1.178 2018/11/15 14:19:23 maxv Exp $ */
+/* $NetBSD: uvm_swap.c,v 1.179 2019/01/27 02:08:50 pgoyette Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.178 2018/11/15 14:19:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.179 2019/01/27 02:08:50 pgoyette Exp $");
#include "opt_uvmhist.h"
#include "opt_compat_netbsd.h"
@@ -427,7 +427,7 @@ swapent_cvt(struct swapent *se, const struct swapdev *sdp, int inuse)
strcpy(se->se_path, sdp->swd_path);
}
-int (*uvm_swap_stats13)(const struct sys_swapctl_args *, register_t *) =
+int (*uvm_swap_stats13)(const struct sys_swapctl_args *, register_t *) =
(void *)enosys;
int (*uvm_swap_stats50)(const struct sys_swapctl_args *, register_t *) =
(void *)enosys;