Home | History | Annotate | Line # | Download | only in kern
compat_stub.c revision 1.1.2.31
      1 /* $NetBSD: compat_stub.c,v 1.1.2.31 2018/10/15 11:57:05 pgoyette Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2018 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Paul Goyette
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #include <sys/cdefs.h>
     33 
     34 #ifdef _KERNEL_OPT
     35 #include "opt_ntp.h"
     36 #endif
     37 
     38 #include <sys/systm.h>
     39 #include <sys/compat_stub.h>
     40 
     41 #ifdef NTP
     42 #include <sys/timespec.h>
     43 #include <sys/timex.h>
     44 #endif
     45 
     46 /*
     47  * Routine vectors for compat_50___sys_ntp_gettime
     48  *
     49  * MP-hooks not needed since the NTP code is not modular
     50  */
     51 
     52 #ifdef NTP
     53 void (*vec_ntp_gettime)(struct ntptimeval *) = ntp_gettime;
     54 int (*vec_ntp_timestatus)(void) = ntp_timestatus;
     55 void (*vec_ntp_adjtime1)(struct timex *) = ntp_adjtime1;
     56 #else
     57 void (*vec_ntp_gettime)(struct ntptimeval *) = NULL;
     58 int (*vec_ntp_timestatus)(void) = NULL;
     59 void (*vec_ntp_adjtime1)(struct timex *) = NULL;
     60 #endif
     61 
     62 /*
     63  * usb device_info compatability
     64  */
     65 struct usb_subr_30_hook_t usb_subr_30_hook;
     66 
     67 /*
     68  * ccd device compatability ioctl
     69  */
     70 
     71 struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook;
     72 
     73 /*
     74  * clockctl device compatability ioctl
     75  */
     76 
     77 struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook;
     78 
     79 /*
     80  * if_sppp device compatability ioctl subroutine
     81  */
     82 
     83 struct sppp_params_50_hook_t sppp_params_50_hook;
     84 
     85 /*
     86  * cryptodev compatability ioctl
     87  */
     88 
     89 struct ocryptof_50_hook_t ocryptof_50_hook;
     90 
     91 /*
     92  * raidframe compatability
     93  */
     94 struct raidframe50_ioctl_hook_t raidframe50_ioctl_hook;
     95 struct raidframe80_ioctl_hook_t raidframe80_ioctl_hook;
     96 
     97 /*
     98  * puffs compatability
     99  */
    100 
    101 struct puffs50_compat_hook_t puffs50_compat_hook;
    102 
    103 int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
    104     ssize_t *) = (void *)enosys;
    105 void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
    106     (void *)voidop;
    107 
    108 /*
    109  * wsevents compatability
    110  */
    111 struct wsevent_50_copyout_events_hook_t wsevent_50_copyout_events_hook;
    112 
    113 /*
    114  * sysmon_power compatability
    115  */
    116 struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook;
    117 
    118 /*
    119  * compat_bio compatability
    120  */
    121 struct compat_bio_30_hook_t compat_bio_30_hook;
    122 
    123 /*
    124  * vnd ioctl compatability
    125  */
    126 struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook;
    127 struct compat_vndioctl_50_hook_t compat_vndioctl_50_hook;
    128 
    129 /*
    130  * ieee80211 ioctl compatability
    131  */
    132 struct ieee80211_ostats_hook_t ieee80211_ostats_hook;
    133 
    134 /*
    135  * if_43 compatability
    136  */
    137 struct if_43_hook_t if_43_hook;
    138 
    139 /*
    140  * if43_20 compatability
    141  */
    142 struct if43_20_hook_t if43_20_hook;
    143 
    144 /*
    145  * upic_syscalls_40 compatability
    146  */
    147 struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
    148 
    149 /*
    150  * upic_syscalls_50 compatability
    151  */
    152 struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
    153 
    154 /*
    155  * rtsock 14 compatability
    156  */
    157 struct rtsock14_hook_t rtsock14_hook;
    158 
    159 /*
    160  * rtsock 70 compatability
    161  */
    162 struct rtsock_70_hook_t rtsock_70_hook;
    163 
    164 /*
    165  * modctl handler for old style OSTAT
    166  */
    167 struct compat_modstat_80_hook_t compat_modstat_80_hook;
    168 
    169 /*
    170  * mask for kern_sig_43's killpg (updated by compat_09)
    171  */
    172 int kern_sig_43_pgid_mask = ~0;
    173 
    174 /*
    175  * hook for kern_proc_32
    176  */
    177 struct kern_proc_32_hook_t kern_proc_32_hook;
    178 
    179 /*
    180  * Hook for sparc fpu code to check if a process is running
    181  * under sunos emulation
    182  */
    183 struct get_emul_sunos_hook_t get_emul_sunos_hook;
    184 
    185 /*
    186  * Hook for rnd_ioctl_50 callbacks
    187  */
    188 struct rnd_ioctl_50_hook_t rnd_ioctl_50_hook;
    189 struct rnd_ioctl_50_32_hook_t rnd_ioctl_50_32_hook;
    190 
    191 /*
    192  * Hooks for compat_60 ttioctl and ptmioctl
    193  */
    194 struct compat_60_ioctl_hook_t compat_60_ioctl_hook;
    195 
    196 /*
    197  * Hook for compat_10 openat
    198  */
    199 struct compat_10_openat_hook_t compat_10_openat_hook;
    200 
    201 /*
    202  * Hook for compat_70_unp_addsockcred
    203  */
    204 struct compat_70_unp_hook_t compat_70_unp_hook;
    205 
    206