compat_stub.c revision 1.12.2.2 1 1.12.2.2 christos /* $NetBSD: compat_stub.c,v 1.12.2.2 2019/06/10 22:09:02 christos Exp $ */
2 1.12.2.2 christos
3 1.12.2.2 christos /*-
4 1.12.2.2 christos * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 1.12.2.2 christos * All rights reserved.
6 1.12.2.2 christos *
7 1.12.2.2 christos * This code is derived from software contributed to The NetBSD Foundation
8 1.12.2.2 christos * by Paul Goyette
9 1.12.2.2 christos *
10 1.12.2.2 christos * Redistribution and use in source and binary forms, with or without
11 1.12.2.2 christos * modification, are permitted provided that the following conditions
12 1.12.2.2 christos * are met:
13 1.12.2.2 christos * 1. Redistributions of source code must retain the above copyright
14 1.12.2.2 christos * notice, this list of conditions and the following disclaimer.
15 1.12.2.2 christos * 2. Redistributions in binary form must reproduce the above copyright
16 1.12.2.2 christos * notice, this list of conditions and the following disclaimer in the
17 1.12.2.2 christos * documentation and/or other materials provided with the distribution.
18 1.12.2.2 christos *
19 1.12.2.2 christos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.12.2.2 christos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.12.2.2 christos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.12.2.2 christos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.12.2.2 christos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.12.2.2 christos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.12.2.2 christos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.12.2.2 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.12.2.2 christos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.12.2.2 christos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.12.2.2 christos * POSSIBILITY OF SUCH DAMAGE.
30 1.12.2.2 christos */
31 1.12.2.2 christos
32 1.12.2.2 christos #include <sys/cdefs.h>
33 1.12.2.2 christos
34 1.12.2.2 christos #ifdef _KERNEL_OPT
35 1.12.2.2 christos #include "opt_ntp.h"
36 1.12.2.2 christos #include "opt_sctp.h"
37 1.12.2.2 christos #endif
38 1.12.2.2 christos
39 1.12.2.2 christos #include <sys/systm.h>
40 1.12.2.2 christos #include <sys/compat_stub.h>
41 1.12.2.2 christos
42 1.12.2.2 christos #ifdef NTP
43 1.12.2.2 christos #include <sys/timespec.h>
44 1.12.2.2 christos #include <sys/timex.h>
45 1.12.2.2 christos #endif
46 1.12.2.2 christos
47 1.12.2.2 christos #ifdef SCTP
48 1.12.2.2 christos #include <netinet/sctp_asconf.h>
49 1.12.2.2 christos #endif
50 1.12.2.2 christos
51 1.12.2.2 christos /*
52 1.12.2.2 christos * Routine vectors for compat_50___sys_ntp_gettime
53 1.12.2.2 christos *
54 1.12.2.2 christos * MP-hooks not needed since the NTP code is not modular
55 1.12.2.2 christos */
56 1.12.2.2 christos
57 1.12.2.2 christos #ifdef NTP
58 1.12.2.2 christos void (*vec_ntp_gettime)(struct ntptimeval *) = ntp_gettime;
59 1.12.2.2 christos int (*vec_ntp_timestatus)(void) = ntp_timestatus;
60 1.12.2.2 christos void (*vec_ntp_adjtime1)(struct timex *) = ntp_adjtime1;
61 1.12.2.2 christos #else
62 1.12.2.2 christos void (*vec_ntp_gettime)(struct ntptimeval *) = NULL;
63 1.12.2.2 christos int (*vec_ntp_timestatus)(void) = NULL;
64 1.12.2.2 christos void (*vec_ntp_adjtime1)(struct timex *) = NULL;
65 1.12.2.2 christos #endif
66 1.12.2.2 christos
67 1.12.2.2 christos /*
68 1.12.2.2 christos * Routine vectors for sctp (called from within rtsock)
69 1.12.2.2 christos *
70 1.12.2.2 christos * MP-hooks not needed since the SCTP code is not modular
71 1.12.2.2 christos */
72 1.12.2.2 christos
73 1.12.2.2 christos #ifdef SCTP
74 1.12.2.2 christos void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
75 1.12.2.2 christos void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;
76 1.12.2.2 christos #else
77 1.12.2.2 christos void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
78 1.12.2.2 christos void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
79 1.12.2.2 christos #endif
80 1.12.2.2 christos
81 1.12.2.2 christos
82 1.12.2.2 christos /*
83 1.12.2.2 christos * usb device_info compatability
84 1.12.2.2 christos */
85 1.12.2.2 christos struct usb_subr_fill_30_hook_t usb_subr_fill_30_hook;
86 1.12.2.2 christos struct usb_subr_copy_30_hook_t usb_subr_copy_30_hook;
87 1.12.2.2 christos
88 1.12.2.2 christos /*
89 1.12.2.2 christos * ccd device compatability ioctl
90 1.12.2.2 christos */
91 1.12.2.2 christos
92 1.12.2.2 christos struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook;
93 1.12.2.2 christos
94 1.12.2.2 christos /*
95 1.12.2.2 christos * clockctl device compatability ioctl
96 1.12.2.2 christos */
97 1.12.2.2 christos
98 1.12.2.2 christos struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook;
99 1.12.2.2 christos
100 1.12.2.2 christos /*
101 1.12.2.2 christos * if_sppp device compatability ioctl subroutine
102 1.12.2.2 christos */
103 1.12.2.2 christos
104 1.12.2.2 christos struct sppp_params_50_hook_t sppp_params_50_hook;
105 1.12.2.2 christos
106 1.12.2.2 christos /*
107 1.12.2.2 christos * cryptodev compatability ioctl
108 1.12.2.2 christos */
109 1.12.2.2 christos
110 1.12.2.2 christos struct ocryptof_50_hook_t ocryptof_50_hook;
111 1.12.2.2 christos
112 1.12.2.2 christos /*
113 1.12.2.2 christos * raidframe compatability
114 1.12.2.2 christos */
115 1.12.2.2 christos struct raidframe_ioctl_50_hook_t raidframe_ioctl_50_hook;
116 1.12.2.2 christos struct raidframe_ioctl_80_hook_t raidframe_ioctl_80_hook;
117 1.12.2.2 christos struct raidframe_netbsd32_ioctl_hook_t raidframe_netbsd32_ioctl_hook;
118 1.12.2.2 christos
119 1.12.2.2 christos /*
120 1.12.2.2 christos * puffs compatability
121 1.12.2.2 christos */
122 1.12.2.2 christos
123 1.12.2.2 christos struct puffs_out_50_hook_t puffs_out_50_hook;
124 1.12.2.2 christos struct puffs_in_50_hook_t puffs_in_50_hook;
125 1.12.2.2 christos
126 1.12.2.2 christos /* XXX
127 1.12.2.2 christos int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
128 1.12.2.2 christos ssize_t *) = (void *)enosys;
129 1.12.2.2 christos void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
130 1.12.2.2 christos (void *)voidop;
131 1.12.2.2 christos XXX */
132 1.12.2.2 christos
133 1.12.2.2 christos /*
134 1.12.2.2 christos * wsevents compatability
135 1.12.2.2 christos */
136 1.12.2.2 christos struct wscons_copyout_events_50_hook_t wscons_copyout_events_50_hook;
137 1.12.2.2 christos
138 1.12.2.2 christos /*
139 1.12.2.2 christos * sysmon_power compatability
140 1.12.2.2 christos */
141 1.12.2.2 christos struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook;
142 1.12.2.2 christos
143 1.12.2.2 christos /*
144 1.12.2.2 christos * compat_bio compatability
145 1.12.2.2 christos */
146 1.12.2.2 christos struct compat_bio_30_hook_t compat_bio_30_hook;
147 1.12.2.2 christos
148 1.12.2.2 christos /*
149 1.12.2.2 christos * vnd ioctl compatability
150 1.12.2.2 christos */
151 1.12.2.2 christos struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook;
152 1.12.2.2 christos struct compat_vndioctl_50_hook_t compat_vndioctl_50_hook;
153 1.12.2.2 christos
154 1.12.2.2 christos /*
155 1.12.2.2 christos * ieee80211 ioctl compatability
156 1.12.2.2 christos */
157 1.12.2.2 christos struct ieee80211_ioctl_20_hook_t ieee80211_ioctl_20_hook;
158 1.12.2.2 christos
159 1.12.2.2 christos /*
160 1.12.2.2 christos * if_43 compatability
161 1.12.2.2 christos */
162 1.12.2.2 christos struct if_cvtcmd_43_hook_t if_cvtcmd_43_hook;
163 1.12.2.2 christos struct if_ifioctl_43_hook_t if_ifioctl_43_hook;
164 1.12.2.2 christos
165 1.12.2.2 christos /*
166 1.12.2.2 christos * if43_cvtcmd_20 compatability
167 1.12.2.2 christos */
168 1.12.2.2 christos struct if43_cvtcmd_20_hook_t if43_cvtcmd_20_hook;
169 1.12.2.2 christos
170 1.12.2.2 christos /*
171 1.12.2.2 christos * tty 43 ioctl compatibility
172 1.12.2.2 christos */
173 1.12.2.2 christos struct tty_ttioctl_43_hook_t tty_ttioctl_43_hook;
174 1.12.2.2 christos
175 1.12.2.2 christos /*
176 1.12.2.2 christos * uipc_syscalls_40 compatibility
177 1.12.2.2 christos */
178 1.12.2.2 christos struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
179 1.12.2.2 christos
180 1.12.2.2 christos /*
181 1.12.2.2 christos * uipc_socket_50 compatibility
182 1.12.2.2 christos */
183 1.12.2.2 christos struct uipc_socket_50_setopt1_hook_t uipc_socket_50_setopt1_hook;
184 1.12.2.2 christos struct uipc_socket_50_getopt1_hook_t uipc_socket_50_getopt1_hook;
185 1.12.2.2 christos struct uipc_socket_50_sbts_hook_t uipc_socket_50_sbts_hook;
186 1.12.2.2 christos
187 1.12.2.2 christos /*
188 1.12.2.2 christos * uipc_syscalls_50 compatability
189 1.12.2.2 christos */
190 1.12.2.2 christos struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
191 1.12.2.2 christos
192 1.12.2.2 christos /*
193 1.12.2.2 christos * rtsock 14 compatability
194 1.12.2.2 christos */
195 1.12.2.2 christos struct rtsock_oifmsg_14_hook_t rtsock_oifmsg_14_hook;
196 1.12.2.2 christos struct rtsock_iflist_14_hook_t rtsock_iflist_14_hook;
197 1.12.2.2 christos
198 1.12.2.2 christos /*
199 1.12.2.2 christos * rtsock 50 compatability
200 1.12.2.2 christos */
201 1.12.2.2 christos struct rtsock_iflist_50_hook_t rtsock_iflist_50_hook;
202 1.12.2.2 christos struct rtsock_oifmsg_50_hook_t rtsock_oifmsg_50_hook;
203 1.12.2.2 christos struct rtsock_rt_missmsg_50_hook_t rtsock_rt_missmsg_50_hook;
204 1.12.2.2 christos struct rtsock_rt_ifmsg_50_hook_t rtsock_rt_ifmsg_50_hook;
205 1.12.2.2 christos struct rtsock_rt_ifannouncemsg_50_hook_t rtsock_rt_ifannouncemsg_50_hook;
206 1.12.2.2 christos struct rtsock_rt_addrmsg_rt_50_hook_t rtsock_rt_addrmsg_rt_50_hook;
207 1.12.2.2 christos struct rtsock_rt_addrmsg_src_50_hook_t rtsock_rt_addrmsg_src_50_hook;
208 1.12.2.2 christos struct rtsock_rt_addrmsg_50_hook_t rtsock_rt_addrmsg_50_hook;
209 1.12.2.2 christos struct rtsock_rt_ieee80211msg_50_hook_t rtsock_rt_ieee80211msg_50_hook;
210 1.12.2.2 christos
211 1.12.2.2 christos /*
212 1.12.2.2 christos * rtsock 70 compatability
213 1.12.2.2 christos */
214 1.12.2.2 christos struct rtsock_newaddr_70_hook_t rtsock_newaddr_70_hook;
215 1.12.2.2 christos struct rtsock_iflist_70_hook_t rtsock_iflist_70_hook;
216 1.12.2.2 christos
217 1.12.2.2 christos /*
218 1.12.2.2 christos * modctl handler for old style OSTAT
219 1.12.2.2 christos */
220 1.12.2.2 christos struct compat_modstat_80_hook_t compat_modstat_80_hook;
221 1.12.2.2 christos
222 1.12.2.2 christos /*
223 1.12.2.2 christos * mask for kern_sig_43's killpg (updated by compat_09)
224 1.12.2.2 christos */
225 1.12.2.2 christos int kern_sig_43_pgid_mask = ~0;
226 1.12.2.2 christos
227 1.12.2.2 christos /*
228 1.12.2.2 christos * hook for kern_proc_32
229 1.12.2.2 christos */
230 1.12.2.2 christos struct kern_proc32_copyin_hook_t kern_proc32_copyin_hook;
231 1.12.2.2 christos struct kern_proc32_base_hook_t kern_proc32_base_hook;
232 1.12.2.2 christos
233 1.12.2.2 christos /*
234 1.12.2.2 christos * Hook for sparc fpu code to check if a process is running
235 1.12.2.2 christos * under sunos emulation
236 1.12.2.2 christos */
237 1.12.2.2 christos struct get_emul_sunos_hook_t get_emul_sunos_hook;
238 1.12.2.2 christos
239 1.12.2.2 christos /*
240 1.12.2.2 christos * Hook for rnd_ioctl_50 callbacks
241 1.12.2.2 christos */
242 1.12.2.2 christos struct rnd_ioctl_50_hook_t rnd_ioctl_50_hook;
243 1.12.2.2 christos struct rnd_ioctl32_50_hook_t rnd_ioctl32_50_hook;
244 1.12.2.2 christos
245 1.12.2.2 christos /*
246 1.12.2.2 christos * Hooks for compat_60 ttioctl and ptmioctl
247 1.12.2.2 christos */
248 1.12.2.2 christos struct tty_ttioctl_60_hook_t tty_ttioctl_60_hook;
249 1.12.2.2 christos struct tty_ptmioctl_60_hook_t tty_ptmioctl_60_hook;
250 1.12.2.2 christos
251 1.12.2.2 christos /*
252 1.12.2.2 christos * Hook for compat_10 openat
253 1.12.2.2 christos */
254 1.12.2.2 christos struct vfs_openat_10_hook_t vfs_openat_10_hook;
255 1.12.2.2 christos
256 1.12.2.2 christos /*
257 1.12.2.2 christos * Hook for compat_70_unp_addsockcred
258 1.12.2.2 christos */
259 1.12.2.2 christos struct uipc_unp_70_hook_t uipc_unp_70_hook;
260 1.12.2.2 christos
261 1.12.2.2 christos /*
262 1.12.2.2 christos * Hook for sysvipc50_sysctl
263 1.12.2.2 christos */
264 1.12.2.2 christos struct sysvipc_sysctl_50_hook_t sysvipc_sysctl_50_hook;
265 1.12.2.2 christos
266 1.12.2.2 christos /*
267 1.12.2.2 christos * ifmedia_80 compatability
268 1.12.2.2 christos */
269 1.12.2.2 christos struct ifmedia_80_pre_hook_t ifmedia_80_pre_hook;
270 1.12.2.2 christos struct ifmedia_80_post_hook_t ifmedia_80_post_hook;
271 1.12.2.2 christos
272 1.12.2.2 christos /*
273 1.12.2.2 christos * Hook for 32-bit machine name
274 1.12.2.2 christos *
275 1.12.2.2 christos * This probably would be better placed in compat/netbsd32/netbsd32_mod.c
276 1.12.2.2 christos * but the consumer code in linux32_exec_elf32.c is sometimes included in
277 1.12.2.2 christos * the main kernel, and not in a compat_netbsd32 module. (In particular,
278 1.12.2.2 christos * this is true for i386 and sgimips.)
279 1.12.2.2 christos */
280 1.12.2.2 christos struct netbsd32_machine32_hook_t netbsd32_machine32_hook;
281