compat_stub.c revision 1.1.2.34 1 /* $NetBSD: compat_stub.c,v 1.1.2.34 2019/01/13 10:49:50 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_fill_hook_t usb_subr_30_fill_hook;
66 struct usb_subr_30_copy_hook_t usb_subr_30_copy_hook;
67
68 /*
69 * ccd device compatability ioctl
70 */
71
72 struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook;
73
74 /*
75 * clockctl device compatability ioctl
76 */
77
78 struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook;
79
80 /*
81 * if_sppp device compatability ioctl subroutine
82 */
83
84 struct sppp_params_50_hook_t sppp_params_50_hook;
85
86 /*
87 * cryptodev compatability ioctl
88 */
89
90 struct ocryptof_50_hook_t ocryptof_50_hook;
91
92 /*
93 * raidframe compatability
94 */
95 struct raidframe50_ioctl_hook_t raidframe50_ioctl_hook;
96 struct raidframe80_ioctl_hook_t raidframe80_ioctl_hook;
97
98 /*
99 * puffs compatability
100 */
101
102 struct puffs_50_out_hook_t puffs_50_out_hook;
103 struct puffs_50_in_hook_t puffs_50_in_hook;
104
105 /* XXX
106 int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
107 ssize_t *) = (void *)enosys;
108 void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
109 (void *)voidop;
110 XXX */
111
112 /*
113 * wsevents compatability
114 */
115 struct wsevent_50_copyout_events_hook_t wsevent_50_copyout_events_hook;
116
117 /*
118 * sysmon_power compatability
119 */
120 struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook;
121
122 /*
123 * compat_bio compatability
124 */
125 struct compat_bio_30_hook_t compat_bio_30_hook;
126
127 /*
128 * vnd ioctl compatability
129 */
130 struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook;
131 struct compat_vndioctl_50_hook_t compat_vndioctl_50_hook;
132
133 /*
134 * ieee80211 ioctl compatability
135 */
136 struct ieee80211_ostats_hook_t ieee80211_ostats_hook;
137
138 /*
139 * if_43 compatability
140 */
141 struct if_43_cvtcmd_hook_t if_43_cvtcmd_hook;
142 struct if_43_ifioctl_hook_t if_43_ifioctl_hook;
143
144 /*
145 * if43_20 compatability
146 */
147 struct if43_20_hook_t if43_20_hook;
148
149 /*
150 * upic_syscalls_40 compatability
151 */
152 struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
153
154 /*
155 * upic_syscalls_50 compatability
156 */
157 struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
158
159 /*
160 * rtsock 14 compatability
161 */
162 struct rtsock_14_oifmsg_hook_t rtsock_14_oifmsg_hook;
163 struct rtsock_14_iflist_hook_t rtsock_14_iflist_hook;
164
165 /*
166 * rtsock 50 compatability
167 */
168 struct rtsock_50_hook_t rtsock_50_hook;
169
170 /*
171 * rtsock 70 compatability
172 */
173 struct rtsock_70_newaddr_hook_t rtsock_70_newaddr_hook;
174 struct rtsock_70_iflist_hook_t rtsock_70_iflist_hook;
175
176 /*
177 * modctl handler for old style OSTAT
178 */
179 struct compat_modstat_80_hook_t compat_modstat_80_hook;
180
181 /*
182 * mask for kern_sig_43's killpg (updated by compat_09)
183 */
184 int kern_sig_43_pgid_mask = ~0;
185
186 /*
187 * hook for kern_proc_32
188 */
189 struct kern_proc_32_copyin_hook_t kern_proc_32_copyin_hook;
190 struct kern_proc_32_base_hook_t kern_proc_32_base_hook;
191
192 /*
193 * Hook for sparc fpu code to check if a process is running
194 * under sunos emulation
195 */
196 struct get_emul_sunos_hook_t get_emul_sunos_hook;
197
198 /*
199 * Hook for rnd_ioctl_50 callbacks
200 */
201 struct rnd_ioctl_50_hook_t rnd_ioctl_50_hook;
202 struct rnd_ioctl_50_32_hook_t rnd_ioctl_50_32_hook;
203
204 /*
205 * Hooks for compat_60 ttioctl and ptmioctl
206 */
207 struct compat_60_ttioctl_hook_t compat_60_ttioctl_hook;
208 struct compat_60_ptmioctl_hook_t compat_60_ptmioctl_hook;
209
210 /*
211 * Hook for compat_10 openat
212 */
213 struct compat_10_openat_hook_t compat_10_openat_hook;
214
215 /*
216 * Hook for compat_70_unp_addsockcred
217 */
218 struct compat_70_unp_hook_t compat_70_unp_hook;
219
220 /*
221 * Hook for sysvipc50_sysctl
222 */
223 struct sysvipc50_sysctl_hook_t sysvipc50_sysctl_hook;
224
225