Home | History | Annotate | Line # | Download | only in kern
compat_stub.c revision 1.1.2.42
      1  1.1.2.42  pgoyette /* $NetBSD: compat_stub.c,v 1.1.2.42 2019/01/25 09:36:09 pgoyette Exp $	*/
      2   1.1.2.1  pgoyette 
      3   1.1.2.1  pgoyette /*-
      4   1.1.2.1  pgoyette  * Copyright (c) 2018 The NetBSD Foundation, Inc.
      5   1.1.2.1  pgoyette  * All rights reserved.
      6   1.1.2.1  pgoyette  *
      7   1.1.2.1  pgoyette  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1.2.1  pgoyette  * by Paul Goyette
      9   1.1.2.1  pgoyette  *
     10   1.1.2.1  pgoyette  * Redistribution and use in source and binary forms, with or without
     11   1.1.2.1  pgoyette  * modification, are permitted provided that the following conditions
     12   1.1.2.1  pgoyette  * are met:
     13   1.1.2.1  pgoyette  * 1. Redistributions of source code must retain the above copyright
     14   1.1.2.1  pgoyette  *    notice, this list of conditions and the following disclaimer.
     15   1.1.2.1  pgoyette  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1.2.1  pgoyette  *    notice, this list of conditions and the following disclaimer in the
     17   1.1.2.1  pgoyette  *    documentation and/or other materials provided with the distribution.
     18   1.1.2.1  pgoyette  *
     19   1.1.2.1  pgoyette  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20   1.1.2.1  pgoyette  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21   1.1.2.1  pgoyette  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22   1.1.2.1  pgoyette  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23   1.1.2.1  pgoyette  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24   1.1.2.1  pgoyette  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25   1.1.2.1  pgoyette  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26   1.1.2.1  pgoyette  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27   1.1.2.1  pgoyette  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28   1.1.2.1  pgoyette  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29   1.1.2.1  pgoyette  * POSSIBILITY OF SUCH DAMAGE.
     30   1.1.2.1  pgoyette  */
     31   1.1.2.1  pgoyette 
     32   1.1.2.1  pgoyette #include <sys/cdefs.h>
     33   1.1.2.1  pgoyette 
     34   1.1.2.1  pgoyette #ifdef _KERNEL_OPT
     35   1.1.2.1  pgoyette #include "opt_ntp.h"
     36  1.1.2.37  pgoyette #include "opt_sctp.h"
     37   1.1.2.1  pgoyette #endif
     38   1.1.2.1  pgoyette 
     39   1.1.2.1  pgoyette #include <sys/systm.h>
     40   1.1.2.1  pgoyette #include <sys/compat_stub.h>
     41   1.1.2.1  pgoyette 
     42  1.1.2.16  pgoyette #ifdef NTP
     43  1.1.2.16  pgoyette #include <sys/timespec.h>
     44  1.1.2.16  pgoyette #include <sys/timex.h>
     45  1.1.2.16  pgoyette #endif
     46  1.1.2.16  pgoyette 
     47  1.1.2.37  pgoyette #ifdef SCTP
     48  1.1.2.37  pgoyette #include <netinet/sctp_asconf.h>
     49  1.1.2.37  pgoyette #endif
     50  1.1.2.37  pgoyette 
     51   1.1.2.1  pgoyette /*
     52   1.1.2.1  pgoyette  * Routine vectors for compat_50___sys_ntp_gettime
     53  1.1.2.18  pgoyette  *
     54  1.1.2.18  pgoyette  * MP-hooks not needed since the NTP code is not modular
     55   1.1.2.1  pgoyette  */
     56   1.1.2.1  pgoyette 
     57   1.1.2.1  pgoyette #ifdef NTP
     58   1.1.2.1  pgoyette void (*vec_ntp_gettime)(struct ntptimeval *) = ntp_gettime;
     59   1.1.2.1  pgoyette int (*vec_ntp_timestatus)(void) = ntp_timestatus;
     60  1.1.2.25  pgoyette void (*vec_ntp_adjtime1)(struct timex *) = ntp_adjtime1;
     61   1.1.2.1  pgoyette #else
     62   1.1.2.1  pgoyette void (*vec_ntp_gettime)(struct ntptimeval *) = NULL;
     63   1.1.2.1  pgoyette int (*vec_ntp_timestatus)(void) = NULL;
     64  1.1.2.25  pgoyette void (*vec_ntp_adjtime1)(struct timex *) = NULL;
     65   1.1.2.1  pgoyette #endif
     66   1.1.2.1  pgoyette 
     67  1.1.2.39  pgoyette /*
     68  1.1.2.39  pgoyette  * Routine vectors for sctp (called from within rtsock)
     69  1.1.2.39  pgoyette  *
     70  1.1.2.39  pgoyette  * MP-hooks not needed since the SCTP code is not modular
     71  1.1.2.39  pgoyette  */
     72  1.1.2.39  pgoyette 
     73  1.1.2.36  pgoyette #ifdef SCTP
     74  1.1.2.36  pgoyette void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
     75  1.1.2.36  pgoyette void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;
     76  1.1.2.38  pgoyette #else
     77  1.1.2.36  pgoyette void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
     78  1.1.2.36  pgoyette void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
     79  1.1.2.36  pgoyette #endif
     80  1.1.2.36  pgoyette 
     81  1.1.2.36  pgoyette 
     82   1.1.2.2  pgoyette /*
     83  1.1.2.18  pgoyette  * usb device_info compatability
     84  1.1.2.18  pgoyette  */
     85  1.1.2.34  pgoyette struct usb_subr_30_fill_hook_t usb_subr_30_fill_hook;
     86  1.1.2.34  pgoyette struct usb_subr_30_copy_hook_t usb_subr_30_copy_hook;
     87  1.1.2.18  pgoyette 
     88  1.1.2.18  pgoyette /*
     89   1.1.2.2  pgoyette  * ccd device compatability ioctl
     90   1.1.2.2  pgoyette  */
     91  1.1.2.17  pgoyette 
     92  1.1.2.17  pgoyette struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook;
     93   1.1.2.2  pgoyette 
     94   1.1.2.2  pgoyette /*
     95   1.1.2.2  pgoyette  * clockctl device compatability ioctl
     96   1.1.2.2  pgoyette  */
     97  1.1.2.18  pgoyette 
     98  1.1.2.18  pgoyette struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook;
     99   1.1.2.2  pgoyette 
    100   1.1.2.3  pgoyette /*
    101   1.1.2.3  pgoyette  * if_sppp device compatability ioctl subroutine
    102   1.1.2.3  pgoyette  */
    103  1.1.2.18  pgoyette 
    104  1.1.2.18  pgoyette struct sppp_params_50_hook_t sppp_params_50_hook;
    105   1.1.2.4  pgoyette 
    106   1.1.2.4  pgoyette /*
    107   1.1.2.4  pgoyette  * cryptodev compatability ioctl
    108   1.1.2.4  pgoyette  */
    109  1.1.2.18  pgoyette 
    110  1.1.2.18  pgoyette struct ocryptof_50_hook_t ocryptof_50_hook;
    111   1.1.2.4  pgoyette 
    112   1.1.2.5  pgoyette /*
    113   1.1.2.5  pgoyette  * raidframe compatability
    114   1.1.2.5  pgoyette  */
    115  1.1.2.18  pgoyette struct raidframe50_ioctl_hook_t raidframe50_ioctl_hook;
    116  1.1.2.18  pgoyette struct raidframe80_ioctl_hook_t raidframe80_ioctl_hook;
    117   1.1.2.6  pgoyette 
    118   1.1.2.6  pgoyette /*
    119   1.1.2.6  pgoyette  * puffs compatability
    120   1.1.2.6  pgoyette  */
    121  1.1.2.18  pgoyette 
    122  1.1.2.34  pgoyette struct puffs_50_out_hook_t puffs_50_out_hook;
    123  1.1.2.34  pgoyette struct puffs_50_in_hook_t puffs_50_in_hook;
    124  1.1.2.18  pgoyette 
    125  1.1.2.34  pgoyette /* XXX
    126   1.1.2.6  pgoyette int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
    127   1.1.2.6  pgoyette     ssize_t *) = (void *)enosys;
    128   1.1.2.6  pgoyette void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
    129   1.1.2.6  pgoyette     (void *)voidop;
    130  1.1.2.34  pgoyette    XXX */
    131   1.1.2.7  pgoyette 
    132   1.1.2.7  pgoyette /*
    133   1.1.2.7  pgoyette  * wsevents compatability
    134   1.1.2.7  pgoyette  */
    135  1.1.2.18  pgoyette struct wsevent_50_copyout_events_hook_t wsevent_50_copyout_events_hook;
    136   1.1.2.8  pgoyette 
    137   1.1.2.8  pgoyette /*
    138   1.1.2.8  pgoyette  * sysmon_power compatability
    139   1.1.2.8  pgoyette  */
    140  1.1.2.18  pgoyette struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook;
    141   1.1.2.9  pgoyette 
    142   1.1.2.9  pgoyette /*
    143  1.1.2.18  pgoyette  * compat_bio compatability
    144   1.1.2.9  pgoyette  */
    145  1.1.2.18  pgoyette struct compat_bio_30_hook_t compat_bio_30_hook;
    146  1.1.2.10  pgoyette 
    147  1.1.2.10  pgoyette /*
    148  1.1.2.10  pgoyette  * vnd ioctl compatability
    149  1.1.2.10  pgoyette  */
    150  1.1.2.18  pgoyette struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook;
    151  1.1.2.20  pgoyette struct compat_vndioctl_50_hook_t compat_vndioctl_50_hook;
    152  1.1.2.11  pgoyette 
    153  1.1.2.12  pgoyette /*
    154  1.1.2.12  pgoyette  * ieee80211 ioctl compatability
    155  1.1.2.12  pgoyette  */
    156  1.1.2.18  pgoyette struct ieee80211_ostats_hook_t ieee80211_ostats_hook;
    157  1.1.2.12  pgoyette 
    158  1.1.2.21  pgoyette /*
    159  1.1.2.21  pgoyette  * if_43 compatability
    160  1.1.2.21  pgoyette  */
    161  1.1.2.34  pgoyette struct if_43_cvtcmd_hook_t if_43_cvtcmd_hook;
    162  1.1.2.34  pgoyette struct if_43_ifioctl_hook_t if_43_ifioctl_hook;
    163  1.1.2.21  pgoyette 
    164  1.1.2.21  pgoyette /*
    165  1.1.2.22  pgoyette  * if43_20 compatability
    166  1.1.2.22  pgoyette  */
    167  1.1.2.22  pgoyette struct if43_20_hook_t if43_20_hook;
    168  1.1.2.22  pgoyette 
    169  1.1.2.22  pgoyette /*
    170  1.1.2.21  pgoyette  * upic_syscalls_40 compatability
    171  1.1.2.21  pgoyette  */
    172  1.1.2.21  pgoyette struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
    173  1.1.2.21  pgoyette 
    174  1.1.2.21  pgoyette /*
    175  1.1.2.21  pgoyette  * upic_syscalls_50 compatability
    176  1.1.2.21  pgoyette  */
    177  1.1.2.21  pgoyette struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
    178  1.1.2.21  pgoyette 
    179  1.1.2.13  pgoyette /*
    180  1.1.2.13  pgoyette  * rtsock 14 compatability
    181  1.1.2.13  pgoyette  */
    182  1.1.2.34  pgoyette struct rtsock_14_oifmsg_hook_t rtsock_14_oifmsg_hook;
    183  1.1.2.34  pgoyette struct rtsock_14_iflist_hook_t rtsock_14_iflist_hook;
    184  1.1.2.14  pgoyette 
    185  1.1.2.14  pgoyette /*
    186  1.1.2.33  pgoyette  * rtsock 50 compatability
    187  1.1.2.33  pgoyette  */
    188  1.1.2.35  pgoyette struct rtsock_50_iflist_hook_t rtsock_50_iflist_hook;
    189  1.1.2.35  pgoyette struct rtsock_50_oifmsg_hook_t rtsock_50_oifmsg_hook;
    190  1.1.2.35  pgoyette struct rtsock_50_rt_missmsg_hook_t rtsock_50_rt_missmsg_hook;
    191  1.1.2.35  pgoyette struct rtsock_50_rt_ifmsg_hook_t rtsock_50_rt_ifmsg_hook;
    192  1.1.2.35  pgoyette struct rtsock_50_rt_ifannouncemsg_hook_t rtsock_50_rt_ifannouncemsg_hook;
    193  1.1.2.35  pgoyette struct rtsock_50_rt_newaddrmsg_hook_t rtsock_50_rt_newaddrmsg_hook;
    194  1.1.2.35  pgoyette struct rtsock_50_rt_ieee80211msg_hook_t rtsock_50_rt_ieee80211msg_hook;
    195  1.1.2.33  pgoyette 
    196  1.1.2.33  pgoyette /*
    197  1.1.2.28  pgoyette  * rtsock 70 compatability
    198  1.1.2.28  pgoyette  */
    199  1.1.2.34  pgoyette struct rtsock_70_newaddr_hook_t rtsock_70_newaddr_hook;
    200  1.1.2.34  pgoyette struct rtsock_70_iflist_hook_t rtsock_70_iflist_hook;
    201  1.1.2.28  pgoyette 
    202  1.1.2.28  pgoyette /*
    203  1.1.2.14  pgoyette  * modctl handler for old style OSTAT
    204  1.1.2.14  pgoyette  */
    205  1.1.2.18  pgoyette struct compat_modstat_80_hook_t compat_modstat_80_hook;
    206  1.1.2.15  pgoyette 
    207  1.1.2.15  pgoyette /*
    208  1.1.2.15  pgoyette  * mask for kern_sig_43's killpg (updated by compat_09)
    209  1.1.2.15  pgoyette  */
    210  1.1.2.15  pgoyette int kern_sig_43_pgid_mask = ~0;
    211  1.1.2.24  pgoyette 
    212  1.1.2.24  pgoyette /*
    213  1.1.2.24  pgoyette  * hook for kern_proc_32
    214  1.1.2.24  pgoyette  */
    215  1.1.2.34  pgoyette struct kern_proc_32_copyin_hook_t kern_proc_32_copyin_hook;
    216  1.1.2.34  pgoyette struct kern_proc_32_base_hook_t kern_proc_32_base_hook;
    217  1.1.2.26  pgoyette 
    218  1.1.2.26  pgoyette /*
    219  1.1.2.26  pgoyette  * Hook for sparc fpu code to check if a process is running
    220  1.1.2.26  pgoyette  * under sunos emulation
    221  1.1.2.26  pgoyette  */
    222  1.1.2.26  pgoyette struct get_emul_sunos_hook_t get_emul_sunos_hook;
    223  1.1.2.27  pgoyette 
    224  1.1.2.27  pgoyette /*
    225  1.1.2.27  pgoyette  * Hook for rnd_ioctl_50 callbacks
    226  1.1.2.27  pgoyette  */
    227  1.1.2.27  pgoyette struct rnd_ioctl_50_hook_t rnd_ioctl_50_hook;
    228  1.1.2.27  pgoyette struct rnd_ioctl_50_32_hook_t rnd_ioctl_50_32_hook;
    229  1.1.2.29  pgoyette 
    230  1.1.2.29  pgoyette /*
    231  1.1.2.29  pgoyette  * Hooks for compat_60 ttioctl and ptmioctl
    232  1.1.2.29  pgoyette  */
    233  1.1.2.34  pgoyette struct compat_60_ttioctl_hook_t compat_60_ttioctl_hook;
    234  1.1.2.34  pgoyette struct compat_60_ptmioctl_hook_t compat_60_ptmioctl_hook;
    235  1.1.2.29  pgoyette 
    236  1.1.2.30  pgoyette /*
    237  1.1.2.30  pgoyette  * Hook for compat_10 openat
    238  1.1.2.30  pgoyette  */
    239  1.1.2.30  pgoyette struct compat_10_openat_hook_t compat_10_openat_hook;
    240  1.1.2.30  pgoyette 
    241  1.1.2.31  pgoyette /*
    242  1.1.2.31  pgoyette  * Hook for compat_70_unp_addsockcred
    243  1.1.2.31  pgoyette  */
    244  1.1.2.31  pgoyette struct compat_70_unp_hook_t compat_70_unp_hook;
    245  1.1.2.31  pgoyette 
    246  1.1.2.32  pgoyette /*
    247  1.1.2.32  pgoyette  * Hook for sysvipc50_sysctl
    248  1.1.2.32  pgoyette  */
    249  1.1.2.32  pgoyette struct sysvipc50_sysctl_hook_t sysvipc50_sysctl_hook;
    250  1.1.2.42  pgoyette 
    251  1.1.2.42  pgoyette /*
    252  1.1.2.42  pgoyette  * Hook for 32-bit machine name
    253  1.1.2.42  pgoyette  *
    254  1.1.2.42  pgoyette  * This probably would be better placed in compat/netbsd32/netbsd32_mod.c
    255  1.1.2.42  pgoyette  * but the consumer code in linux32_exec_elf32.c is sometimes included in
    256  1.1.2.42  pgoyette  * the main kernel, and not in a compat_netbsd32 module.  (In particular,
    257  1.1.2.42  pgoyette  * this is true for i386 and sgimips.)
    258  1.1.2.42  pgoyette  */
    259  1.1.2.42  pgoyette struct netbsd32_machine32_hook_t netbsd32_machine32_hook;
    260