compat_stub.h revision 1.19
11.19Spgoyette/* $NetBSD: compat_stub.h,v 1.19 2019/09/27 00:32:03 pgoyette Exp $ */ 21.2Spgoyette 31.2Spgoyette/*- 41.2Spgoyette * Copyright (c) 2018 The NetBSD Foundation, Inc. 51.2Spgoyette * All rights reserved. 61.2Spgoyette * 71.2Spgoyette * This code is derived from software contributed to The NetBSD Foundation 81.2Spgoyette * by Paul Goyette 91.2Spgoyette * 101.2Spgoyette * Redistribution and use in source and binary forms, with or without 111.2Spgoyette * modification, are permitted provided that the following conditions 121.2Spgoyette * are met: 131.2Spgoyette * 1. Redistributions of source code must retain the above copyright 141.2Spgoyette * notice, this list of conditions and the following disclaimer. 151.2Spgoyette * 2. Redistributions in binary form must reproduce the above copyright 161.2Spgoyette * notice, this list of conditions and the following disclaimer in the 171.2Spgoyette * documentation and/or other materials provided with the distribution. 181.2Spgoyette * 191.2Spgoyette * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 201.2Spgoyette * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 211.2Spgoyette * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 221.2Spgoyette * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 231.2Spgoyette * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 241.2Spgoyette * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 251.2Spgoyette * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 261.2Spgoyette * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 271.2Spgoyette * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 281.2Spgoyette * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 291.2Spgoyette * POSSIBILITY OF SUCH DAMAGE. 301.2Spgoyette */ 311.2Spgoyette 321.2Spgoyette#ifndef _SYS_COMPAT_STUB_H 331.2Spgoyette#define _SYS_COMPAT_STUB_H 341.2Spgoyette 351.2Spgoyette#include <sys/module_hook.h> 361.2Spgoyette#include <sys/param.h> 371.15Sroy#include <sys/socket.h> 381.2Spgoyette 391.2Spgoyette/* 401.7Spgoyette * NOTE: If you make changes here, please remember to update the 411.7Spgoyette * kernel version number in sys/param.h to ensure that kernel 421.7Spgoyette * and modules stay in sync. 431.7Spgoyette */ 441.7Spgoyette 451.7Spgoyette/* 461.2Spgoyette * Routine hooks for compat_50___sys_ntp_gettime 471.2Spgoyette * 481.2Spgoyette * MP-hooks not needed since the NTP code is not modular 491.2Spgoyette */ 501.2Spgoyette 511.2Spgoyettestruct ntptimeval; 521.2Spgoyettestruct timex; 531.2Spgoyette 541.2Spgoyetteextern void (*vec_ntp_gettime)(struct ntptimeval *); 551.2Spgoyetteextern int (*vec_ntp_timestatus)(void); 561.2Spgoyetteextern void (*vec_ntp_adjtime1)(struct timex *); 571.2Spgoyette 581.2Spgoyette/* 591.2SpgoyetteMODULE_HOOK(ntp_gettime_hook, int, (struct ntptimeval *)); 601.2SpgoyetteMODULE_HOOK(ntp_timestatus_hook, int, (void); 611.2SpgoyetteMODULE_HOOK(ntp_adjtime1_hook, int, (struct timex *)); 621.2Spgoyette*/ 631.2Spgoyette 641.2Spgoyette/* 651.2Spgoyette * Routine hooks for SCTP code - used by rtsock 661.2Spgoyette * 671.2Spgoyette * MP-hooks not needed since the SCTP code is not modular 681.2Spgoyette */ 691.2Spgoyettestruct ifaddr; 701.2Spgoyetteextern void (*vec_sctp_add_ip_address)(struct ifaddr *); 711.2Spgoyetteextern void (*vec_sctp_delete_ip_address)(struct ifaddr *); 721.2Spgoyette 731.2Spgoyette/* 741.2SpgoyetteMODULE_HOOK(sctp_add_ip_address, int, struct ifaddr *); 751.2SpgoyetteMODULE_HOOK(sctp_delete_ip_address, int, struct ifaddr *); 761.2Spgoyette*/ 771.2Spgoyette 781.2Spgoyette 791.2Spgoyette/* 801.5Schristos * usb devinfo compatibility 811.2Spgoyette */ 821.2Spgoyette 831.2Spgoyettestruct usbd_device; 841.2Spgoyettestruct usb_device_info_old; 851.2Spgoyettestruct usb_event; 861.2Spgoyettestruct usb_event_old; 871.2Spgoyettestruct uio; 881.8SpgoyetteMODULE_HOOK(usb_subr_fill_30_hook, int, 891.2Spgoyette (struct usbd_device *, struct usb_device_info_old *, int, 901.2Spgoyette void (*)(struct usbd_device *, char *, size_t, char *, size_t, int, int), 911.2Spgoyette int (*)(char *, size_t, int))); 921.8SpgoyetteMODULE_HOOK(usb_subr_copy_30_hook, int, 931.2Spgoyette (struct usb_event *, struct usb_event_old *, struct uio *)); 941.2Spgoyette 951.2Spgoyette/* 961.2Spgoyette * Routine vector for dev/ccd ioctl() 971.2Spgoyette */ 981.2Spgoyette 991.2SpgoyetteMODULE_HOOK(ccd_ioctl_60_hook, int, (dev_t, u_long, void *, int, struct lwp *, 1001.2Spgoyette int (*f)(dev_t, u_long, void *, int, struct lwp *))) 1011.2Spgoyette 1021.2Spgoyette/* 1031.2Spgoyette * Routine vector for dev/clockctl ioctl() 1041.2Spgoyette */ 1051.2Spgoyette 1061.2SpgoyetteMODULE_HOOK(clockctl_ioctl_50_hook, int, 1071.2Spgoyette (dev_t, u_long, void *, int, struct lwp *)); 1081.2Spgoyette 1091.2Spgoyette/* 1101.5Schristos * if_sppp device compatibility ioctl subroutine 1111.2Spgoyette */ 1121.2Spgoyette 1131.2Spgoyettestruct sppp; 1141.2SpgoyetteMODULE_HOOK(sppp_params_50_hook, int, (struct sppp *, u_long, void *)); 1151.2Spgoyette 1161.2Spgoyette/* 1171.5Schristos * cryptodev compatibility ioctl 1181.2Spgoyette */ 1191.2Spgoyette 1201.2Spgoyettestruct fcrypt; 1211.2Spgoyettestruct session_op; 1221.2Spgoyettestruct csession; 1231.2Spgoyettestruct crypt_op; 1241.2Spgoyettestruct crypt_n_op; 1251.2Spgoyettestruct kmutex_t; 1261.2SpgoyetteMODULE_HOOK(ocryptof_50_hook, int, (struct file *, u_long, void *)); 1271.2Spgoyette 1281.2Spgoyette/* 1291.5Schristos * raidframe compatibility 1301.2Spgoyette */ 1311.11Schristosstruct raid_softc; 1321.8SpgoyetteMODULE_HOOK(raidframe_ioctl_50_hook, int, 1331.11Schristos (struct raid_softc *, u_long, void *)); 1341.8SpgoyetteMODULE_HOOK(raidframe_ioctl_80_hook, int, 1351.11Schristos (struct raid_softc *, u_long, void *)); 1361.11SchristosMODULE_HOOK(raidframe_netbsd32_ioctl_hook, int, 1371.11Schristos (struct raid_softc *, u_long, void *)); 1381.2Spgoyette 1391.2Spgoyette/* 1401.5Schristos * puffs compatibility 1411.2Spgoyette */ 1421.2Spgoyette 1431.2Spgoyettestruct puffs_req; 1441.8SpgoyetteMODULE_HOOK(puffs_out_50_hook, int, 1451.2Spgoyette (struct puffs_req *, struct puffs_req **, ssize_t *)); /* outgoing */ 1461.8SpgoyetteMODULE_HOOK(puffs_in_50_hook, void, 1471.2Spgoyette (struct puffs_req *, struct puffs_req *)); /* incoming */ 1481.2Spgoyette 1491.2Spgoyette/* 1501.5Schristos * wsevents compatibility 1511.2Spgoyette */ 1521.2Spgoyette 1531.2Spgoyettestruct wscons_event; 1541.2Spgoyettestruct uio; 1551.8SpgoyetteMODULE_HOOK(wscons_copyout_events_50_hook, int, 1561.2Spgoyette (const struct wscons_event *, int, struct uio *)); 1571.2Spgoyette 1581.2Spgoyette/* 1591.5Schristos * sysmon_power compatibility 1601.2Spgoyette */ 1611.2Spgoyette 1621.2Spgoyettestruct power_event; 1631.2Spgoyettestruct sysmon_pswitch; 1641.2SpgoyetteMODULE_HOOK(compat_sysmon_power_40_hook, void, 1651.2Spgoyette (struct power_event *, struct sysmon_pswitch *, int)); 1661.2Spgoyette 1671.2Spgoyette/* 1681.2Spgoyette * compat_bio indirect function pointer 1691.2Spgoyette */ 1701.2Spgoyette 1711.2SpgoyetteMODULE_HOOK(compat_bio_30_hook, int, 1721.2Spgoyette (void *, u_long, void *, int(*)(void *, u_long, void *))); 1731.2Spgoyette 1741.2Spgoyette/* 1751.5Schristos * vnd_30 ioctl compatibility 1761.2Spgoyette */ 1771.2Spgoyettestruct vattr; 1781.2SpgoyetteMODULE_HOOK(compat_vndioctl_30_hook, int, (u_long, struct lwp *, void *, int, 1791.2Spgoyette struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *))); 1801.2Spgoyette 1811.2Spgoyette/* 1821.5Schristos * vnd_50 ioctl compatibility 1831.2Spgoyette */ 1841.2Spgoyettestruct vattr; 1851.2SpgoyetteMODULE_HOOK(compat_vndioctl_50_hook, int, (u_long, struct lwp *, void *, int, 1861.2Spgoyette struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *))); 1871.2Spgoyette 1881.2Spgoyette/* 1891.5Schristos * ieee80211 ioctl compatibility 1901.2Spgoyette */ 1911.4Schristosstruct ieee80211com; 1921.2Spgoyette 1931.8SpgoyetteMODULE_HOOK(ieee80211_ioctl_20_hook, int, 1941.5Schristos (struct ieee80211com *, u_long, void *)); 1951.2Spgoyette 1961.2Spgoyette/* 1971.5Schristos * if_43 compatibility 1981.2Spgoyette */ 1991.2Spgoyettestruct socket; 2001.2Spgoyette 2011.8SpgoyetteMODULE_HOOK(if_cvtcmd_43_hook, int, (u_long *, u_long)); 2021.8SpgoyetteMODULE_HOOK(if_ifioctl_43_hook, int, 2031.2Spgoyette (struct socket *, u_long, u_long, void *, struct lwp *)); 2041.2Spgoyette 2051.2Spgoyette/* 2061.6Spgoyette * if43_cvtcmd_20 compatibility 2071.2Spgoyette */ 2081.6SpgoyetteMODULE_HOOK(if43_cvtcmd_20_hook, int, (u_long)); 2091.2Spgoyette 2101.2Spgoyette/* 2111.3Schristos * tty 43 ioctl compatibility 2121.3Schristos */ 2131.3Schristosstruct tty; 2141.3Schristos 2151.8SpgoyetteMODULE_HOOK(tty_ttioctl_43_hook, int, 2161.3Schristos (struct tty *, u_long, void *, int, struct lwp *)); 2171.3Schristos 2181.3Schristos/* 2191.5Schristos * uipc_syscalls_40 compatibility 2201.2Spgoyette */ 2211.2Spgoyette 2221.2SpgoyetteMODULE_HOOK(uipc_syscalls_40_hook, int, (u_long, void *)); 2231.2Spgoyette 2241.2Spgoyette/* 2251.12Spgoyette * uipc_socket_50 compatibility 2261.12Spgoyette */ 2271.12Spgoyettestruct sockopt; 2281.12Spgoyettestruct mbuf; 2291.12Spgoyette 2301.12SpgoyetteMODULE_HOOK(uipc_socket_50_setopt1_hook, int, 2311.13Spgoyette (int, struct socket *, const struct sockopt *)); 2321.12SpgoyetteMODULE_HOOK(uipc_socket_50_getopt1_hook, int, 2331.13Spgoyette (int, struct socket *, struct sockopt *)); 2341.19SpgoyetteMODULE_HOOK(uipc_socket_50_sbts_hook, int, (int, struct mbuf ***)); 2351.12Spgoyette 2361.12Spgoyette/* 2371.5Schristos * uipc_syscalls_50 compatibility 2381.2Spgoyette */ 2391.2Spgoyette 2401.2SpgoyetteMODULE_HOOK(uipc_syscalls_50_hook, int, (struct lwp *, u_long, void *)); 2411.2Spgoyette 2421.2Spgoyette/* 2431.5Schristos * rtsock 14 compatibility 2441.2Spgoyette */ 2451.2Spgoyettestruct ifnet; 2461.2Spgoyettestruct rt_walkarg; 2471.2Spgoyettestruct rt_addrinfo; 2481.8SpgoyetteMODULE_HOOK(rtsock_oifmsg_14_hook, void, (struct ifnet *)); 2491.8SpgoyetteMODULE_HOOK(rtsock_iflist_14_hook, int, 2501.2Spgoyette (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 2511.2Spgoyette 2521.2Spgoyette/* 2531.2Spgoyette * Hooks for rtsock_50 2541.2Spgoyette */ 2551.2Spgoyette 2561.2Spgoyettestruct rtentry; 2571.2Spgoyettestruct ifaddr; 2581.8SpgoyetteMODULE_HOOK(rtsock_oifmsg_50_hook, void, (struct ifnet *)); 2591.8SpgoyetteMODULE_HOOK(rtsock_iflist_50_hook, int, 2601.2Spgoyette (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 2611.8SpgoyetteMODULE_HOOK(rtsock_rt_missmsg_50_hook, void, 2621.2Spgoyette (int, const struct rt_addrinfo *, int, int)); 2631.8SpgoyetteMODULE_HOOK(rtsock_rt_ifmsg_50_hook, void, (struct ifnet *)); 2641.14SroyMODULE_HOOK(rtsock_rt_addrmsg_rt_50_hook, void, 2651.2Spgoyette (int, struct ifaddr *, int, struct rtentry *)); 2661.15SroyMODULE_HOOK(rtsock_rt_addrmsg_src_50_hook, void, 2671.15Sroy (int, struct ifaddr *, const struct sockaddr *)); 2681.14SroyMODULE_HOOK(rtsock_rt_addrmsg_50_hook, void, (int, struct ifaddr *)); 2691.8SpgoyetteMODULE_HOOK(rtsock_rt_ifannouncemsg_50_hook, void, (struct ifnet *, int)); 2701.8SpgoyetteMODULE_HOOK(rtsock_rt_ieee80211msg_50_hook, void, 2711.2Spgoyette (struct ifnet *, int, void *, size_t)); 2721.2Spgoyette 2731.2Spgoyette/* 2741.2Spgoyette * Hooks for rtsock_70 2751.2Spgoyette */ 2761.2Spgoyettestruct ifaddr; 2771.8SpgoyetteMODULE_HOOK(rtsock_newaddr_70_hook, void, (int, struct ifaddr *)); 2781.8SpgoyetteMODULE_HOOK(rtsock_iflist_70_hook, int, 2791.2Spgoyette (struct rt_walkarg *, struct ifaddr *, struct rt_addrinfo *)); 2801.2Spgoyette 2811.2Spgoyette/* 2821.2Spgoyette * modctl handler for old style OSTAT 2831.2Spgoyette */ 2841.2Spgoyettestruct iovec; 2851.2SpgoyetteMODULE_HOOK(compat_modstat_80_hook, int, (int, struct iovec *, void *)); 2861.2Spgoyette 2871.2Spgoyette/* 2881.2Spgoyette * mask for kern_sig_43's killpg 2891.2Spgoyette */ 2901.2Spgoyetteextern int kern_sig_43_pgid_mask; 2911.2Spgoyette 2921.2Spgoyette/* 2931.2Spgoyette * Hooks for kern_proc.c for netbsd32 compat 2941.2Spgoyette */ 2951.2Spgoyettestruct ps_strings; 2961.8SpgoyetteMODULE_HOOK(kern_proc32_copyin_hook, int, 2971.2Spgoyette (struct proc *, struct ps_strings *)); 2981.8SpgoyetteMODULE_HOOK(kern_proc32_base_hook, vaddr_t, (char **, size_t)); 2991.2Spgoyette 3001.2Spgoyette/* 3011.2Spgoyette * Hook to allow sparc fpu code to see if a process is using sunos 3021.2Spgoyette * emulation, and select proper fup codes 3031.2Spgoyette */ 3041.2Spgoyettestruct emul; 3051.2SpgoyetteMODULE_HOOK(get_emul_sunos_hook, int, (const struct emul **)); 3061.2Spgoyette 3071.2Spgoyette/* 3081.2Spgoyette * Hooks for rnd_ioctl_50 3091.2Spgoyette */ 3101.2SpgoyetteMODULE_HOOK(rnd_ioctl_50_hook, int, (struct file *, u_long, void *)); 3111.8SpgoyetteMODULE_HOOK(rnd_ioctl32_50_hook, int, (struct file *, u_long, void *)); 3121.2Spgoyette 3131.2Spgoyette/* 3141.2Spgoyette * Hooks for compat_60 ttioctl and ptmioctl 3151.2Spgoyette */ 3161.8SpgoyetteMODULE_HOOK(tty_ttioctl_60_hook, int, 3171.3Schristos (struct tty *, u_long, void *, int, struct lwp *)); 3181.8SpgoyetteMODULE_HOOK(tty_ptmioctl_60_hook, int, 3191.2Spgoyette (dev_t, u_long, void *, int, struct lwp *)); 3201.2Spgoyette 3211.2Spgoyette/* 3221.2Spgoyette * Hook for compat_10 openat 3231.2Spgoyette */ 3241.2Spgoyettestruct pathbuf; 3251.8SpgoyetteMODULE_HOOK(vfs_openat_10_hook, int, (struct pathbuf **)); 3261.2Spgoyette 3271.2Spgoyette/* 3281.2Spgoyette * Hook for compat_70_unp_addsockcred 3291.2Spgoyette */ 3301.8SpgoyetteMODULE_HOOK(uipc_unp_70_hook, struct mbuf *, 3311.2Spgoyette (struct lwp *, struct mbuf *)); 3321.2Spgoyette 3331.2Spgoyette/* 3341.2Spgoyette * Hook for sysvipc50 sysctl 3351.2Spgoyette */ 3361.2Spgoyette#include <sys/sysctl.h> 3371.8SpgoyetteMODULE_HOOK(sysvipc_sysctl_50_hook, int, (SYSCTLFN_PROTO)); 3381.2Spgoyette 3391.16Smsaitoh/* 3401.16Smsaitoh * ifmedia_80 compatibility 3411.16Smsaitoh */ 3421.16Smsaitoh 3431.16Smsaitohstruct ifmedia; 3441.16Smsaitohstruct ifreq; 3451.16SmsaitohMODULE_HOOK(ifmedia_80_pre_hook, int, (struct ifreq *, u_long *, bool *)); 3461.16SmsaitohMODULE_HOOK(ifmedia_80_post_hook, int, (struct ifreq *, u_long)); 3471.16Smsaitoh 3481.2Spgoyette/* 3491.2Spgoyette * Hook for 32-bit machine name 3501.2Spgoyette * 3511.2Spgoyette * This probably would be better placed in compat/netbsd32/netbsd32_mod.c 3521.2Spgoyette * but the consumer code in linux32_exec_elf32.c is sometimes included in 3531.2Spgoyette * the main kernel, and not in a compat_netbsd32 module. (In particular, 3541.2Spgoyette * this is true for i386 and sgimips.) 3551.2Spgoyette */ 3561.18Smrgstruct reg; 3571.2SpgoyetteMODULE_HOOK(netbsd32_machine32_hook, const char *, (void)); 3581.17SchristosMODULE_HOOK(netbsd32_reg_validate_hook, int, 3591.17Schristos (struct lwp *, const struct reg *)); 3601.2Spgoyette#endif /* _SYS_COMPAT_STUB_H */ 361