compat_stub.c revision 1.1.2.42 1 /* $NetBSD: compat_stub.c,v 1.1.2.42 2019/01/25 09:36:09 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 #include "opt_sctp.h"
37 #endif
38
39 #include <sys/systm.h>
40 #include <sys/compat_stub.h>
41
42 #ifdef NTP
43 #include <sys/timespec.h>
44 #include <sys/timex.h>
45 #endif
46
47 #ifdef SCTP
48 #include <netinet/sctp_asconf.h>
49 #endif
50
51 /*
52 * Routine vectors for compat_50___sys_ntp_gettime
53 *
54 * MP-hooks not needed since the NTP code is not modular
55 */
56
57 #ifdef NTP
58 void (*vec_ntp_gettime)(struct ntptimeval *) = ntp_gettime;
59 int (*vec_ntp_timestatus)(void) = ntp_timestatus;
60 void (*vec_ntp_adjtime1)(struct timex *) = ntp_adjtime1;
61 #else
62 void (*vec_ntp_gettime)(struct ntptimeval *) = NULL;
63 int (*vec_ntp_timestatus)(void) = NULL;
64 void (*vec_ntp_adjtime1)(struct timex *) = NULL;
65 #endif
66
67 /*
68 * Routine vectors for sctp (called from within rtsock)
69 *
70 * MP-hooks not needed since the SCTP code is not modular
71 */
72
73 #ifdef SCTP
74 void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
75 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;
76 #else
77 void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
78 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
79 #endif
80
81
82 /*
83 * usb device_info compatability
84 */
85 struct usb_subr_30_fill_hook_t usb_subr_30_fill_hook;
86 struct usb_subr_30_copy_hook_t usb_subr_30_copy_hook;
87
88 /*
89 * ccd device compatability ioctl
90 */
91
92 struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook;
93
94 /*
95 * clockctl device compatability ioctl
96 */
97
98 struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook;
99
100 /*
101 * if_sppp device compatability ioctl subroutine
102 */
103
104 struct sppp_params_50_hook_t sppp_params_50_hook;
105
106 /*
107 * cryptodev compatability ioctl
108 */
109
110 struct ocryptof_50_hook_t ocryptof_50_hook;
111
112 /*
113 * raidframe compatability
114 */
115 struct raidframe50_ioctl_hook_t raidframe50_ioctl_hook;
116 struct raidframe80_ioctl_hook_t raidframe80_ioctl_hook;
117
118 /*
119 * puffs compatability
120 */
121
122 struct puffs_50_out_hook_t puffs_50_out_hook;
123 struct puffs_50_in_hook_t puffs_50_in_hook;
124
125 /* XXX
126 int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
127 ssize_t *) = (void *)enosys;
128 void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
129 (void *)voidop;
130 XXX */
131
132 /*
133 * wsevents compatability
134 */
135 struct wsevent_50_copyout_events_hook_t wsevent_50_copyout_events_hook;
136
137 /*
138 * sysmon_power compatability
139 */
140 struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook;
141
142 /*
143 * compat_bio compatability
144 */
145 struct compat_bio_30_hook_t compat_bio_30_hook;
146
147 /*
148 * vnd ioctl compatability
149 */
150 struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook;
151 struct compat_vndioctl_50_hook_t compat_vndioctl_50_hook;
152
153 /*
154 * ieee80211 ioctl compatability
155 */
156 struct ieee80211_ostats_hook_t ieee80211_ostats_hook;
157
158 /*
159 * if_43 compatability
160 */
161 struct if_43_cvtcmd_hook_t if_43_cvtcmd_hook;
162 struct if_43_ifioctl_hook_t if_43_ifioctl_hook;
163
164 /*
165 * if43_20 compatability
166 */
167 struct if43_20_hook_t if43_20_hook;
168
169 /*
170 * upic_syscalls_40 compatability
171 */
172 struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
173
174 /*
175 * upic_syscalls_50 compatability
176 */
177 struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
178
179 /*
180 * rtsock 14 compatability
181 */
182 struct rtsock_14_oifmsg_hook_t rtsock_14_oifmsg_hook;
183 struct rtsock_14_iflist_hook_t rtsock_14_iflist_hook;
184
185 /*
186 * rtsock 50 compatability
187 */
188 struct rtsock_50_iflist_hook_t rtsock_50_iflist_hook;
189 struct rtsock_50_oifmsg_hook_t rtsock_50_oifmsg_hook;
190 struct rtsock_50_rt_missmsg_hook_t rtsock_50_rt_missmsg_hook;
191 struct rtsock_50_rt_ifmsg_hook_t rtsock_50_rt_ifmsg_hook;
192 struct rtsock_50_rt_ifannouncemsg_hook_t rtsock_50_rt_ifannouncemsg_hook;
193 struct rtsock_50_rt_newaddrmsg_hook_t rtsock_50_rt_newaddrmsg_hook;
194 struct rtsock_50_rt_ieee80211msg_hook_t rtsock_50_rt_ieee80211msg_hook;
195
196 /*
197 * rtsock 70 compatability
198 */
199 struct rtsock_70_newaddr_hook_t rtsock_70_newaddr_hook;
200 struct rtsock_70_iflist_hook_t rtsock_70_iflist_hook;
201
202 /*
203 * modctl handler for old style OSTAT
204 */
205 struct compat_modstat_80_hook_t compat_modstat_80_hook;
206
207 /*
208 * mask for kern_sig_43's killpg (updated by compat_09)
209 */
210 int kern_sig_43_pgid_mask = ~0;
211
212 /*
213 * hook for kern_proc_32
214 */
215 struct kern_proc_32_copyin_hook_t kern_proc_32_copyin_hook;
216 struct kern_proc_32_base_hook_t kern_proc_32_base_hook;
217
218 /*
219 * Hook for sparc fpu code to check if a process is running
220 * under sunos emulation
221 */
222 struct get_emul_sunos_hook_t get_emul_sunos_hook;
223
224 /*
225 * Hook for rnd_ioctl_50 callbacks
226 */
227 struct rnd_ioctl_50_hook_t rnd_ioctl_50_hook;
228 struct rnd_ioctl_50_32_hook_t rnd_ioctl_50_32_hook;
229
230 /*
231 * Hooks for compat_60 ttioctl and ptmioctl
232 */
233 struct compat_60_ttioctl_hook_t compat_60_ttioctl_hook;
234 struct compat_60_ptmioctl_hook_t compat_60_ptmioctl_hook;
235
236 /*
237 * Hook for compat_10 openat
238 */
239 struct compat_10_openat_hook_t compat_10_openat_hook;
240
241 /*
242 * Hook for compat_70_unp_addsockcred
243 */
244 struct compat_70_unp_hook_t compat_70_unp_hook;
245
246 /*
247 * Hook for sysvipc50_sysctl
248 */
249 struct sysvipc50_sysctl_hook_t sysvipc50_sysctl_hook;
250
251 /*
252 * Hook for 32-bit machine name
253 *
254 * This probably would be better placed in compat/netbsd32/netbsd32_mod.c
255 * but the consumer code in linux32_exec_elf32.c is sometimes included in
256 * the main kernel, and not in a compat_netbsd32 module. (In particular,
257 * this is true for i386 and sgimips.)
258 */
259 struct netbsd32_machine32_hook_t netbsd32_machine32_hook;
260