2019-11-20 22:37:51 +03:00
|
|
|
/* $NetBSD: compat_stub.c,v 1.19 2019/11/20 19:37:53 pgoyette Exp $ */
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* 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"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/compat_stub.h>
|
|
|
|
|
|
|
|
#ifdef NTP
|
|
|
|
#include <sys/timespec.h>
|
|
|
|
#include <sys/timex.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
|
2019-07-17 01:57:55 +03:00
|
|
|
*
|
|
|
|
* For now, just point these at NULL. Network initialization code
|
|
|
|
* in if.c will overwrite these with correct values. This is needed
|
|
|
|
* to enable building of rumpkern library without creating circular
|
|
|
|
* dependency with rumpnet library
|
2019-01-27 05:08:33 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
|
|
|
|
void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* usb device_info compatability
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct usb_subr_fill_30_hook_t usb_subr_fill_30_hook;
|
|
|
|
struct usb_subr_copy_30_hook_t usb_subr_copy_30_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct raidframe_ioctl_50_hook_t raidframe_ioctl_50_hook;
|
|
|
|
struct raidframe_ioctl_80_hook_t raidframe_ioctl_80_hook;
|
2019-02-06 02:28:02 +03:00
|
|
|
struct raidframe_netbsd32_ioctl_hook_t raidframe_netbsd32_ioctl_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* puffs compatability
|
|
|
|
*/
|
|
|
|
|
2019-01-29 12:28:50 +03:00
|
|
|
struct puffs_out_50_hook_t puffs_out_50_hook;
|
|
|
|
struct puffs_in_50_hook_t puffs_in_50_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* wsevents compatability
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct wscons_copyout_events_50_hook_t wscons_copyout_events_50_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct ieee80211_ioctl_20_hook_t ieee80211_ioctl_20_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* if_43 compatability
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct if_cvtcmd_43_hook_t if_cvtcmd_43_hook;
|
|
|
|
struct if_ifioctl_43_hook_t if_ifioctl_43_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
2019-01-29 07:10:10 +03:00
|
|
|
* if43_cvtcmd_20 compatability
|
2019-01-27 05:08:33 +03:00
|
|
|
*/
|
2019-01-29 07:10:10 +03:00
|
|
|
struct if43_cvtcmd_20_hook_t if43_cvtcmd_20_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
2019-01-28 18:46:49 +03:00
|
|
|
/*
|
|
|
|
* tty 43 ioctl compatibility
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct tty_ttioctl_43_hook_t tty_ttioctl_43_hook;
|
2019-01-28 18:46:49 +03:00
|
|
|
|
2019-01-27 05:08:33 +03:00
|
|
|
/*
|
2019-04-15 05:07:11 +03:00
|
|
|
* uipc_syscalls_40 compatibility
|
2019-01-27 05:08:33 +03:00
|
|
|
*/
|
|
|
|
struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
|
|
|
|
|
2019-04-15 05:07:11 +03:00
|
|
|
/*
|
|
|
|
* uipc_socket_50 compatibility
|
|
|
|
*/
|
|
|
|
struct uipc_socket_50_setopt1_hook_t uipc_socket_50_setopt1_hook;
|
|
|
|
struct uipc_socket_50_getopt1_hook_t uipc_socket_50_getopt1_hook;
|
|
|
|
struct uipc_socket_50_sbts_hook_t uipc_socket_50_sbts_hook;
|
|
|
|
|
2019-01-27 05:08:33 +03:00
|
|
|
/*
|
2019-01-28 18:46:49 +03:00
|
|
|
* uipc_syscalls_50 compatability
|
2019-01-27 05:08:33 +03:00
|
|
|
*/
|
|
|
|
struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* rtsock 14 compatability
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct rtsock_oifmsg_14_hook_t rtsock_oifmsg_14_hook;
|
|
|
|
struct rtsock_iflist_14_hook_t rtsock_iflist_14_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* rtsock 50 compatability
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct rtsock_iflist_50_hook_t rtsock_iflist_50_hook;
|
|
|
|
struct rtsock_oifmsg_50_hook_t rtsock_oifmsg_50_hook;
|
|
|
|
struct rtsock_rt_missmsg_50_hook_t rtsock_rt_missmsg_50_hook;
|
|
|
|
struct rtsock_rt_ifmsg_50_hook_t rtsock_rt_ifmsg_50_hook;
|
|
|
|
struct rtsock_rt_ifannouncemsg_50_hook_t rtsock_rt_ifannouncemsg_50_hook;
|
2019-04-29 14:57:22 +03:00
|
|
|
struct rtsock_rt_addrmsg_rt_50_hook_t rtsock_rt_addrmsg_rt_50_hook;
|
2019-04-29 19:12:30 +03:00
|
|
|
struct rtsock_rt_addrmsg_src_50_hook_t rtsock_rt_addrmsg_src_50_hook;
|
2019-04-29 14:57:22 +03:00
|
|
|
struct rtsock_rt_addrmsg_50_hook_t rtsock_rt_addrmsg_50_hook;
|
2019-01-29 12:28:50 +03:00
|
|
|
struct rtsock_rt_ieee80211msg_50_hook_t rtsock_rt_ieee80211msg_50_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* rtsock 70 compatability
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct rtsock_newaddr_70_hook_t rtsock_newaddr_70_hook;
|
|
|
|
struct rtsock_iflist_70_hook_t rtsock_iflist_70_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct kern_proc32_copyin_hook_t kern_proc32_copyin_hook;
|
|
|
|
struct kern_proc32_base_hook_t kern_proc32_base_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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;
|
2019-01-29 12:28:50 +03:00
|
|
|
struct rnd_ioctl32_50_hook_t rnd_ioctl32_50_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Hooks for compat_60 ttioctl and ptmioctl
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct tty_ttioctl_60_hook_t tty_ttioctl_60_hook;
|
|
|
|
struct tty_ptmioctl_60_hook_t tty_ptmioctl_60_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Hook for compat_10 openat
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct vfs_openat_10_hook_t vfs_openat_10_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Hook for compat_70_unp_addsockcred
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct uipc_unp_70_hook_t uipc_unp_70_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Hook for sysvipc50_sysctl
|
|
|
|
*/
|
2019-01-29 12:28:50 +03:00
|
|
|
struct sysvipc_sysctl_50_hook_t sysvipc_sysctl_50_hook;
|
2019-01-27 05:08:33 +03:00
|
|
|
|
2019-05-17 10:37:11 +03:00
|
|
|
/*
|
|
|
|
* ifmedia_80 compatability
|
|
|
|
*/
|
|
|
|
struct ifmedia_80_pre_hook_t ifmedia_80_pre_hook;
|
|
|
|
struct ifmedia_80_post_hook_t ifmedia_80_post_hook;
|
|
|
|
|
2019-01-27 05:08:33 +03:00
|
|
|
/*
|
|
|
|
* 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;
|
2019-07-20 21:23:05 +03:00
|
|
|
struct netbsd32_reg_validate_hook_t netbsd32_reg_validate_hook;
|
2019-11-10 16:28:06 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Hook for sendsig_sigcontext_16
|
|
|
|
*/
|
|
|
|
struct sendsig_sigcontext_16_hook_t sendsig_sigcontext_16_hook;
|
2019-11-10 17:20:50 +03:00
|
|
|
|
|
|
|
/*
|
2019-11-20 22:37:51 +03:00
|
|
|
* Hooks for coredumps
|
2019-11-10 17:20:50 +03:00
|
|
|
*/
|
|
|
|
struct coredump_hook_t coredump_hook;
|
2019-11-20 22:37:51 +03:00
|
|
|
struct coredump_offset_hook_t coredump_offset_hook;
|
|
|
|
struct coredump_write_hook_t coredump_write_hook;
|
|
|
|
struct coredump_netbsd_hook_t coredump_netbsd_hook;
|
|
|
|
struct uvm_coredump_walkmap_hook_t uvm_coredump_walkmap_hook;
|
|
|
|
struct uvm_coredump_count_segs_hook_t uvm_coredump_count_segs_hook;
|
|
|
|
|
|
|
|
|