]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / compiler-rt / lib / sanitizer_common / sanitizer_interceptors_ioctl_netbsd.inc
1 //===-- sanitizer_interceptors_ioctl_netbsd.inc -----------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Ioctl handling in common sanitizer interceptors.
10 //===----------------------------------------------------------------------===//
11
12 #if SANITIZER_NETBSD
13
14 #include "sanitizer_flags.h"
15
16 struct ioctl_desc {
17   unsigned req;
18   // FIXME: support read+write arguments. Currently READWRITE and WRITE do the
19   // same thing.
20   // XXX: The declarations below may use WRITE instead of READWRITE, unless
21   // explicitly noted.
22   enum { NONE, READ, WRITE, READWRITE, CUSTOM } type : 3;
23   unsigned size : 29;
24   const char *name;
25 };
26
27 const unsigned ioctl_table_max = 1236;
28 static ioctl_desc ioctl_table[ioctl_table_max];
29 static unsigned ioctl_table_size = 0;
30
31 // This can not be declared as a global, because references to struct_*_sz
32 // require a global initializer. And this table must be available before global
33 // initializers are run.
34 static void ioctl_table_fill() {
35 #define _(rq, tp, sz)                                                          \
36   if (IOCTL_##rq != IOCTL_NOT_PRESENT) {                                       \
37     CHECK(ioctl_table_size < ioctl_table_max);                                 \
38     ioctl_table[ioctl_table_size].req = IOCTL_##rq;                            \
39     ioctl_table[ioctl_table_size].type = ioctl_desc::tp;                       \
40     ioctl_table[ioctl_table_size].size = sz;                                   \
41     ioctl_table[ioctl_table_size].name = #rq;                                  \
42     ++ioctl_table_size;                                                        \
43   }
44
45   /* Entries from file: altq/altq_afmap.h */
46   _(AFM_ADDFMAP, READWRITE, struct_atm_flowmap_sz);
47   _(AFM_DELFMAP, READWRITE, struct_atm_flowmap_sz);
48   _(AFM_CLEANFMAP, READWRITE, struct_atm_flowmap_sz);
49   _(AFM_GETFMAP, READWRITE, struct_atm_flowmap_sz);
50   /* Entries from file: altq/altq.h */
51   _(ALTQGTYPE, READWRITE, struct_altqreq_sz);
52   _(ALTQTBRSET, READ, struct_tbrreq_sz);
53   _(ALTQTBRGET, READWRITE, struct_tbrreq_sz);
54   /* Entries from file: altq/altq_blue.h */
55   _(BLUE_IF_ATTACH, READ, struct_blue_interface_sz);
56   _(BLUE_DISABLE, READ, struct_blue_interface_sz);
57   _(BLUE_CONFIG, READWRITE, struct_blue_conf_sz);
58   _(BLUE_GETSTATS, READWRITE, struct_blue_stats_sz);
59   /* Entries from file: altq/altq_cbq.h */
60   _(CBQ_ENABLE, READ, struct_cbq_interface_sz);
61   _(CBQ_ADD_CLASS, READWRITE, struct_cbq_add_class_sz);
62   _(CBQ_DEL_CLASS, READ, struct_cbq_delete_class_sz);
63   _(CBQ_MODIFY_CLASS, READWRITE, struct_cbq_modify_class_sz);
64   _(CBQ_DEL_FILTER, READ, struct_cbq_delete_filter_sz);
65   _(CBQ_GETSTATS, READWRITE, struct_cbq_getstats_sz);
66   /* Entries from file: altq/altq_cdnr.h */
67   _(CDNR_IF_DETACH, READ, struct_cdnr_interface_sz);
68   _(CDNR_ADD_FILTER, READWRITE, struct_cdnr_add_filter_sz);
69   _(CDNR_GETSTATS, READWRITE, struct_cdnr_get_stats_sz);
70   _(CDNR_ADD_ELEM, READWRITE, struct_cdnr_add_element_sz);
71   _(CDNR_DEL_ELEM, READ, struct_cdnr_delete_element_sz);
72   _(CDNR_ADD_TBM, READWRITE, struct_cdnr_add_tbmeter_sz);
73   _(CDNR_MOD_TBM, READ, struct_cdnr_modify_tbmeter_sz);
74   _(CDNR_TBM_STATS, READWRITE, struct_cdnr_tbmeter_stats_sz);
75   _(CDNR_ADD_TCM, READWRITE, struct_cdnr_add_trtcm_sz);
76   _(CDNR_MOD_TCM, READWRITE, struct_cdnr_modify_trtcm_sz);
77   _(CDNR_TCM_STATS, READWRITE, struct_cdnr_tcm_stats_sz);
78   _(CDNR_ADD_TSW, READWRITE, struct_cdnr_add_tswtcm_sz);
79   _(CDNR_MOD_TSW, READWRITE, struct_cdnr_modify_tswtcm_sz);
80   /* Entries from file: altq/altq_fifoq.h */
81   _(FIFOQ_CONFIG, READWRITE, struct_fifoq_conf_sz);
82   _(FIFOQ_GETSTATS, READWRITE, struct_fifoq_getstats_sz);
83   /* Entries from file: altq/altq_hfsc.h */
84   _(HFSC_CLEAR_HIERARCHY, READ, struct_hfsc_interface_sz);
85   _(HFSC_ADD_CLASS, READWRITE, struct_hfsc_add_class_sz);
86   _(HFSC_GETSTATS, READWRITE, struct_hfsc_class_stats_sz);
87   /* Entries from file: altq/altq_jobs.h */
88   _(JOBS_IF_ATTACH, READ, struct_jobs_attach_sz);
89   _(JOBS_IF_DETACH, READ, struct_jobs_interface_sz);
90   _(JOBS_ENABLE, READ, struct_jobs_interface_sz);
91   _(JOBS_DISABLE, READ, struct_jobs_interface_sz);
92   _(JOBS_CLEAR, READ, struct_jobs_interface_sz);
93   _(JOBS_ADD_CLASS, READWRITE, struct_jobs_add_class_sz);
94   _(JOBS_MOD_CLASS, READ, struct_jobs_modify_class_sz);
95   /* Entries from file: altq/altq_priq.h */
96   _(PRIQ_IF_ATTACH, READ, struct_priq_interface_sz);
97   _(PRIQ_CLEAR, READ, struct_priq_interface_sz);
98   _(PRIQ_ADD_CLASS, READWRITE, struct_priq_add_class_sz);
99   _(PRIQ_DEL_CLASS, READ, struct_priq_delete_class_sz);
100   _(PRIQ_MOD_CLASS, READ, struct_priq_modify_class_sz);
101   _(PRIQ_ADD_FILTER, READWRITE, struct_priq_add_filter_sz);
102   _(PRIQ_DEL_FILTER, READ, struct_priq_delete_filter_sz);
103   _(PRIQ_GETSTATS, READWRITE, struct_priq_class_stats_sz);
104   /* Entries from file: altq/altq_red.h */
105   _(RED_CONFIG, READWRITE, struct_red_conf_sz);
106   _(RED_GETSTATS, READWRITE, struct_red_stats_sz);
107   _(RED_SETDEFAULTS, READ, struct_redparams_sz);
108   /* Entries from file: altq/altq_rio.h */
109   _(RIO_CONFIG, READWRITE, struct_rio_conf_sz);
110   _(RIO_GETSTATS, READWRITE, struct_rio_stats_sz);
111   _(RIO_SETDEFAULTS, READ, struct_redparams_sz);
112   /* Entries from file: altq/altq_wfq.h */
113   _(WFQ_CONFIG, READWRITE, struct_wfq_conf_sz);
114   _(WFQ_GET_QID, READWRITE, struct_wfq_getqid_sz);
115   _(WFQ_SET_WEIGHT, READWRITE, struct_wfq_setweight_sz);
116   /* Entries from file: crypto/cryptodev.h */
117   _(CRIOGET, READWRITE, sizeof(u32));
118   _(CIOCFSESSION, READ, sizeof(u32));
119   _(CIOCKEY, READWRITE, struct_crypt_kop_sz);
120   _(CIOCNFKEYM, READWRITE, struct_crypt_mkop_sz);
121   _(CIOCNFSESSION, READ, struct_crypt_sfop_sz);
122   _(CIOCNCRYPTRETM, READWRITE, struct_cryptret_sz);
123   _(CIOCNCRYPTRET, READWRITE, struct_crypt_result_sz);
124   _(CIOCGSESSION, READWRITE, struct_session_op_sz);
125   _(CIOCNGSESSION, READWRITE, struct_crypt_sgop_sz);
126   _(CIOCCRYPT, READWRITE, struct_crypt_op_sz);
127   _(CIOCNCRYPTM, READWRITE, struct_crypt_mop_sz);
128   _(CIOCASYMFEAT, WRITE, sizeof(u32));
129   /* Entries from file: dev/apm/apmio.h */
130   _(APM_IOC_REJECT, READ, struct_apm_event_info_sz);
131   _(OAPM_IOC_GETPOWER, WRITE, struct_apm_power_info_sz);
132   _(APM_IOC_GETPOWER, READWRITE, struct_apm_power_info_sz);
133   _(APM_IOC_NEXTEVENT, WRITE, struct_apm_event_info_sz);
134   _(APM_IOC_DEV_CTL, READ, struct_apm_ctl_sz);
135   /* Entries from file: dev/dm/netbsd-dm.h */
136   _(NETBSD_DM_IOCTL, READWRITE, struct_plistref_sz);
137   /* Entries from file: dev/dmover/dmover_io.h */
138   _(DMIO_SETFUNC, READ, struct_dmio_setfunc_sz);
139   /* Entries from file: dev/dtv/dtvio_demux.h */
140   _(DMX_START, NONE, 0);
141   _(DMX_STOP, NONE, 0);
142   _(DMX_SET_FILTER, READ, struct_dmx_sct_filter_params_sz);
143   _(DMX_SET_PES_FILTER, READ, struct_dmx_pes_filter_params_sz);
144   _(DMX_SET_BUFFER_SIZE, NONE, 0);
145   _(DMX_GET_STC, READWRITE, struct_dmx_stc_sz);
146   _(DMX_ADD_PID, READ, sizeof(u16));
147   _(DMX_REMOVE_PID, READ, sizeof(u16));
148   _(DMX_GET_CAPS, WRITE, struct_dmx_caps_sz);
149   _(DMX_SET_SOURCE, READ, enum_dmx_source_sz);
150   /* Entries from file: dev/dtv/dtvio_frontend.h */
151   _(FE_READ_STATUS, WRITE, enum_fe_status_sz);
152   _(FE_READ_BER, WRITE, sizeof(u32));
153   _(FE_READ_SNR, WRITE, sizeof(u16));
154   _(FE_READ_SIGNAL_STRENGTH, WRITE, sizeof(u16));
155   _(FE_READ_UNCORRECTED_BLOCKS, WRITE, sizeof(u32));
156   _(FE_SET_FRONTEND, READWRITE, struct_dvb_frontend_parameters_sz);
157   _(FE_GET_FRONTEND, WRITE, struct_dvb_frontend_parameters_sz);
158   _(FE_GET_EVENT, WRITE, struct_dvb_frontend_event_sz);
159   _(FE_GET_INFO, WRITE, struct_dvb_frontend_info_sz);
160   _(FE_DISEQC_RESET_OVERLOAD, NONE, 0);
161   _(FE_DISEQC_SEND_MASTER_CMD, READ, struct_dvb_diseqc_master_cmd_sz);
162   _(FE_DISEQC_RECV_SLAVE_REPLY, WRITE, struct_dvb_diseqc_slave_reply_sz);
163   _(FE_DISEQC_SEND_BURST, READ, enum_fe_sec_mini_cmd_sz);
164   _(FE_SET_TONE, READ, enum_fe_sec_tone_mode_sz);
165   _(FE_SET_VOLTAGE, READ, enum_fe_sec_voltage_sz);
166   _(FE_ENABLE_HIGH_LNB_VOLTAGE, READ, sizeof(int));
167   _(FE_SET_FRONTEND_TUNE_MODE, READ, sizeof(unsigned int));
168   _(FE_DISHNETWORK_SEND_LEGACY_CMD, READ, sizeof(unsigned long));
169   /* Entries from file: dev/filemon/filemon.h */
170   _(FILEMON_SET_FD, READWRITE, sizeof(int));
171   _(FILEMON_SET_PID, READWRITE, sizeof(int));
172   /* Entries from file: dev/hdaudio/hdaudioio.h */
173   _(HDAUDIO_FGRP_INFO, READWRITE, struct_plistref_sz);
174   _(HDAUDIO_FGRP_GETCONFIG, READWRITE, struct_plistref_sz);
175   _(HDAUDIO_FGRP_SETCONFIG, READWRITE, struct_plistref_sz);
176   _(HDAUDIO_FGRP_WIDGET_INFO, READWRITE, struct_plistref_sz);
177   _(HDAUDIO_FGRP_CODEC_INFO, READWRITE, struct_plistref_sz);
178   _(HDAUDIO_AFG_WIDGET_INFO, READWRITE, struct_plistref_sz);
179   _(HDAUDIO_AFG_CODEC_INFO, READWRITE, struct_plistref_sz);
180   /* Entries from file: dev/hdmicec/hdmicecio.h */
181   _(CEC_GET_PHYS_ADDR, WRITE, sizeof(u16));
182   _(CEC_GET_LOG_ADDRS, WRITE, sizeof(u16));
183   _(CEC_SET_LOG_ADDRS, READ, sizeof(u16));
184   _(CEC_GET_VENDOR_ID, WRITE, sizeof(u32));
185   /* Entries from file: dev/hpc/hpcfbio.h */
186   _(HPCFBIO_GCONF, READWRITE, struct_hpcfb_fbconf_sz);
187   _(HPCFBIO_SCONF, READ, struct_hpcfb_fbconf_sz);
188   _(HPCFBIO_GDSPCONF, READWRITE, struct_hpcfb_dspconf_sz);
189   _(HPCFBIO_SDSPCONF, READ, struct_hpcfb_dspconf_sz);
190   _(HPCFBIO_GOP, WRITE, struct_hpcfb_dsp_op_sz);
191   _(HPCFBIO_SOP, READWRITE, struct_hpcfb_dsp_op_sz);
192   /* Entries from file: dev/i2o/iopio.h */
193   _(IOPIOCPT, READWRITE, struct_ioppt_sz);
194   _(IOPIOCGLCT, READWRITE, struct_iovec_sz);
195   _(IOPIOCGSTATUS, READWRITE, struct_iovec_sz);
196   _(IOPIOCRECONFIG, NONE, 0);
197   _(IOPIOCGTIDMAP, READWRITE, struct_iovec_sz);
198   /* Entries from file: dev/ic/athioctl.h */
199   _(SIOCGATHSTATS, READWRITE, struct_ifreq_sz);
200   _(SIOCGATHDIAG, READWRITE, struct_ath_diag_sz);
201   /* Entries from file: dev/ic/bt8xx.h */
202   _(METEORCAPTUR, READ, sizeof(int));
203   _(METEORCAPFRM, READ, struct_meteor_capframe_sz);
204   _(METEORSETGEO, READ, struct_meteor_geomet_sz);
205   _(METEORGETGEO, WRITE, struct_meteor_geomet_sz);
206   _(METEORSTATUS, WRITE, sizeof(unsigned short));
207   _(METEORSHUE, READ, sizeof(signed char));
208   _(METEORGHUE, WRITE, sizeof(signed char));
209   _(METEORSFMT, READ, sizeof(unsigned int));
210   _(METEORGFMT, WRITE, sizeof(unsigned int));
211   _(METEORSINPUT, READ, sizeof(unsigned int));
212   _(METEORGINPUT, WRITE, sizeof(unsigned int));
213   _(METEORSCHCV, READ, sizeof(unsigned char));
214   _(METEORGCHCV, WRITE, sizeof(unsigned char));
215   _(METEORSCOUNT, READ, struct_meteor_counts_sz);
216   _(METEORGCOUNT, WRITE, struct_meteor_counts_sz);
217   _(METEORSFPS, READ, sizeof(unsigned short));
218   _(METEORGFPS, WRITE, sizeof(unsigned short));
219   _(METEORSSIGNAL, READ, sizeof(unsigned int));
220   _(METEORGSIGNAL, WRITE, sizeof(unsigned int));
221   _(METEORSVIDEO, READ, struct_meteor_video_sz);
222   _(METEORGVIDEO, WRITE, struct_meteor_video_sz);
223   _(METEORSBRIG, READ, sizeof(unsigned char));
224   _(METEORGBRIG, WRITE, sizeof(unsigned char));
225   _(METEORSCSAT, READ, sizeof(unsigned char));
226   _(METEORGCSAT, WRITE, sizeof(unsigned char));
227   _(METEORSCONT, READ, sizeof(unsigned char));
228   _(METEORGCONT, WRITE, sizeof(unsigned char));
229   _(METEORSHWS, READ, sizeof(unsigned char));
230   _(METEORGHWS, WRITE, sizeof(unsigned char));
231   _(METEORSVWS, READ, sizeof(unsigned char));
232   _(METEORGVWS, WRITE, sizeof(unsigned char));
233   _(METEORSTS, READ, sizeof(unsigned char));
234   _(METEORGTS, WRITE, sizeof(unsigned char));
235   _(TVTUNER_SETCHNL, READ, sizeof(unsigned int));
236   _(TVTUNER_GETCHNL, WRITE, sizeof(unsigned int));
237   _(TVTUNER_SETTYPE, READ, sizeof(unsigned int));
238   _(TVTUNER_GETTYPE, WRITE, sizeof(unsigned int));
239   _(TVTUNER_GETSTATUS, WRITE, sizeof(unsigned int));
240   _(TVTUNER_SETFREQ, READ, sizeof(unsigned int));
241   _(TVTUNER_GETFREQ, WRITE, sizeof(unsigned int));
242   _(TVTUNER_SETAFC, READ, sizeof(int));
243   _(TVTUNER_GETAFC, WRITE, sizeof(int));
244   _(RADIO_SETMODE, READ, sizeof(unsigned int));
245   _(RADIO_GETMODE, WRITE, sizeof(unsigned char));
246   _(RADIO_SETFREQ, READ, sizeof(unsigned int));
247   _(RADIO_GETFREQ, WRITE, sizeof(unsigned int));
248   _(METEORSACTPIXFMT, READ, sizeof(int));
249   _(METEORGACTPIXFMT, WRITE, sizeof(int));
250   _(METEORGSUPPIXFMT, READWRITE, struct_meteor_pixfmt_sz);
251   _(TVTUNER_GETCHNLSET, READWRITE, struct_bktr_chnlset_sz);
252   _(REMOTE_GETKEY, WRITE, struct_bktr_remote_sz);
253   /* Entries from file: dev/ic/icp_ioctl.h */
254   _(GDT_IOCTL_GENERAL, READWRITE, struct_gdt_ucmd_sz);
255   _(GDT_IOCTL_DRVERS, WRITE, sizeof(int));
256   _(GDT_IOCTL_CTRTYPE, READWRITE, struct_gdt_ctrt_sz);
257   _(GDT_IOCTL_OSVERS, WRITE, struct_gdt_osv_sz);
258   _(GDT_IOCTL_CTRCNT, WRITE, sizeof(int));
259   _(GDT_IOCTL_EVENT, READWRITE, struct_gdt_event_sz);
260   _(GDT_IOCTL_STATIST, WRITE, struct_gdt_statist_sz);
261   _(GDT_IOCTL_RESCAN, READWRITE, struct_gdt_rescan_sz);
262   /* Entries from file: dev/ic/isp_ioctl.h */
263   _(ISP_SDBLEV, READWRITE, sizeof(int));
264   _(ISP_RESETHBA, NONE, 0);
265   _(ISP_RESCAN, NONE, 0);
266   _(ISP_SETROLE, READWRITE, sizeof(int));
267   _(ISP_GETROLE, WRITE, sizeof(int));
268   _(ISP_GET_STATS, WRITE, struct_isp_stats_sz);
269   _(ISP_CLR_STATS, NONE, 0);
270   _(ISP_FC_LIP, NONE, 0);
271   _(ISP_FC_GETDINFO, READWRITE, struct_isp_fc_device_sz);
272   _(ISP_GET_FW_CRASH_DUMP, NONE, 0);
273   _(ISP_FORCE_CRASH_DUMP, NONE, 0);
274   _(ISP_FC_GETHINFO, READWRITE, struct_isp_hba_device_sz);
275   _(ISP_TSK_MGMT, READWRITE, struct_isp_fc_tsk_mgmt_sz);
276   _(ISP_FC_GETDLIST, NONE, 0);
277   /* Entries from file: dev/ic/mlxio.h */
278   _(MLXD_STATUS, WRITE, sizeof(int));
279   _(MLXD_CHECKASYNC, WRITE, sizeof(int));
280   _(MLXD_DETACH, READ, sizeof(int));
281   _(MLX_RESCAN_DRIVES, NONE, 0);
282   _(MLX_PAUSE_CHANNEL, READ, struct_mlx_pause_sz);
283   _(MLX_COMMAND, READWRITE, struct_mlx_usercommand_sz);
284   _(MLX_REBUILDASYNC, READWRITE, struct_mlx_rebuild_request_sz);
285   _(MLX_REBUILDSTAT, WRITE, struct_mlx_rebuild_status_sz);
286   _(MLX_GET_SYSDRIVE, READWRITE, sizeof(int));
287   _(MLX_GET_CINFO, WRITE, struct_mlx_cinfo_sz);
288   /* Entries from file: dev/ic/nvmeio.h */
289   _(NVME_PASSTHROUGH_CMD, READWRITE, struct_nvme_pt_command_sz);
290   /* Entries from file: dev/ic/qemufwcfgio.h */
291   _(FWCFGIO_SET_INDEX, READ, sizeof(u16));
292   /* Entries from file: dev/ir/irdaio.h */
293   _(IRDA_RESET_PARAMS, NONE, 0);
294   _(IRDA_SET_PARAMS, READ, struct_irda_params_sz);
295   _(IRDA_GET_SPEEDMASK, WRITE, sizeof(unsigned int));
296   _(IRDA_GET_TURNAROUNDMASK, WRITE, sizeof(unsigned int));
297   _(IRFRAMETTY_GET_DEVICE, WRITE, sizeof(unsigned int));
298   _(IRFRAMETTY_GET_DONGLE, WRITE, sizeof(unsigned int));
299   _(IRFRAMETTY_SET_DONGLE, READ, sizeof(unsigned int));
300   /* Entries from file: dev/isa/isvio.h */
301   _(ISV_CMD, READWRITE, struct_isv_cmd_sz);
302   /* Entries from file: dev/isa/wtreg.h */
303   _(WTQICMD, NONE, 0);
304   /* Entries from file: dev/iscsi/iscsi_ioctl.h */
305   _(ISCSI_GET_VERSION, READWRITE, struct_iscsi_get_version_parameters_sz);
306   _(ISCSI_LOGIN, READWRITE, struct_iscsi_login_parameters_sz);
307   _(ISCSI_LOGOUT, READWRITE, struct_iscsi_logout_parameters_sz);
308   _(ISCSI_ADD_CONNECTION, READWRITE, struct_iscsi_login_parameters_sz);
309   _(ISCSI_RESTORE_CONNECTION, READWRITE, struct_iscsi_login_parameters_sz);
310   _(ISCSI_REMOVE_CONNECTION, READWRITE, struct_iscsi_remove_parameters_sz);
311   _(ISCSI_CONNECTION_STATUS, READWRITE, struct_iscsi_conn_status_parameters_sz);
312   _(ISCSI_SEND_TARGETS, READWRITE, struct_iscsi_send_targets_parameters_sz);
313   _(ISCSI_SET_NODE_NAME, READWRITE, struct_iscsi_set_node_name_parameters_sz);
314   _(ISCSI_IO_COMMAND, READWRITE, struct_iscsi_iocommand_parameters_sz);
315   _(ISCSI_REGISTER_EVENT, READWRITE, struct_iscsi_register_event_parameters_sz);
316   _(ISCSI_DEREGISTER_EVENT, READWRITE,
317     struct_iscsi_register_event_parameters_sz);
318   _(ISCSI_WAIT_EVENT, READWRITE, struct_iscsi_wait_event_parameters_sz);
319   _(ISCSI_POLL_EVENT, READWRITE, struct_iscsi_wait_event_parameters_sz);
320   /* Entries from file: dev/ofw/openfirmio.h */
321   _(OFIOCGET, READWRITE, struct_ofiocdesc_sz);
322   _(OFIOCSET, READ, struct_ofiocdesc_sz);
323   _(OFIOCNEXTPROP, READWRITE, struct_ofiocdesc_sz);
324   _(OFIOCGETOPTNODE, WRITE, sizeof(int));
325   _(OFIOCGETNEXT, READWRITE, sizeof(int));
326   _(OFIOCGETCHILD, READWRITE, sizeof(int));
327   _(OFIOCFINDDEVICE, READWRITE, struct_ofiocdesc_sz);
328   /* Entries from file: dev/pci/amrio.h */
329   _(AMR_IO_VERSION, WRITE, sizeof(int));
330   _(AMR_IO_COMMAND, READWRITE, struct_amr_user_ioctl_sz);
331   /* Entries from file: dev/pci/mlyio.h */
332   _(MLYIO_COMMAND, READWRITE, struct_mly_user_command_sz);
333   _(MLYIO_HEALTH, READ, struct_mly_user_health_sz);
334   /* Entries from file: dev/pci/pciio.h */
335   _(PCI_IOC_CFGREAD, READWRITE, struct_pciio_cfgreg_sz);
336   _(PCI_IOC_CFGWRITE, READ, struct_pciio_cfgreg_sz);
337   _(PCI_IOC_BDF_CFGREAD, READWRITE, struct_pciio_bdf_cfgreg_sz);
338   _(PCI_IOC_BDF_CFGWRITE, READ, struct_pciio_bdf_cfgreg_sz);
339   _(PCI_IOC_BUSINFO, WRITE, struct_pciio_businfo_sz);
340   _(PCI_IOC_DRVNAME, READWRITE, struct_pciio_drvname_sz);
341   _(PCI_IOC_DRVNAMEONBUS, READWRITE, struct_pciio_drvnameonbus_sz);
342   /* Entries from file: dev/pci/tweio.h */
343   _(TWEIO_COMMAND, READWRITE, struct_twe_usercommand_sz);
344   _(TWEIO_STATS, READWRITE, union_twe_statrequest_sz);
345   _(TWEIO_AEN_POLL, WRITE, sizeof(int));
346   _(TWEIO_AEN_WAIT, WRITE, sizeof(int));
347   _(TWEIO_SET_PARAM, READ, struct_twe_paramcommand_sz);
348   _(TWEIO_GET_PARAM, READ, struct_twe_paramcommand_sz);
349   _(TWEIO_RESET, NONE, 0);
350   _(TWEIO_ADD_UNIT, READ, struct_twe_drivecommand_sz);
351   _(TWEIO_DEL_UNIT, READ, struct_twe_drivecommand_sz);
352   /* Entries from file: dev/pcmcia/if_cnwioctl.h */
353   _(SIOCSCNWDOMAIN, READ, struct_ifreq_sz);
354   _(SIOCGCNWDOMAIN, READWRITE, struct_ifreq_sz);
355   _(SIOCSCNWKEY, READWRITE, struct_ifreq_sz);
356   _(SIOCGCNWSTATUS, READWRITE, struct_cnwstatus_sz);
357   _(SIOCGCNWSTATS, READWRITE, struct_cnwistats_sz);
358   _(SIOCGCNWTRAIL, READWRITE, struct_cnwitrail_sz);
359   /* Entries from file: dev/pcmcia/if_rayreg.h */
360   _(SIOCGRAYSIGLEV, READWRITE, struct_ifreq_sz);
361   /* Entries from file: dev/raidframe/raidframeio.h */
362   _(RAIDFRAME_SHUTDOWN, NONE, 0);
363   _(RAIDFRAME_TUR, READ, sizeof(u64));
364   _(RAIDFRAME_FAIL_DISK, READ, struct_rf_recon_req_sz);
365   _(RAIDFRAME_CHECK_RECON_STATUS, READWRITE, sizeof(int));
366   _(RAIDFRAME_REWRITEPARITY, NONE, 0);
367   _(RAIDFRAME_COPYBACK, NONE, 0);
368   _(RAIDFRAME_SPARET_WAIT, WRITE, struct_RF_SparetWait_sz);
369   _(RAIDFRAME_SEND_SPARET, READ, sizeof(uptr));
370   _(RAIDFRAME_ABORT_SPARET_WAIT, NONE, 0);
371   _(RAIDFRAME_START_ATRACE, NONE, 0);
372   _(RAIDFRAME_STOP_ATRACE, NONE, 0);
373   _(RAIDFRAME_GET_SIZE, WRITE, sizeof(int));
374   _(RAIDFRAME_RESET_ACCTOTALS, NONE, 0);
375   _(RAIDFRAME_KEEP_ACCTOTALS, READ, sizeof(int));
376   _(RAIDFRAME_GET_COMPONENT_LABEL, READWRITE, struct_RF_ComponentLabel_sz);
377   _(RAIDFRAME_SET_COMPONENT_LABEL, READ, struct_RF_ComponentLabel_sz);
378   _(RAIDFRAME_INIT_LABELS, READ, struct_RF_ComponentLabel_sz);
379   _(RAIDFRAME_ADD_HOT_SPARE, READ, struct_RF_SingleComponent_sz);
380   _(RAIDFRAME_REMOVE_HOT_SPARE, READ, struct_RF_SingleComponent_sz);
381   _(RAIDFRAME_REBUILD_IN_PLACE, READ, struct_RF_SingleComponent_sz);
382   _(RAIDFRAME_CHECK_PARITY, READWRITE, sizeof(int));
383   _(RAIDFRAME_CHECK_PARITYREWRITE_STATUS, READWRITE, sizeof(int));
384   _(RAIDFRAME_CHECK_COPYBACK_STATUS, READWRITE, sizeof(int));
385   _(RAIDFRAME_SET_AUTOCONFIG, READWRITE, sizeof(int));
386   _(RAIDFRAME_SET_ROOT, READWRITE, sizeof(int));
387   _(RAIDFRAME_DELETE_COMPONENT, READ, struct_RF_SingleComponent_sz);
388   _(RAIDFRAME_INCORPORATE_HOT_SPARE, READ, struct_RF_SingleComponent_sz);
389   _(RAIDFRAME_CHECK_RECON_STATUS_EXT, READWRITE, struct_RF_ProgressInfo_sz);
390   _(RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT, READWRITE,
391     struct_RF_ProgressInfo_sz);
392   _(RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, READWRITE, struct_RF_ProgressInfo_sz);
393   _(RAIDFRAME_PARITYMAP_STATUS, WRITE, struct_rf_pmstat_sz);
394   _(RAIDFRAME_PARITYMAP_GET_DISABLE, WRITE, sizeof(int));
395   _(RAIDFRAME_PARITYMAP_SET_DISABLE, READ, sizeof(int));
396   _(RAIDFRAME_PARITYMAP_SET_PARAMS, READ, struct_rf_pmparams_sz);
397   _(RAIDFRAME_SET_LAST_UNIT, READ, sizeof(int));
398   _(RAIDFRAME_GET_INFO, READWRITE, sizeof(uptr));
399   _(RAIDFRAME_CONFIGURE, READ, sizeof(uptr));
400   /* Entries from file: dev/sbus/mbppio.h */
401   _(MBPPIOCSPARAM, READ, struct_mbpp_param_sz);
402   _(MBPPIOCGPARAM, WRITE, struct_mbpp_param_sz);
403   _(MBPPIOCGSTAT, WRITE, sizeof(int));
404   /* Entries from file: dev/scsipi/ses.h */
405   _(SESIOC_GETNOBJ, NONE, 0);
406   _(SESIOC_GETOBJMAP, NONE, 0);
407   _(SESIOC_GETENCSTAT, NONE, 0);
408   _(SESIOC_SETENCSTAT, NONE, 0);
409   _(SESIOC_GETOBJSTAT, NONE, 0);
410   _(SESIOC_SETOBJSTAT, NONE, 0);
411   _(SESIOC_GETTEXT, NONE, 0);
412   _(SESIOC_INIT, NONE, 0);
413   /* Entries from file: dev/sun/disklabel.h */
414   _(SUN_DKIOCGGEOM, WRITE, struct_sun_dkgeom_sz);
415   _(SUN_DKIOCINFO, WRITE, struct_sun_dkctlr_sz);
416   _(SUN_DKIOCGPART, WRITE, struct_sun_dkpart_sz);
417   /* Entries from file: dev/sun/fbio.h */
418   _(FBIOGTYPE, WRITE, struct_fbtype_sz);
419   _(FBIOPUTCMAP, READ, struct_fbcmap_sz);
420   _(FBIOGETCMAP, READ, struct_fbcmap_sz);
421   _(FBIOGATTR, WRITE, struct_fbgattr_sz);
422   _(FBIOSVIDEO, READ, sizeof(int));
423   _(FBIOGVIDEO, WRITE, sizeof(int));
424   _(FBIOSCURSOR, READ, struct_fbcursor_sz);
425   _(FBIOGCURSOR, READWRITE, struct_fbcursor_sz);
426   _(FBIOSCURPOS, READ, struct_fbcurpos_sz);
427   _(FBIOGCURPOS, READ, struct_fbcurpos_sz);
428   _(FBIOGCURMAX, WRITE, struct_fbcurpos_sz);
429   /* Entries from file: dev/sun/kbio.h */
430   _(KIOCTRANS, READ, sizeof(int));
431   _(KIOCSETKEY, READWRITE, struct_okiockey_sz);
432   _(KIOCGETKEY, READWRITE, struct_okiockey_sz);
433   _(KIOCGTRANS, WRITE, sizeof(int));
434   _(KIOCCMD, READ, sizeof(int));
435   _(KIOCTYPE, WRITE, sizeof(int));
436   _(KIOCSDIRECT, READ, sizeof(int));
437   _(KIOCSKEY, READ, struct_kiockeymap_sz);
438   _(KIOCGKEY, READWRITE, struct_kiockeymap_sz);
439   _(KIOCSLED, READ, sizeof(char));
440   _(KIOCGLED, WRITE, sizeof(char));
441   _(KIOCLAYOUT, WRITE, sizeof(int));
442   /* Entries from file: dev/sun/vuid_event.h */
443   _(VUIDSFORMAT, READ, sizeof(int));
444   _(VUIDGFORMAT, WRITE, sizeof(int));
445   /* Entries from file: dev/tc/sticio.h */
446   _(STICIO_GXINFO, WRITE, struct_stic_xinfo_sz);
447   _(STICIO_RESET, NONE, 0);
448   _(STICIO_STARTQ, NONE, 0);
449   _(STICIO_STOPQ, NONE, 0);
450   /* Entries from file: dev/usb/ukyopon.h */
451   _(UKYOPON_IDENTIFY, WRITE, struct_ukyopon_identify_sz);
452   /* Entries from file: dev/usb/urio.h */
453   _(URIO_SEND_COMMAND, READWRITE, struct_urio_command_sz);
454   _(URIO_RECV_COMMAND, READWRITE, struct_urio_command_sz);
455   /* Entries from file: dev/usb/usb.h */
456   _(USB_REQUEST, READWRITE, struct_usb_ctl_request_sz);
457   _(USB_SETDEBUG, READ, sizeof(int));
458   _(USB_DISCOVER, NONE, 0);
459   _(USB_DEVICEINFO, READWRITE, struct_usb_device_info_sz);
460   _(USB_DEVICEINFO_OLD, READWRITE, struct_usb_device_info_old_sz);
461   _(USB_DEVICESTATS, WRITE, struct_usb_device_stats_sz);
462   _(USB_GET_REPORT_DESC, WRITE, struct_usb_ctl_report_desc_sz);
463   _(USB_SET_IMMED, READ, sizeof(int));
464   _(USB_GET_REPORT, READWRITE, struct_usb_ctl_report_sz);
465   _(USB_SET_REPORT, READ, struct_usb_ctl_report_sz);
466   _(USB_GET_REPORT_ID, WRITE, sizeof(int));
467   _(USB_GET_CONFIG, WRITE, sizeof(int));
468   _(USB_SET_CONFIG, READ, sizeof(int));
469   _(USB_GET_ALTINTERFACE, READWRITE, struct_usb_alt_interface_sz);
470   _(USB_SET_ALTINTERFACE, READWRITE, struct_usb_alt_interface_sz);
471   _(USB_GET_NO_ALT, READWRITE, struct_usb_alt_interface_sz);
472   _(USB_GET_DEVICE_DESC, WRITE, struct_usb_device_descriptor_sz);
473   _(USB_GET_CONFIG_DESC, READWRITE, struct_usb_config_desc_sz);
474   _(USB_GET_INTERFACE_DESC, READWRITE, struct_usb_interface_desc_sz);
475   _(USB_GET_ENDPOINT_DESC, READWRITE, struct_usb_endpoint_desc_sz);
476   _(USB_GET_FULL_DESC, READWRITE, struct_usb_full_desc_sz);
477   _(USB_GET_STRING_DESC, READWRITE, struct_usb_string_desc_sz);
478   _(USB_DO_REQUEST, READWRITE, struct_usb_ctl_request_sz);
479   _(USB_GET_DEVICEINFO, WRITE, struct_usb_device_info_sz);
480   _(USB_GET_DEVICEINFO_OLD, WRITE, struct_usb_device_info_old_sz);
481   _(USB_SET_SHORT_XFER, READ, sizeof(int));
482   _(USB_SET_TIMEOUT, READ, sizeof(int));
483   _(USB_SET_BULK_RA, READ, sizeof(int));
484   _(USB_SET_BULK_WB, READ, sizeof(int));
485   _(USB_SET_BULK_RA_OPT, READ, struct_usb_bulk_ra_wb_opt_sz);
486   _(USB_SET_BULK_WB_OPT, READ, struct_usb_bulk_ra_wb_opt_sz);
487   _(USB_GET_CM_OVER_DATA, WRITE, sizeof(int));
488   _(USB_SET_CM_OVER_DATA, READ, sizeof(int));
489   /* Entries from file: dev/usb/utoppy.h */
490   _(UTOPPYIOTURBO, READ, sizeof(int));
491   _(UTOPPYIOREBOOT, NONE, 0);
492   _(UTOPPYIOSTATS, WRITE, struct_utoppy_stats_sz);
493   _(UTOPPYIORENAME, READ, struct_utoppy_rename_sz);
494   _(UTOPPYIOMKDIR, READ, sizeof(uptr));
495   _(UTOPPYIODELETE, READ, sizeof(uptr));
496   _(UTOPPYIOREADDIR, READ, sizeof(uptr));
497   _(UTOPPYIOREADFILE, READ, struct_utoppy_readfile_sz);
498   _(UTOPPYIOWRITEFILE, READ, struct_utoppy_writefile_sz);
499   /* Entries from file: dev/vme/xio.h */
500   _(DIOSXDCMD, READWRITE, struct_xd_iocmd_sz);
501   /* Entries from file: dev/wscons/wsdisplay_usl_io.h */
502   _(VT_OPENQRY, WRITE, sizeof(int));
503   _(VT_SETMODE, READ, struct_vt_mode_sz);
504   _(VT_GETMODE, WRITE, struct_vt_mode_sz);
505   _(VT_RELDISP, NONE, 0);
506   _(VT_ACTIVATE, NONE, 0);
507   _(VT_WAITACTIVE, NONE, 0);
508   _(VT_GETACTIVE, WRITE, sizeof(int));
509   _(VT_GETSTATE, WRITE, struct_vt_stat_sz);
510   _(KDGETKBENT, READWRITE, struct_kbentry_sz);
511   _(KDGKBMODE, WRITE, sizeof(int));
512   _(KDSKBMODE, NONE, 0);
513   _(KDMKTONE, NONE, 0);
514   _(KDSETMODE, NONE, 0);
515   _(KDENABIO, NONE, 0);
516   _(KDDISABIO, NONE, 0);
517   _(KDGKBTYPE, WRITE, sizeof(char));
518   _(KDGETLED, WRITE, sizeof(int));
519   _(KDSETLED, NONE, 0);
520   _(KDSETRAD, NONE, 0);
521   _(VGAPCVTID, READWRITE, struct_pcvtid_sz);
522   _(CONS_GETVERS, WRITE, sizeof(int));
523   /* Entries from file: dev/wscons/wsconsio.h */
524   _(WSKBDIO_GTYPE, WRITE, sizeof(unsigned int));
525   _(WSKBDIO_BELL, NONE, 0);
526   _(WSKBDIO_COMPLEXBELL, READ, struct_wskbd_bell_data_sz);
527   _(WSKBDIO_SETBELL, READ, struct_wskbd_bell_data_sz);
528   _(WSKBDIO_GETBELL, WRITE, struct_wskbd_bell_data_sz);
529   _(WSKBDIO_SETDEFAULTBELL, READ, struct_wskbd_bell_data_sz);
530   _(WSKBDIO_GETDEFAULTBELL, WRITE, struct_wskbd_bell_data_sz);
531   _(WSKBDIO_SETKEYREPEAT, READ, struct_wskbd_keyrepeat_data_sz);
532   _(WSKBDIO_GETKEYREPEAT, WRITE, struct_wskbd_keyrepeat_data_sz);
533   _(WSKBDIO_SETDEFAULTKEYREPEAT, READ, struct_wskbd_keyrepeat_data_sz);
534   _(WSKBDIO_GETDEFAULTKEYREPEAT, WRITE, struct_wskbd_keyrepeat_data_sz);
535   _(WSKBDIO_SETLEDS, READ, sizeof(int));
536   _(WSKBDIO_GETLEDS, WRITE, sizeof(int));
537   _(WSKBDIO_GETMAP, READWRITE, struct_wskbd_map_data_sz);
538   _(WSKBDIO_SETMAP, READ, struct_wskbd_map_data_sz);
539   _(WSKBDIO_GETENCODING, WRITE, sizeof(int));
540   _(WSKBDIO_SETENCODING, READ, sizeof(int));
541   _(WSKBDIO_SETMODE, READ, sizeof(int));
542   _(WSKBDIO_GETMODE, WRITE, sizeof(int));
543   _(WSKBDIO_SETKEYCLICK, READ, sizeof(int));
544   _(WSKBDIO_GETKEYCLICK, WRITE, sizeof(int));
545   _(WSKBDIO_GETSCROLL, WRITE, struct_wskbd_scroll_data_sz);
546   _(WSKBDIO_SETSCROLL, READ, struct_wskbd_scroll_data_sz);
547   _(WSKBDIO_SETVERSION, READ, sizeof(int));
548   _(WSMOUSEIO_GTYPE, WRITE, sizeof(unsigned int));
549   _(WSMOUSEIO_SRES, READ, sizeof(unsigned int));
550   _(WSMOUSEIO_SSCALE, READ, sizeof(unsigned int));
551   _(WSMOUSEIO_SRATE, READ, sizeof(unsigned int));
552   _(WSMOUSEIO_SCALIBCOORDS, READ, struct_wsmouse_calibcoords_sz);
553   _(WSMOUSEIO_GCALIBCOORDS, WRITE, struct_wsmouse_calibcoords_sz);
554   _(WSMOUSEIO_GETID, READWRITE, struct_wsmouse_id_sz);
555   _(WSMOUSEIO_GETREPEAT, WRITE, struct_wsmouse_repeat_sz);
556   _(WSMOUSEIO_SETREPEAT, READ, struct_wsmouse_repeat_sz);
557   _(WSMOUSEIO_SETVERSION, READ, sizeof(int));
558   _(WSDISPLAYIO_GTYPE, WRITE, sizeof(unsigned int));
559   _(WSDISPLAYIO_GINFO, WRITE, struct_wsdisplay_fbinfo_sz);
560   _(WSDISPLAYIO_GETCMAP, READ, struct_wsdisplay_cmap_sz);
561   _(WSDISPLAYIO_PUTCMAP, READ, struct_wsdisplay_cmap_sz);
562   _(WSDISPLAYIO_GVIDEO, WRITE, sizeof(unsigned int));
563   _(WSDISPLAYIO_SVIDEO, READ, sizeof(unsigned int));
564   _(WSDISPLAYIO_GCURPOS, WRITE, struct_wsdisplay_curpos_sz);
565   _(WSDISPLAYIO_SCURPOS, READ, struct_wsdisplay_curpos_sz);
566   _(WSDISPLAYIO_GCURMAX, WRITE, struct_wsdisplay_curpos_sz);
567   _(WSDISPLAYIO_GCURSOR, READWRITE, struct_wsdisplay_cursor_sz);
568   _(WSDISPLAYIO_SCURSOR, READ, struct_wsdisplay_cursor_sz);
569   _(WSDISPLAYIO_GMODE, WRITE, sizeof(unsigned int));
570   _(WSDISPLAYIO_SMODE, READ, sizeof(unsigned int));
571   _(WSDISPLAYIO_LDFONT, READ, struct_wsdisplay_font_sz);
572   _(WSDISPLAYIO_ADDSCREEN, READ, struct_wsdisplay_addscreendata_sz);
573   _(WSDISPLAYIO_DELSCREEN, READ, struct_wsdisplay_delscreendata_sz);
574   _(WSDISPLAYIO_SFONT, READ, struct_wsdisplay_usefontdata_sz);
575   _(_O_WSDISPLAYIO_SETKEYBOARD, READWRITE, struct_wsdisplay_kbddata_sz);
576   _(WSDISPLAYIO_GETPARAM, READWRITE, struct_wsdisplay_param_sz);
577   _(WSDISPLAYIO_SETPARAM, READWRITE, struct_wsdisplay_param_sz);
578   _(WSDISPLAYIO_GETACTIVESCREEN, WRITE, sizeof(int));
579   _(WSDISPLAYIO_GETWSCHAR, READWRITE, struct_wsdisplay_char_sz);
580   _(WSDISPLAYIO_PUTWSCHAR, READWRITE, struct_wsdisplay_char_sz);
581   _(WSDISPLAYIO_DGSCROLL, WRITE, struct_wsdisplay_scroll_data_sz);
582   _(WSDISPLAYIO_DSSCROLL, READ, struct_wsdisplay_scroll_data_sz);
583   _(WSDISPLAYIO_GMSGATTRS, WRITE, struct_wsdisplay_msgattrs_sz);
584   _(WSDISPLAYIO_SMSGATTRS, READ, struct_wsdisplay_msgattrs_sz);
585   _(WSDISPLAYIO_GBORDER, WRITE, sizeof(int));
586   _(WSDISPLAYIO_SBORDER, READ, sizeof(int));
587   _(WSDISPLAYIO_SSPLASH, READ, sizeof(int));
588   _(WSDISPLAYIO_SPROGRESS, READ, sizeof(int));
589   _(WSDISPLAYIO_LINEBYTES, WRITE, sizeof(unsigned int));
590   _(WSDISPLAYIO_SETVERSION, READ, sizeof(int));
591   _(WSMUXIO_ADD_DEVICE, READ, struct_wsmux_device_sz);
592   _(WSMUXIO_REMOVE_DEVICE, READ, struct_wsmux_device_sz);
593   _(WSMUXIO_LIST_DEVICES, READWRITE, struct_wsmux_device_list_sz);
594   _(WSMUXIO_INJECTEVENT, READ, struct_wscons_event_sz);
595   _(WSDISPLAYIO_GET_BUSID, WRITE, struct_wsdisplayio_bus_id_sz);
596   _(WSDISPLAYIO_GET_EDID, READWRITE, struct_wsdisplayio_edid_info_sz);
597   _(WSDISPLAYIO_SET_POLLING, READ, sizeof(int));
598   _(WSDISPLAYIO_GET_FBINFO, READWRITE, struct_wsdisplayio_fbinfo_sz);
599   _(WSDISPLAYIO_DOBLIT, READWRITE, struct_wsdisplayio_blit_sz);
600   _(WSDISPLAYIO_WAITBLIT, READWRITE, struct_wsdisplayio_blit_sz);
601   /* Entries from file: dev/biovar.h */
602   _(BIOCLOCATE, READWRITE, struct_bio_locate_sz);
603   _(BIOCINQ, READWRITE, struct_bioc_inq_sz);
604   _(BIOCDISK_NOVOL, READWRITE, struct_bioc_disk_sz);
605   _(BIOCDISK, READWRITE, struct_bioc_disk_sz);
606   _(BIOCVOL, READWRITE, struct_bioc_vol_sz);
607   _(BIOCALARM, READWRITE, struct_bioc_alarm_sz);
608   _(BIOCBLINK, READWRITE, struct_bioc_blink_sz);
609   _(BIOCSETSTATE, READWRITE, struct_bioc_setstate_sz);
610   _(BIOCVOLOPS, READWRITE, struct_bioc_volops_sz);
611   /* Entries from file: dev/md.h */
612   _(MD_GETCONF, WRITE, struct_md_conf_sz);
613   _(MD_SETCONF, READ, struct_md_conf_sz);
614   /* Entries from file: dev/ccdvar.h */
615   _(CCDIOCSET, READWRITE, struct_ccd_ioctl_sz);
616   _(CCDIOCCLR, READ, struct_ccd_ioctl_sz);
617   /* Entries from file: dev/cgdvar.h */
618   _(CGDIOCSET, READWRITE, struct_cgd_ioctl_sz);
619   _(CGDIOCCLR, READ, struct_cgd_ioctl_sz);
620   _(CGDIOCGET, READWRITE, struct_cgd_user_sz);
621   /* Entries from file: dev/fssvar.h */
622   _(FSSIOCSET, READ, struct_fss_set_sz);
623   _(FSSIOCGET, WRITE, struct_fss_get_sz);
624   _(FSSIOCCLR, NONE, 0);
625   _(FSSIOFSET, READ, sizeof(int));
626   _(FSSIOFGET, WRITE, sizeof(int));
627   /* Entries from file: dev/bluetooth/btdev.h */
628   _(BTDEV_ATTACH, READ, struct_plistref_sz);
629   _(BTDEV_DETACH, READ, struct_plistref_sz);
630   /* Entries from file: dev/bluetooth/btsco.h */
631   _(BTSCO_GETINFO, WRITE, struct_btsco_info_sz);
632   /* Entries from file: dev/kttcpio.h */
633   _(KTTCP_IO_SEND, READWRITE, struct_kttcp_io_args_sz);
634   _(KTTCP_IO_RECV, READWRITE, struct_kttcp_io_args_sz);
635   /* Entries from file: dev/lockstat.h */
636   _(IOC_LOCKSTAT_GVERSION, WRITE, sizeof(int));
637   _(IOC_LOCKSTAT_ENABLE, READ, struct_lsenable_sz);
638   _(IOC_LOCKSTAT_DISABLE, WRITE, struct_lsdisable_sz);
639   /* Entries from file: dev/vndvar.h */
640   _(VNDIOCSET, READWRITE, struct_vnd_ioctl_sz);
641   _(VNDIOCCLR, READ, struct_vnd_ioctl_sz);
642   _(VNDIOCGET, READWRITE, struct_vnd_user_sz);
643   /* Entries from file: dev/spkrio.h */
644   _(SPKRTONE, READ, struct_tone_sz);
645   _(SPKRTUNE, NONE, 0);
646   _(SPKRGETVOL, WRITE, sizeof(unsigned int));
647   _(SPKRSETVOL, READ, sizeof(unsigned int));
648 #if defined(__x86_64__)
649   /* Entries from file: dev/nvmm/nvmm_ioctl.h */
650   _(NVMM_IOC_CAPABILITY, WRITE, struct_nvmm_ioc_capability_sz);
651   _(NVMM_IOC_MACHINE_CREATE, READWRITE, struct_nvmm_ioc_machine_create_sz);
652   _(NVMM_IOC_MACHINE_DESTROY, READ, struct_nvmm_ioc_machine_destroy_sz);
653   _(NVMM_IOC_MACHINE_CONFIGURE, READ, struct_nvmm_ioc_machine_configure_sz);
654   _(NVMM_IOC_VCPU_CREATE, READ, struct_nvmm_ioc_vcpu_create_sz);
655   _(NVMM_IOC_VCPU_DESTROY, READ, struct_nvmm_ioc_vcpu_destroy_sz);
656   _(NVMM_IOC_VCPU_SETSTATE, READ, struct_nvmm_ioc_vcpu_setstate_sz);
657   _(NVMM_IOC_VCPU_GETSTATE, READ, struct_nvmm_ioc_vcpu_getstate_sz);
658   _(NVMM_IOC_VCPU_INJECT, READ, struct_nvmm_ioc_vcpu_inject_sz);
659   _(NVMM_IOC_VCPU_RUN, READWRITE, struct_nvmm_ioc_vcpu_run_sz);
660   _(NVMM_IOC_GPA_MAP, READ, struct_nvmm_ioc_gpa_map_sz);
661   _(NVMM_IOC_GPA_UNMAP, READ, struct_nvmm_ioc_gpa_unmap_sz);
662   _(NVMM_IOC_HVA_MAP, READ, struct_nvmm_ioc_hva_map_sz);
663   _(NVMM_IOC_HVA_UNMAP, READ, struct_nvmm_ioc_hva_unmap_sz);
664   _(NVMM_IOC_CTL, READ, struct_nvmm_ioc_ctl_sz);
665 #endif
666   /* Entries from file: dev/spi/spi_io.h */
667   _(SPI_IOCTL_CONFIGURE, READ, struct_spi_ioctl_configure_sz);
668   _(SPI_IOCTL_TRANSFER, READ, struct_spi_ioctl_transfer_sz);
669   /* Entries from file: fs/autofs/autofs_ioctl.h */
670   _(AUTOFSREQUEST, WRITE, struct_autofs_daemon_request_sz);
671   _(AUTOFSDONE, READ, struct_autofs_daemon_done_sz);
672   /* Entries from file: net/bpf.h */
673   _(BIOCGBLEN, WRITE, sizeof(unsigned int));
674   _(BIOCSBLEN, READWRITE, sizeof(unsigned int));
675   _(BIOCSETF, READ, struct_bpf_program_sz);
676   _(BIOCFLUSH, NONE, 0);
677   _(BIOCPROMISC, NONE, 0);
678   _(BIOCGDLT, WRITE, sizeof(unsigned int));
679   _(BIOCGETIF, WRITE, struct_ifreq_sz);
680   _(BIOCSETIF, READ, struct_ifreq_sz);
681   _(BIOCGSTATS, WRITE, struct_bpf_stat_sz);
682   _(BIOCGSTATSOLD, WRITE, struct_bpf_stat_old_sz);
683   _(BIOCIMMEDIATE, READ, sizeof(unsigned int));
684   _(BIOCVERSION, WRITE, struct_bpf_version_sz);
685   _(BIOCSTCPF, READ, struct_bpf_program_sz);
686   _(BIOCSUDPF, READ, struct_bpf_program_sz);
687   _(BIOCGHDRCMPLT, WRITE, sizeof(unsigned int));
688   _(BIOCSHDRCMPLT, READ, sizeof(unsigned int));
689   _(BIOCSDLT, READ, sizeof(unsigned int));
690   _(BIOCGDLTLIST, READWRITE, struct_bpf_dltlist_sz);
691   _(BIOCGDIRECTION, WRITE, sizeof(unsigned int));
692   _(BIOCSDIRECTION, READ, sizeof(unsigned int));
693   _(BIOCSRTIMEOUT, READ, struct_timeval_sz);
694   _(BIOCGRTIMEOUT, WRITE, struct_timeval_sz);
695   _(BIOCGFEEDBACK, WRITE, sizeof(unsigned int));
696   _(BIOCSFEEDBACK, READ, sizeof(unsigned int));
697   /* Entries from file: net/if_gre.h */
698   _(GRESADDRS, READ, struct_ifreq_sz);
699   _(GRESADDRD, READ, struct_ifreq_sz);
700   _(GREGADDRS, READWRITE, struct_ifreq_sz);
701   _(GREGADDRD, READWRITE, struct_ifreq_sz);
702   _(GRESPROTO, READ, struct_ifreq_sz);
703   _(GREGPROTO, READWRITE, struct_ifreq_sz);
704   _(GRESSOCK, READ, struct_ifreq_sz);
705   _(GREDSOCK, READ, struct_ifreq_sz);
706   /* Entries from file: net/if_ppp.h */
707   _(PPPIOCGRAWIN, WRITE, struct_ppp_rawin_sz);
708   _(PPPIOCGFLAGS, WRITE, sizeof(int));
709   _(PPPIOCSFLAGS, READ, sizeof(int));
710   _(PPPIOCGASYNCMAP, WRITE, sizeof(int));
711   _(PPPIOCSASYNCMAP, READ, sizeof(int));
712   _(PPPIOCGUNIT, WRITE, sizeof(int));
713   _(PPPIOCGRASYNCMAP, WRITE, sizeof(int));
714   _(PPPIOCSRASYNCMAP, READ, sizeof(int));
715   _(PPPIOCGMRU, WRITE, sizeof(int));
716   _(PPPIOCSMRU, READ, sizeof(int));
717   _(PPPIOCSMAXCID, READ, sizeof(int));
718   _(PPPIOCGXASYNCMAP, WRITE, (8 * sizeof(u32)));
719   _(PPPIOCSXASYNCMAP, READ, (8 * sizeof(u32)));
720   _(PPPIOCXFERUNIT, NONE, 0);
721   _(PPPIOCSCOMPRESS, READ, struct_ppp_option_data_sz);
722   _(PPPIOCGNPMODE, READWRITE, struct_npioctl_sz);
723   _(PPPIOCSNPMODE, READ, struct_npioctl_sz);
724   _(PPPIOCGIDLE, WRITE, struct_ppp_idle_sz);
725   _(PPPIOCGMTU, WRITE, sizeof(int));
726   _(PPPIOCSMTU, READ, sizeof(int));
727   _(SIOCGPPPSTATS, READWRITE, struct_ifpppstatsreq_sz);
728   _(SIOCGPPPCSTATS, READWRITE, struct_ifpppcstatsreq_sz);
729   /* Entries from file: net/npf.h */
730   _(IOC_NPF_VERSION, WRITE, sizeof(int));
731   _(IOC_NPF_SWITCH, READ, sizeof(int));
732   _(IOC_NPF_LOAD, READWRITE, struct_nvlist_ref_sz);
733   _(IOC_NPF_TABLE, READ, struct_npf_ioctl_table_sz);
734   _(IOC_NPF_STATS, READ, sizeof(uptr));
735   _(IOC_NPF_SAVE, WRITE, struct_nvlist_ref_sz);
736   _(IOC_NPF_RULE, READWRITE, struct_nvlist_ref_sz);
737   _(IOC_NPF_CONN_LOOKUP, READWRITE, struct_nvlist_ref_sz);
738   /* Entries from file: net/if_pppoe.h */
739   _(PPPOESETPARMS, READ, struct_pppoediscparms_sz);
740   _(PPPOEGETPARMS, READWRITE, struct_pppoediscparms_sz);
741   _(PPPOEGETSESSION, READWRITE, struct_pppoeconnectionstate_sz);
742   /* Entries from file: net/if_sppp.h */
743   _(SPPPGETAUTHCFG, READWRITE, struct_spppauthcfg_sz);
744   _(SPPPSETAUTHCFG, READ, struct_spppauthcfg_sz);
745   _(SPPPGETLCPCFG, READWRITE, struct_sppplcpcfg_sz);
746   _(SPPPSETLCPCFG, READ, struct_sppplcpcfg_sz);
747   _(SPPPGETSTATUS, READWRITE, struct_spppstatus_sz);
748   _(SPPPGETSTATUSNCP, READWRITE, struct_spppstatusncp_sz);
749   _(SPPPGETIDLETO, READWRITE, struct_spppidletimeout_sz);
750   _(SPPPSETIDLETO, READ, struct_spppidletimeout_sz);
751   _(SPPPGETAUTHFAILURES, READWRITE, struct_spppauthfailurestats_sz);
752   _(SPPPSETAUTHFAILURE, READ, struct_spppauthfailuresettings_sz);
753   _(SPPPSETDNSOPTS, READ, struct_spppdnssettings_sz);
754   _(SPPPGETDNSOPTS, READWRITE, struct_spppdnssettings_sz);
755   _(SPPPGETDNSADDRS, READWRITE, struct_spppdnsaddrs_sz);
756   _(SPPPSETKEEPALIVE, READ, struct_spppkeepalivesettings_sz);
757   _(SPPPGETKEEPALIVE, READWRITE, struct_spppkeepalivesettings_sz);
758   /* Entries from file: net/if_srt.h */
759   _(SRT_GETNRT, WRITE, sizeof(unsigned int));
760   _(SRT_GETRT, READWRITE, struct_srt_rt_sz);
761   _(SRT_SETRT, READ, struct_srt_rt_sz);
762   _(SRT_DELRT, READ, sizeof(unsigned int));
763   _(SRT_SFLAGS, READ, sizeof(unsigned int));
764   _(SRT_GFLAGS, WRITE, sizeof(unsigned int));
765   _(SRT_SGFLAGS, READWRITE, sizeof(unsigned int));
766   _(SRT_DEBUG, READ, sizeof(uptr));
767   /* Entries from file: net/if_tap.h */
768   _(TAPGIFNAME, WRITE, struct_ifreq_sz);
769   /* Entries from file: net/if_tun.h */
770   _(TUNSDEBUG, READ, sizeof(int));
771   _(TUNGDEBUG, WRITE, sizeof(int));
772   _(TUNSIFMODE, READ, sizeof(int));
773   _(TUNSIFHEAD, READ, sizeof(int));
774   _(TUNGIFHEAD, WRITE, sizeof(int));
775   /* Entries from file: net/pfvar.h */
776   _(DIOCSTART, NONE, 0);
777   _(DIOCSTOP, NONE, 0);
778   _(DIOCADDRULE, READWRITE, struct_pfioc_rule_sz);
779   _(DIOCGETRULES, READWRITE, struct_pfioc_rule_sz);
780   _(DIOCGETRULE, READWRITE, struct_pfioc_rule_sz);
781   _(DIOCSETLCK, READWRITE, sizeof(u32));
782   _(DIOCCLRSTATES, READWRITE, struct_pfioc_state_kill_sz);
783   _(DIOCGETSTATE, READWRITE, struct_pfioc_state_sz);
784   _(DIOCSETSTATUSIF, READWRITE, struct_pfioc_if_sz);
785   _(DIOCGETSTATUS, READWRITE, struct_pf_status_sz);
786   _(DIOCCLRSTATUS, NONE, 0);
787   _(DIOCNATLOOK, READWRITE, struct_pfioc_natlook_sz);
788   _(DIOCSETDEBUG, READWRITE, sizeof(u32));
789   _(DIOCGETSTATES, READWRITE, struct_pfioc_states_sz);
790   _(DIOCCHANGERULE, READWRITE, struct_pfioc_rule_sz);
791   _(DIOCSETTIMEOUT, READWRITE, struct_pfioc_tm_sz);
792   _(DIOCGETTIMEOUT, READWRITE, struct_pfioc_tm_sz);
793   _(DIOCADDSTATE, READWRITE, struct_pfioc_state_sz);
794   _(DIOCCLRRULECTRS, NONE, 0);
795   _(DIOCGETLIMIT, READWRITE, struct_pfioc_limit_sz);
796   _(DIOCSETLIMIT, READWRITE, struct_pfioc_limit_sz);
797   _(DIOCKILLSTATES, READWRITE, struct_pfioc_state_kill_sz);
798   _(DIOCSTARTALTQ, NONE, 0);
799   _(DIOCSTOPALTQ, NONE, 0);
800   _(DIOCADDALTQ, READWRITE, struct_pfioc_altq_sz);
801   _(DIOCGETALTQS, READWRITE, struct_pfioc_altq_sz);
802   _(DIOCGETALTQ, READWRITE, struct_pfioc_altq_sz);
803   _(DIOCCHANGEALTQ, READWRITE, struct_pfioc_altq_sz);
804   _(DIOCGETQSTATS, READWRITE, struct_pfioc_qstats_sz);
805   _(DIOCBEGINADDRS, READWRITE, struct_pfioc_pooladdr_sz);
806   _(DIOCADDADDR, READWRITE, struct_pfioc_pooladdr_sz);
807   _(DIOCGETADDRS, READWRITE, struct_pfioc_pooladdr_sz);
808   _(DIOCGETADDR, READWRITE, struct_pfioc_pooladdr_sz);
809   _(DIOCCHANGEADDR, READWRITE, struct_pfioc_pooladdr_sz);
810   _(DIOCADDSTATES, READWRITE, struct_pfioc_states_sz);
811   _(DIOCGETRULESETS, READWRITE, struct_pfioc_ruleset_sz);
812   _(DIOCGETRULESET, READWRITE, struct_pfioc_ruleset_sz);
813   _(DIOCRCLRTABLES, READWRITE, struct_pfioc_table_sz);
814   _(DIOCRADDTABLES, READWRITE, struct_pfioc_table_sz);
815   _(DIOCRDELTABLES, READWRITE, struct_pfioc_table_sz);
816   _(DIOCRGETTABLES, READWRITE, struct_pfioc_table_sz);
817   _(DIOCRGETTSTATS, READWRITE, struct_pfioc_table_sz);
818   _(DIOCRCLRTSTATS, READWRITE, struct_pfioc_table_sz);
819   _(DIOCRCLRADDRS, READWRITE, struct_pfioc_table_sz);
820   _(DIOCRADDADDRS, READWRITE, struct_pfioc_table_sz);
821   _(DIOCRDELADDRS, READWRITE, struct_pfioc_table_sz);
822   _(DIOCRSETADDRS, READWRITE, struct_pfioc_table_sz);
823   _(DIOCRGETADDRS, READWRITE, struct_pfioc_table_sz);
824   _(DIOCRGETASTATS, READWRITE, struct_pfioc_table_sz);
825   _(DIOCRCLRASTATS, READWRITE, struct_pfioc_table_sz);
826   _(DIOCRTSTADDRS, READWRITE, struct_pfioc_table_sz);
827   _(DIOCRSETTFLAGS, READWRITE, struct_pfioc_table_sz);
828   _(DIOCRINADEFINE, READWRITE, struct_pfioc_table_sz);
829   _(DIOCOSFPFLUSH, NONE, 0);
830   _(DIOCOSFPADD, READWRITE, struct_pf_osfp_ioctl_sz);
831   _(DIOCOSFPGET, READWRITE, struct_pf_osfp_ioctl_sz);
832   _(DIOCXBEGIN, READWRITE, struct_pfioc_trans_sz);
833   _(DIOCXCOMMIT, READWRITE, struct_pfioc_trans_sz);
834   _(DIOCXROLLBACK, READWRITE, struct_pfioc_trans_sz);
835   _(DIOCGETSRCNODES, READWRITE, struct_pfioc_src_nodes_sz);
836   _(DIOCCLRSRCNODES, NONE, 0);
837   _(DIOCSETHOSTID, READWRITE, sizeof(u32));
838   _(DIOCIGETIFACES, READWRITE, struct_pfioc_iface_sz);
839   _(DIOCSETIFFLAG, READWRITE, struct_pfioc_iface_sz);
840   _(DIOCCLRIFFLAG, READWRITE, struct_pfioc_iface_sz);
841   _(DIOCKILLSRCNODES, READWRITE, struct_pfioc_src_node_kill_sz);
842   /* Entries from file: netbt/hci.h */
843   _(SIOCGBTINFO, READWRITE, struct_btreq_sz);
844   _(SIOCGBTINFOA, READWRITE, struct_btreq_sz);
845   _(SIOCNBTINFO, READWRITE, struct_btreq_sz);
846   _(SIOCSBTFLAGS, READWRITE, struct_btreq_sz);
847   _(SIOCSBTPOLICY, READWRITE, struct_btreq_sz);
848   _(SIOCSBTPTYPE, READWRITE, struct_btreq_sz);
849   _(SIOCGBTSTATS, READWRITE, struct_btreq_sz);
850   _(SIOCZBTSTATS, READWRITE, struct_btreq_sz);
851   _(SIOCBTDUMP, READ, struct_btreq_sz);
852   _(SIOCSBTSCOMTU, READWRITE, struct_btreq_sz);
853   _(SIOCGBTFEAT, READWRITE, struct_btreq_sz);
854   /* Entries from file: netinet/ip_nat.h */
855   _(SIOCADNAT, READ, struct_ipfobj_sz);
856   _(SIOCRMNAT, READ, struct_ipfobj_sz);
857   _(SIOCGNATS, READWRITE, struct_ipfobj_sz);
858   _(SIOCGNATL, READWRITE, struct_ipfobj_sz);
859   _(SIOCPURGENAT, READWRITE, struct_ipfobj_sz);
860   /* Entries from file: netinet/sctp_uio.h */
861   _(SIOCCONNECTX, READWRITE, struct_sctp_connectx_addrs_sz);
862   _(SIOCCONNECTXDEL, READWRITE, struct_sctp_connectx_addrs_sz);
863   /* Entries from file: netinet6/in6_var.h */
864   _(SIOCSIFINFO_FLAGS, READWRITE, struct_in6_ndireq_sz);
865   _(SIOCAADDRCTL_POLICY, READ, struct_in6_addrpolicy_sz);
866   _(SIOCDADDRCTL_POLICY, READ, struct_in6_addrpolicy_sz);
867   /* Entries from file: netsmb/smb_dev.h */
868   _(SMBIOC_OPENSESSION, READ, struct_smbioc_ossn_sz);
869   _(SMBIOC_OPENSHARE, READ, struct_smbioc_oshare_sz);
870   _(SMBIOC_REQUEST, READWRITE, struct_smbioc_rq_sz);
871   _(SMBIOC_SETFLAGS, READ, struct_smbioc_flags_sz);
872   _(SMBIOC_LOOKUP, READ, struct_smbioc_lookup_sz);
873   _(SMBIOC_READ, READWRITE, struct_smbioc_rw_sz);
874   _(SMBIOC_WRITE, READWRITE, struct_smbioc_rw_sz);
875   /* Entries from file: sys/agpio.h */
876   _(AGPIOC_INFO, WRITE, struct__agp_info_sz);
877   _(AGPIOC_ACQUIRE, NONE, 0);
878   _(AGPIOC_RELEASE, NONE, 0);
879   _(AGPIOC_SETUP, READ, struct__agp_setup_sz);
880   _(AGPIOC_ALLOCATE, READWRITE, struct__agp_allocate_sz);
881   _(AGPIOC_DEALLOCATE, READ, sizeof(int));
882   _(AGPIOC_BIND, READ, struct__agp_bind_sz);
883   _(AGPIOC_UNBIND, READ, struct__agp_unbind_sz);
884   /* Entries from file: sys/audioio.h */
885   _(AUDIO_GETINFO, WRITE, struct_audio_info_sz);
886   _(AUDIO_SETINFO, READWRITE, struct_audio_info_sz);
887   _(AUDIO_DRAIN, NONE, 0);
888   _(AUDIO_FLUSH, NONE, 0);
889   _(AUDIO_WSEEK, WRITE, sizeof(unsigned long));
890   _(AUDIO_RERROR, WRITE, sizeof(int));
891   _(AUDIO_GETDEV, WRITE, struct_audio_device_sz);
892   _(AUDIO_GETENC, READWRITE, struct_audio_encoding_sz);
893   _(AUDIO_GETFD, WRITE, sizeof(int));
894   _(AUDIO_SETFD, READWRITE, sizeof(int));
895   _(AUDIO_PERROR, WRITE, sizeof(int));
896   _(AUDIO_GETIOFFS, WRITE, struct_audio_offset_sz);
897   _(AUDIO_GETOOFFS, WRITE, struct_audio_offset_sz);
898   _(AUDIO_GETPROPS, WRITE, sizeof(int));
899   _(AUDIO_GETBUFINFO, WRITE, struct_audio_info_sz);
900   _(AUDIO_SETCHAN, READ, sizeof(int));
901   _(AUDIO_GETCHAN, WRITE, sizeof(int));
902   _(AUDIO_QUERYFORMAT, READWRITE, struct_audio_format_query_sz);
903   _(AUDIO_GETFORMAT, WRITE, struct_audio_info_sz);
904   _(AUDIO_SETFORMAT, READ, struct_audio_info_sz);
905   _(AUDIO_MIXER_READ, READWRITE, struct_mixer_ctrl_sz);
906   _(AUDIO_MIXER_WRITE, READWRITE, struct_mixer_ctrl_sz);
907   _(AUDIO_MIXER_DEVINFO, READWRITE, struct_mixer_devinfo_sz);
908   /* Entries from file: sys/ataio.h */
909   _(ATAIOCCOMMAND, READWRITE, struct_atareq_sz);
910   _(ATABUSIOSCAN, READ, struct_atabusioscan_args_sz);
911   _(ATABUSIORESET, NONE, 0);
912   _(ATABUSIODETACH, READ, struct_atabusiodetach_args_sz);
913   /* Entries from file: sys/cdio.h */
914   _(CDIOCPLAYTRACKS, READ, struct_ioc_play_track_sz);
915   _(CDIOCPLAYBLOCKS, READ, struct_ioc_play_blocks_sz);
916   _(CDIOCREADSUBCHANNEL, READWRITE, struct_ioc_read_subchannel_sz);
917   _(CDIOREADTOCHEADER, WRITE, struct_ioc_toc_header_sz);
918   _(CDIOREADTOCENTRIES, READWRITE, struct_ioc_read_toc_entry_sz);
919   _(CDIOREADMSADDR, READWRITE, sizeof(int));
920   _(CDIOCSETPATCH, READ, struct_ioc_patch_sz);
921   _(CDIOCGETVOL, WRITE, struct_ioc_vol_sz);
922   _(CDIOCSETVOL, READ, struct_ioc_vol_sz);
923   _(CDIOCSETMONO, NONE, 0);
924   _(CDIOCSETSTEREO, NONE, 0);
925   _(CDIOCSETMUTE, NONE, 0);
926   _(CDIOCSETLEFT, NONE, 0);
927   _(CDIOCSETRIGHT, NONE, 0);
928   _(CDIOCSETDEBUG, NONE, 0);
929   _(CDIOCCLRDEBUG, NONE, 0);
930   _(CDIOCPAUSE, NONE, 0);
931   _(CDIOCRESUME, NONE, 0);
932   _(CDIOCRESET, NONE, 0);
933   _(CDIOCSTART, NONE, 0);
934   _(CDIOCSTOP, NONE, 0);
935   _(CDIOCEJECT, NONE, 0);
936   _(CDIOCALLOW, NONE, 0);
937   _(CDIOCPREVENT, NONE, 0);
938   _(CDIOCCLOSE, NONE, 0);
939   _(CDIOCPLAYMSF, READ, struct_ioc_play_msf_sz);
940   _(CDIOCLOADUNLOAD, READ, struct_ioc_load_unload_sz);
941   /* Entries from file: sys/chio.h */
942   _(CHIOMOVE, READ, struct_changer_move_request_sz);
943   _(CHIOEXCHANGE, READ, struct_changer_exchange_request_sz);
944   _(CHIOPOSITION, READ, struct_changer_position_request_sz);
945   _(CHIOSPICKER, READ, sizeof(int));
946   _(CHIOGPARAMS, WRITE, struct_changer_params_sz);
947   _(CHIOIELEM, NONE, 0);
948   _(OCHIOGSTATUS, READ, struct_ochanger_element_status_request_sz);
949   _(CHIOGSTATUS, READ, struct_changer_element_status_request_sz);
950   _(CHIOSVOLTAG, READ, struct_changer_set_voltag_request_sz);
951   /* Entries from file: sys/clockctl.h */
952   _(CLOCKCTL_SETTIMEOFDAY, READ, struct_clockctl_settimeofday_sz);
953   _(CLOCKCTL_ADJTIME, READWRITE, struct_clockctl_adjtime_sz);
954   _(CLOCKCTL_CLOCK_SETTIME, READ, struct_clockctl_clock_settime_sz);
955   _(CLOCKCTL_NTP_ADJTIME, READWRITE, struct_clockctl_ntp_adjtime_sz);
956   /* Entries from file: sys/cpuio.h */
957   _(IOC_CPU_SETSTATE, READ, struct_cpustate_sz);
958   _(IOC_CPU_GETSTATE, READWRITE, struct_cpustate_sz);
959   _(IOC_CPU_GETCOUNT, WRITE, sizeof(int));
960   _(IOC_CPU_MAPID, READWRITE, sizeof(int));
961   _(IOC_CPU_UCODE_GET_VERSION, READWRITE, struct_cpu_ucode_version_sz);
962   _(IOC_CPU_UCODE_APPLY, READ, struct_cpu_ucode_sz);
963   /* Entries from file: sys/dkio.h */
964   _(DIOCGDINFO, WRITE, struct_disklabel_sz);
965   _(DIOCSDINFO, READ, struct_disklabel_sz);
966   _(DIOCWDINFO, READ, 0);
967   _(DIOCRFORMAT, READWRITE, struct_format_op_sz);
968   _(DIOCWFORMAT, READWRITE, struct_format_op_sz);
969   _(DIOCSSTEP, READ, sizeof(int));
970   _(DIOCSRETRIES, READ, sizeof(int));
971   _(DIOCKLABEL, READ, sizeof(int));
972   _(DIOCWLABEL, READ, sizeof(int));
973   _(DIOCSBAD, READ, struct_dkbad_sz);
974   _(DIOCEJECT, READ, sizeof(int));
975   _(ODIOCEJECT, NONE, 0);
976   _(DIOCLOCK, READ, sizeof(int));
977   _(DIOCGDEFLABEL, WRITE, struct_disklabel_sz);
978   _(DIOCCLRLABEL, NONE, 0);
979   _(DIOCGCACHE, WRITE, sizeof(int));
980   _(DIOCSCACHE, READ, sizeof(int));
981   _(DIOCCACHESYNC, READ, sizeof(int));
982   _(DIOCBSLIST, READWRITE, struct_disk_badsecinfo_sz);
983   _(DIOCBSFLUSH, NONE, 0);
984   _(DIOCAWEDGE, READWRITE, struct_dkwedge_info_sz);
985   _(DIOCGWEDGEINFO, WRITE, struct_dkwedge_info_sz);
986   _(DIOCDWEDGE, READ, struct_dkwedge_info_sz);
987   _(DIOCLWEDGES, READWRITE, struct_dkwedge_list_sz);
988   _(DIOCGSTRATEGY, WRITE, struct_disk_strategy_sz);
989   _(DIOCSSTRATEGY, READ, struct_disk_strategy_sz);
990   _(DIOCGDISKINFO, WRITE, struct_plistref_sz);
991   _(DIOCTUR, WRITE, sizeof(int));
992   _(DIOCMWEDGES, WRITE, sizeof(int));
993   _(DIOCGSECTORSIZE, WRITE, sizeof(unsigned int));
994   _(DIOCGMEDIASIZE, WRITE, sizeof(uptr));
995   _(DIOCRMWEDGES, WRITE, sizeof(int));
996   /* Entries from file: sys/drvctlio.h */
997   _(DRVDETACHDEV, READ, struct_devdetachargs_sz);
998   _(DRVRESCANBUS, READ, struct_devrescanargs_sz);
999   _(DRVCTLCOMMAND, READWRITE, struct_plistref_sz);
1000   _(DRVRESUMEDEV, READ, struct_devpmargs_sz);
1001   _(DRVLISTDEV, READWRITE, struct_devlistargs_sz);
1002   _(DRVGETEVENT, WRITE, struct_plistref_sz);
1003   _(DRVSUSPENDDEV, READ, struct_devpmargs_sz);
1004   /* Entries from file: sys/dvdio.h */
1005   _(DVD_READ_STRUCT, READWRITE, union_dvd_struct_sz);
1006   _(DVD_WRITE_STRUCT, READWRITE, union_dvd_struct_sz);
1007   _(DVD_AUTH, READWRITE, union_dvd_authinfo_sz);
1008   /* Entries from file: sys/envsys.h */
1009   _(ENVSYS_GETDICTIONARY, READWRITE, struct_plistref_sz);
1010   _(ENVSYS_SETDICTIONARY, READWRITE, struct_plistref_sz);
1011   _(ENVSYS_REMOVEPROPS, READWRITE, struct_plistref_sz);
1012   _(ENVSYS_GTREDATA, READWRITE, struct_envsys_tre_data_sz);
1013   _(ENVSYS_GTREINFO, READWRITE, struct_envsys_basic_info_sz);
1014   /* Entries from file: sys/event.h */
1015   _(KFILTER_BYFILTER, READWRITE, struct_kfilter_mapping_sz);
1016   _(KFILTER_BYNAME, READWRITE, struct_kfilter_mapping_sz);
1017   /* Entries from file: sys/fdio.h */
1018   _(FDIOCGETOPTS, WRITE, 0);
1019   _(FDIOCSETOPTS, READ, sizeof(int));
1020   _(FDIOCSETFORMAT, READ, struct_fdformat_parms_sz);
1021   _(FDIOCGETFORMAT, WRITE, struct_fdformat_parms_sz);
1022   _(FDIOCFORMAT_TRACK, READ, struct_fdformat_cmd_sz);
1023   /* Entries from file: sys/filio.h */
1024   _(FIOCLEX, NONE, 0);
1025   _(FIONCLEX, NONE, 0);
1026   _(FIOSEEKDATA, READWRITE, sizeof(uptr));
1027   _(FIOSEEKHOLE, READWRITE, sizeof(uptr));
1028   _(FIONREAD, WRITE, sizeof(int));
1029   _(FIONBIO, READ, sizeof(int));
1030   _(FIOASYNC, READ, sizeof(int));
1031   _(FIOSETOWN, READ, sizeof(int));
1032   _(FIOGETOWN, WRITE, sizeof(int));
1033   _(OFIOGETBMAP, READWRITE, sizeof(u32));
1034   _(FIOGETBMAP, READWRITE, sizeof(u64));
1035   _(FIONWRITE, WRITE, sizeof(int));
1036   _(FIONSPACE, WRITE, sizeof(int));
1037   /* Entries from file: sys/gpio.h */
1038   _(GPIOINFO, WRITE, struct_gpio_info_sz);
1039   _(GPIOSET, READWRITE, struct_gpio_set_sz);
1040   _(GPIOUNSET, READWRITE, struct_gpio_set_sz);
1041   _(GPIOREAD, READWRITE, struct_gpio_req_sz);
1042   _(GPIOWRITE, READWRITE, struct_gpio_req_sz);
1043   _(GPIOTOGGLE, READWRITE, struct_gpio_req_sz);
1044   _(GPIOATTACH, READWRITE, struct_gpio_attach_sz);
1045   /* Entries from file: sys/ioctl.h */
1046   _(PTIOCNETBSD, READ, struct_ioctl_pt_sz);
1047   _(PTIOCSUNOS, READ, struct_ioctl_pt_sz);
1048   _(PTIOCLINUX, READ, struct_ioctl_pt_sz);
1049   _(PTIOCFREEBSD, READ, struct_ioctl_pt_sz);
1050   _(PTIOCULTRIX, READ, struct_ioctl_pt_sz);
1051   /* Entries from file: sys/ioctl_compat.h */
1052   _(TIOCHPCL, NONE, 0);
1053   _(TIOCGETP, WRITE, struct_sgttyb_sz);
1054   _(TIOCSETP, READ, struct_sgttyb_sz);
1055   _(TIOCSETN, READ, 0);
1056   _(TIOCSETC, READ, struct_tchars_sz);
1057   _(TIOCGETC, WRITE, struct_tchars_sz);
1058   _(TIOCLBIS, READ, sizeof(int));
1059   _(TIOCLBIC, READ, sizeof(int));
1060   _(TIOCLSET, READ, sizeof(int));
1061   _(TIOCLGET, WRITE, sizeof(int));
1062   _(TIOCSLTC, READ, struct_ltchars_sz);
1063   _(TIOCGLTC, WRITE, struct_ltchars_sz);
1064   _(OTIOCCONS, NONE, 0);
1065   /* Entries from file: sys/joystick.h */
1066   _(JOY_SETTIMEOUT, READ, sizeof(int));
1067   _(JOY_GETTIMEOUT, WRITE, sizeof(int));
1068   _(JOY_SET_X_OFFSET, READ, sizeof(int));
1069   _(JOY_SET_Y_OFFSET, READ, sizeof(int));
1070   _(JOY_GET_Y_OFFSET, WRITE, sizeof(int));
1071   /* Entries from file: sys/ksyms.h */
1072   _(OKIOCGSYMBOL, READ, struct_ksyms_ogsymbol_sz);
1073   _(OKIOCGVALUE, READ, struct_ksyms_ogsymbol_sz);
1074   _(KIOCGSIZE, WRITE, sizeof(int));
1075   _(KIOCGVALUE, READWRITE, struct_ksyms_gvalue_sz);
1076   _(KIOCGSYMBOL, READWRITE, struct_ksyms_gsymbol_sz);
1077   /* Entries from file: sys/lua.h */
1078   _(LUAINFO, READWRITE, struct_lua_info_sz);
1079   _(LUACREATE, READWRITE, struct_lua_create_sz);
1080   _(LUADESTROY, READWRITE, struct_lua_create_sz);
1081   _(LUAREQUIRE, READWRITE, struct_lua_require_sz);
1082   _(LUALOAD, READWRITE, struct_lua_load_sz);
1083   /* Entries from file: sys/midiio.h */
1084   _(MIDI_PRETIME, READWRITE, sizeof(int));
1085   _(MIDI_MPUMODE, READWRITE, sizeof(int));
1086   _(MIDI_MPUCMD, READWRITE, struct_mpu_command_rec_sz);
1087   _(SEQUENCER_RESET, NONE, 0);
1088   _(SEQUENCER_SYNC, NONE, 0);
1089   _(SEQUENCER_INFO, READWRITE, struct_synth_info_sz);
1090   _(SEQUENCER_CTRLRATE, READWRITE, sizeof(int));
1091   _(SEQUENCER_GETOUTCOUNT, WRITE, sizeof(int));
1092   _(SEQUENCER_GETINCOUNT, WRITE, sizeof(int));
1093   _(SEQUENCER_RESETSAMPLES, READ, sizeof(int));
1094   _(SEQUENCER_NRSYNTHS, WRITE, sizeof(int));
1095   _(SEQUENCER_NRMIDIS, WRITE, sizeof(int));
1096   _(SEQUENCER_THRESHOLD, READ, sizeof(int));
1097   _(SEQUENCER_MEMAVL, READWRITE, sizeof(int));
1098   _(SEQUENCER_PANIC, NONE, 0);
1099   _(SEQUENCER_OUTOFBAND, READ, struct_seq_event_rec_sz);
1100   _(SEQUENCER_GETTIME, WRITE, sizeof(int));
1101   _(SEQUENCER_TMR_TIMEBASE, READWRITE, sizeof(int));
1102   _(SEQUENCER_TMR_START, NONE, 0);
1103   _(SEQUENCER_TMR_STOP, NONE, 0);
1104   _(SEQUENCER_TMR_CONTINUE, NONE, 0);
1105   _(SEQUENCER_TMR_TEMPO, READWRITE, sizeof(int));
1106   _(SEQUENCER_TMR_SOURCE, READWRITE, sizeof(int));
1107   _(SEQUENCER_TMR_METRONOME, READ, sizeof(int));
1108   _(SEQUENCER_TMR_SELECT, READ, sizeof(int));
1109   /* Entries from file: sys/mtio.h */
1110   _(MTIOCTOP, READ, struct_mtop_sz);
1111   _(MTIOCGET, WRITE, struct_mtget_sz);
1112   _(MTIOCIEOT, NONE, 0);
1113   _(MTIOCEEOT, NONE, 0);
1114   _(MTIOCRDSPOS, WRITE, sizeof(u32));
1115   _(MTIOCRDHPOS, WRITE, sizeof(u32));
1116   _(MTIOCSLOCATE, READ, sizeof(u32));
1117   _(MTIOCHLOCATE, READ, sizeof(u32));
1118   /* Entries from file: sys/power.h */
1119   _(POWER_EVENT_RECVDICT, READWRITE, struct_plistref_sz);
1120   _(POWER_IOC_GET_TYPE, WRITE, struct_power_type_sz);
1121   /* Entries from file: sys/radioio.h */
1122   _(RIOCGINFO, WRITE, struct_radio_info_sz);
1123   _(RIOCSINFO, READWRITE, struct_radio_info_sz);
1124   _(RIOCSSRCH, READ, sizeof(int));
1125   /* Entries from file: sys/rndio.h */
1126   _(RNDGETENTCNT, WRITE, sizeof(u32));
1127   _(RNDGETSRCNUM, READWRITE, struct_rndstat_sz);
1128   _(RNDGETSRCNAME, READWRITE, struct_rndstat_name_sz);
1129   _(RNDCTL, READ, struct_rndctl_sz);
1130   _(RNDADDDATA, READ, struct_rnddata_sz);
1131   _(RNDGETPOOLSTAT, WRITE, struct_rndpoolstat_sz);
1132   _(RNDGETESTNUM, READWRITE, struct_rndstat_est_sz);
1133   _(RNDGETESTNAME, READWRITE, struct_rndstat_est_name_sz);
1134   /* Entries from file: sys/scanio.h */
1135   _(SCIOCGET, WRITE, struct_scan_io_sz);
1136   _(SCIOCSET, READ, struct_scan_io_sz);
1137   _(SCIOCRESTART, NONE, 0);
1138   /* Entries from file: sys/scsiio.h */
1139   _(SCIOCCOMMAND, READWRITE, struct_scsireq_sz);
1140   _(SCIOCDEBUG, READ, sizeof(int));
1141   _(SCIOCIDENTIFY, WRITE, struct_scsi_addr_sz);
1142   _(OSCIOCIDENTIFY, WRITE, struct_oscsi_addr_sz);
1143   _(SCIOCDECONFIG, NONE, 0);
1144   _(SCIOCRECONFIG, NONE, 0);
1145   _(SCIOCRESET, NONE, 0);
1146   _(SCBUSIOSCAN, READ, struct_scbusioscan_args_sz);
1147   _(SCBUSIORESET, NONE, 0);
1148   _(SCBUSIODETACH, READ, struct_scbusiodetach_args_sz);
1149   _(SCBUSACCEL, READ, struct_scbusaccel_args_sz);
1150   /* Entries from file: sys/sockio.h */
1151   _(SIOCSHIWAT, READ, sizeof(int));
1152   _(SIOCGHIWAT, WRITE, sizeof(int));
1153   _(SIOCSLOWAT, READ, sizeof(int));
1154   _(SIOCGLOWAT, WRITE, sizeof(int));
1155   _(SIOCATMARK, WRITE, sizeof(int));
1156   _(SIOCSPGRP, READ, sizeof(int));
1157   _(SIOCGPGRP, WRITE, sizeof(int));
1158   _(SIOCPEELOFF, READWRITE, sizeof(int));
1159   _(SIOCADDRT, READ, struct_ortentry_sz);
1160   _(SIOCDELRT, READ, struct_ortentry_sz);
1161   _(SIOCSIFADDR, READ, struct_ifreq_sz);
1162   _(SIOCGIFADDR, READWRITE, struct_ifreq_sz);
1163   _(SIOCSIFDSTADDR, READ, struct_ifreq_sz);
1164   _(SIOCGIFDSTADDR, READWRITE, struct_ifreq_sz);
1165   _(SIOCSIFFLAGS, READ, struct_ifreq_sz);
1166   _(SIOCGIFFLAGS, READWRITE, struct_ifreq_sz);
1167   _(SIOCGIFBRDADDR, READWRITE, struct_ifreq_sz);
1168   _(SIOCSIFBRDADDR, READ, struct_ifreq_sz);
1169   _(SIOCGIFCONF, READWRITE, struct_ifconf_sz);
1170   _(SIOCGIFNETMASK, READWRITE, struct_ifreq_sz);
1171   _(SIOCSIFNETMASK, READ, struct_ifreq_sz);
1172   _(SIOCGIFMETRIC, READWRITE, struct_ifreq_sz);
1173   _(SIOCSIFMETRIC, READ, struct_ifreq_sz);
1174   _(SIOCDIFADDR, READ, struct_ifreq_sz);
1175   _(SIOCAIFADDR, READ, struct_ifaliasreq_sz);
1176   _(SIOCGIFALIAS, READWRITE, struct_ifaliasreq_sz);
1177   _(SIOCGIFAFLAG_IN, READWRITE, struct_ifreq_sz);
1178   _(SIOCALIFADDR, READ, struct_if_laddrreq_sz);
1179   _(SIOCGLIFADDR, READWRITE, struct_if_laddrreq_sz);
1180   _(SIOCDLIFADDR, READ, struct_if_laddrreq_sz);
1181   _(SIOCSIFADDRPREF, READ, struct_if_addrprefreq_sz);
1182   _(SIOCGIFADDRPREF, READWRITE, struct_if_addrprefreq_sz);
1183   _(SIOCADDMULTI, READ, struct_ifreq_sz);
1184   _(SIOCDELMULTI, READ, struct_ifreq_sz);
1185   _(SIOCGETVIFCNT, READWRITE, struct_sioc_vif_req_sz);
1186   _(SIOCGETSGCNT, READWRITE, struct_sioc_sg_req_sz);
1187   _(SIOCSIFMEDIA, READWRITE, struct_ifreq_sz);
1188   _(SIOCGIFMEDIA, READWRITE, struct_ifmediareq_sz);
1189   _(SIOCSIFGENERIC, READ, struct_ifreq_sz);
1190   _(SIOCGIFGENERIC, READWRITE, struct_ifreq_sz);
1191   _(SIOCSIFPHYADDR, READ, struct_ifaliasreq_sz);
1192   _(SIOCGIFPSRCADDR, READWRITE, struct_ifreq_sz);
1193   _(SIOCGIFPDSTADDR, READWRITE, struct_ifreq_sz);
1194   _(SIOCDIFPHYADDR, READ, struct_ifreq_sz);
1195   _(SIOCSLIFPHYADDR, READ, struct_if_laddrreq_sz);
1196   _(SIOCGLIFPHYADDR, READWRITE, struct_if_laddrreq_sz);
1197   _(SIOCSIFMTU, READ, struct_ifreq_sz);
1198   _(SIOCGIFMTU, READWRITE, struct_ifreq_sz);
1199   _(SIOCSDRVSPEC, READ, struct_ifdrv_sz);
1200   _(SIOCGDRVSPEC, READWRITE, struct_ifdrv_sz);
1201   _(SIOCIFCREATE, READ, struct_ifreq_sz);
1202   _(SIOCIFDESTROY, READ, struct_ifreq_sz);
1203   _(SIOCIFGCLONERS, READWRITE, struct_if_clonereq_sz);
1204   _(SIOCGIFDLT, READWRITE, struct_ifreq_sz);
1205   _(SIOCGIFCAP, READWRITE, struct_ifcapreq_sz);
1206   _(SIOCSIFCAP, READ, struct_ifcapreq_sz);
1207   _(SIOCSVH, READWRITE, struct_ifreq_sz);
1208   _(SIOCGVH, READWRITE, struct_ifreq_sz);
1209   _(SIOCINITIFADDR, READWRITE, struct_ifaddr_sz);
1210   _(SIOCGIFDATA, READWRITE, struct_ifdatareq_sz);
1211   _(SIOCZIFDATA, READWRITE, struct_ifdatareq_sz);
1212   _(SIOCGLINKSTR, READWRITE, struct_ifdrv_sz);
1213   _(SIOCSLINKSTR, READ, struct_ifdrv_sz);
1214   _(SIOCGETHERCAP, READWRITE, struct_eccapreq_sz);
1215   _(SIOCGIFINDEX, READWRITE, struct_ifreq_sz);
1216   _(SIOCSETHERCAP, READ, struct_eccapreq_sz);
1217   _(SIOCSIFDESCR, READ, struct_ifreq_sz);
1218   _(SIOCGIFDESCR, READWRITE, struct_ifreq_sz);
1219   _(SIOCGUMBINFO, READWRITE, struct_ifreq_sz);
1220   _(SIOCSUMBPARAM, READ, struct_ifreq_sz);
1221   _(SIOCGUMBPARAM, READWRITE, struct_ifreq_sz);
1222   _(SIOCSETPFSYNC, READ, struct_ifreq_sz);
1223   _(SIOCGETPFSYNC, READWRITE, struct_ifreq_sz);
1224   /* Entries from file: sys/timepps.h */
1225   _(PPS_IOC_CREATE, NONE, 0);
1226   _(PPS_IOC_DESTROY, NONE, 0);
1227   _(PPS_IOC_SETPARAMS, READ, struct_pps_params_sz);
1228   _(PPS_IOC_GETPARAMS, WRITE, struct_pps_params_sz);
1229   _(PPS_IOC_GETCAP, WRITE, sizeof(int));
1230   _(PPS_IOC_FETCH, READWRITE, struct_pps_info_sz);
1231   _(PPS_IOC_KCBIND, READ, sizeof(int));
1232   /* Entries from file: sys/ttycom.h */
1233   _(TIOCEXCL, NONE, 0);
1234   _(TIOCNXCL, NONE, 0);
1235   _(TIOCFLUSH, READ, sizeof(int));
1236   _(TIOCGETA, WRITE, struct_termios_sz);
1237   _(TIOCSETA, READ, struct_termios_sz);
1238   _(TIOCSETAW, READ, 0);
1239   _(TIOCSETAF, READ, 0);
1240   _(TIOCGETD, WRITE, sizeof(int));
1241   _(TIOCSETD, READ, sizeof(int));
1242   _(TIOCGLINED, WRITE, (32 * sizeof(char)));
1243   _(TIOCSLINED, READ, (32 * sizeof(char)));
1244   _(TIOCSBRK, NONE, 0);
1245   _(TIOCCBRK, NONE, 0);
1246   _(TIOCSDTR, NONE, 0);
1247   _(TIOCCDTR, NONE, 0);
1248   _(TIOCGPGRP, WRITE, sizeof(int));
1249   _(TIOCSPGRP, READ, sizeof(int));
1250   _(TIOCOUTQ, WRITE, sizeof(int));
1251   _(TIOCSTI, READ, sizeof(char));
1252   _(TIOCNOTTY, NONE, 0);
1253   _(TIOCPKT, READ, sizeof(int));
1254   _(TIOCSTOP, NONE, 0);
1255   _(TIOCSTART, NONE, 0);
1256   _(TIOCMSET, READ, sizeof(int));
1257   _(TIOCMBIS, READ, sizeof(int));
1258   _(TIOCMBIC, READ, sizeof(int));
1259   _(TIOCMGET, WRITE, sizeof(int));
1260   _(TIOCREMOTE, READ, sizeof(int));
1261   _(TIOCGWINSZ, WRITE, struct_winsize_sz);
1262   _(TIOCSWINSZ, READ, struct_winsize_sz);
1263   _(TIOCUCNTL, READ, sizeof(int));
1264   _(TIOCSTAT, READ, sizeof(int));
1265   _(TIOCGSID, WRITE, sizeof(int));
1266   _(TIOCCONS, READ, sizeof(int));
1267   _(TIOCSCTTY, NONE, 0);
1268   _(TIOCEXT, READ, sizeof(int));
1269   _(TIOCSIG, NONE, 0);
1270   _(TIOCDRAIN, NONE, 0);
1271   _(TIOCGFLAGS, WRITE, sizeof(int));
1272   _(TIOCSFLAGS, READ, sizeof(int));
1273   _(TIOCDCDTIMESTAMP, WRITE, struct_timeval_sz);
1274   _(TIOCRCVFRAME, READ, sizeof(uptr));
1275   _(TIOCXMTFRAME, READ, sizeof(uptr));
1276   _(TIOCPTMGET, WRITE, struct_ptmget_sz);
1277   _(TIOCGRANTPT, NONE, 0);
1278   _(TIOCPTSNAME, WRITE, struct_ptmget_sz);
1279   _(TIOCSQSIZE, READ, sizeof(int));
1280   _(TIOCGQSIZE, WRITE, sizeof(int));
1281   /* Entries from file: sys/verified_exec.h */
1282   _(VERIEXEC_LOAD, READ, struct_plistref_sz);
1283   _(VERIEXEC_TABLESIZE, READ, struct_plistref_sz);
1284   _(VERIEXEC_DELETE, READ, struct_plistref_sz);
1285   _(VERIEXEC_QUERY, READWRITE, struct_plistref_sz);
1286   _(VERIEXEC_DUMP, WRITE, struct_plistref_sz);
1287   _(VERIEXEC_FLUSH, NONE, 0);
1288   /* Entries from file: sys/videoio.h */
1289   _(VIDIOC_QUERYCAP, WRITE, struct_v4l2_capability_sz);
1290   _(VIDIOC_RESERVED, NONE, 0);
1291   _(VIDIOC_ENUM_FMT, READWRITE, struct_v4l2_fmtdesc_sz);
1292   _(VIDIOC_G_FMT, READWRITE, struct_v4l2_format_sz);
1293   _(VIDIOC_S_FMT, READWRITE, struct_v4l2_format_sz);
1294   _(VIDIOC_REQBUFS, READWRITE, struct_v4l2_requestbuffers_sz);
1295   _(VIDIOC_QUERYBUF, READWRITE, struct_v4l2_buffer_sz);
1296   _(VIDIOC_G_FBUF, WRITE, struct_v4l2_framebuffer_sz);
1297   _(VIDIOC_S_FBUF, READ, struct_v4l2_framebuffer_sz);
1298   _(VIDIOC_OVERLAY, READ, sizeof(int));
1299   _(VIDIOC_QBUF, READWRITE, struct_v4l2_buffer_sz);
1300   _(VIDIOC_DQBUF, READWRITE, struct_v4l2_buffer_sz);
1301   _(VIDIOC_STREAMON, READ, sizeof(int));
1302   _(VIDIOC_STREAMOFF, READ, sizeof(int));
1303   _(VIDIOC_G_PARM, READWRITE, struct_v4l2_streamparm_sz);
1304   _(VIDIOC_S_PARM, READWRITE, struct_v4l2_streamparm_sz);
1305   _(VIDIOC_G_STD, WRITE, sizeof(u64));
1306   _(VIDIOC_S_STD, READ, sizeof(u64));
1307   _(VIDIOC_ENUMSTD, READWRITE, struct_v4l2_standard_sz);
1308   _(VIDIOC_ENUMINPUT, READWRITE, struct_v4l2_input_sz);
1309   _(VIDIOC_G_CTRL, READWRITE, struct_v4l2_control_sz);
1310   _(VIDIOC_S_CTRL, READWRITE, struct_v4l2_control_sz);
1311   _(VIDIOC_G_TUNER, READWRITE, struct_v4l2_tuner_sz);
1312   _(VIDIOC_S_TUNER, READ, struct_v4l2_tuner_sz);
1313   _(VIDIOC_G_AUDIO, WRITE, struct_v4l2_audio_sz);
1314   _(VIDIOC_S_AUDIO, READ, struct_v4l2_audio_sz);
1315   _(VIDIOC_QUERYCTRL, READWRITE, struct_v4l2_queryctrl_sz);
1316   _(VIDIOC_QUERYMENU, READWRITE, struct_v4l2_querymenu_sz);
1317   _(VIDIOC_G_INPUT, WRITE, sizeof(int));
1318   _(VIDIOC_S_INPUT, READWRITE, sizeof(int));
1319   _(VIDIOC_G_OUTPUT, WRITE, sizeof(int));
1320   _(VIDIOC_S_OUTPUT, READWRITE, sizeof(int));
1321   _(VIDIOC_ENUMOUTPUT, READWRITE, struct_v4l2_output_sz);
1322   _(VIDIOC_G_AUDOUT, WRITE, struct_v4l2_audioout_sz);
1323   _(VIDIOC_S_AUDOUT, READ, struct_v4l2_audioout_sz);
1324   _(VIDIOC_G_MODULATOR, READWRITE, struct_v4l2_modulator_sz);
1325   _(VIDIOC_S_MODULATOR, READ, struct_v4l2_modulator_sz);
1326   _(VIDIOC_G_FREQUENCY, READWRITE, struct_v4l2_frequency_sz);
1327   _(VIDIOC_S_FREQUENCY, READ, struct_v4l2_frequency_sz);
1328   _(VIDIOC_CROPCAP, READWRITE, struct_v4l2_cropcap_sz);
1329   _(VIDIOC_G_CROP, READWRITE, struct_v4l2_crop_sz);
1330   _(VIDIOC_S_CROP, READ, struct_v4l2_crop_sz);
1331   _(VIDIOC_G_JPEGCOMP, WRITE, struct_v4l2_jpegcompression_sz);
1332   _(VIDIOC_S_JPEGCOMP, READ, struct_v4l2_jpegcompression_sz);
1333   _(VIDIOC_QUERYSTD, WRITE, sizeof(u64));
1334   _(VIDIOC_TRY_FMT, READWRITE, struct_v4l2_format_sz);
1335   _(VIDIOC_ENUMAUDIO, READWRITE, struct_v4l2_audio_sz);
1336   _(VIDIOC_ENUMAUDOUT, READWRITE, struct_v4l2_audioout_sz);
1337   _(VIDIOC_G_PRIORITY, WRITE, enum_v4l2_priority_sz);
1338   _(VIDIOC_S_PRIORITY, READ, enum_v4l2_priority_sz);
1339   _(VIDIOC_ENUM_FRAMESIZES, READWRITE, struct_v4l2_frmsizeenum_sz);
1340   _(VIDIOC_ENUM_FRAMEINTERVALS, READWRITE, struct_v4l2_frmivalenum_sz);
1341   /* Entries from file: sys/wdog.h */
1342   _(WDOGIOC_GMODE, READWRITE, struct_wdog_mode_sz);
1343   _(WDOGIOC_SMODE, READ, struct_wdog_mode_sz);
1344   _(WDOGIOC_WHICH, WRITE, struct_wdog_mode_sz);
1345   _(WDOGIOC_TICKLE, NONE, 0);
1346   _(WDOGIOC_GTICKLER, WRITE, sizeof(int));
1347   _(WDOGIOC_GWDOGS, READWRITE, struct_wdog_conf_sz);
1348   /* Entries from file: sys/kcov.h */
1349   _(KCOV_IOC_SETBUFSIZE, READ, sizeof(u64));
1350   _(KCOV_IOC_ENABLE, READ, sizeof(int));
1351   _(KCOV_IOC_DISABLE, NONE, 0);
1352   /* Entries from file: sys/ipmi.h */
1353   _(IPMICTL_RECEIVE_MSG_TRUNC, READWRITE, struct_ipmi_recv_sz);
1354   _(IPMICTL_RECEIVE_MSG, READWRITE, struct_ipmi_recv_sz);
1355   _(IPMICTL_SEND_COMMAND, READ, struct_ipmi_req_sz);
1356   _(IPMICTL_REGISTER_FOR_CMD, READ, struct_ipmi_cmdspec_sz);
1357   _(IPMICTL_UNREGISTER_FOR_CMD, READ, struct_ipmi_cmdspec_sz);
1358   _(IPMICTL_SET_GETS_EVENTS_CMD, READ, sizeof(int));
1359   _(IPMICTL_SET_MY_ADDRESS_CMD, READ, sizeof(unsigned int));
1360   _(IPMICTL_GET_MY_ADDRESS_CMD, WRITE, sizeof(unsigned int));
1361   _(IPMICTL_SET_MY_LUN_CMD, READ, sizeof(unsigned int));
1362   _(IPMICTL_GET_MY_LUN_CMD, WRITE, sizeof(unsigned int));
1363   /* Entries from file: soundcard.h */
1364   _(SNDCTL_DSP_RESET, NONE, 0);
1365   _(SNDCTL_DSP_SYNC, NONE, 0);
1366   _(SNDCTL_DSP_SPEED, READWRITE, sizeof(int));
1367   _(SOUND_PCM_READ_RATE, WRITE, sizeof(int));
1368   _(SNDCTL_DSP_STEREO, READWRITE, sizeof(int));
1369   _(SNDCTL_DSP_GETBLKSIZE, READWRITE, sizeof(int));
1370   _(SNDCTL_DSP_SETFMT, READWRITE, sizeof(int));
1371   _(SOUND_PCM_READ_BITS, WRITE, sizeof(int));
1372   _(SNDCTL_DSP_CHANNELS, READWRITE, sizeof(int));
1373   _(SOUND_PCM_READ_CHANNELS, WRITE, sizeof(int));
1374   _(SOUND_PCM_WRITE_FILTER, READWRITE, sizeof(int));
1375   _(SOUND_PCM_READ_FILTER, WRITE, sizeof(int));
1376   _(SNDCTL_DSP_POST, NONE, 0);
1377   _(SNDCTL_DSP_SUBDIVIDE, READWRITE, sizeof(int));
1378   _(SNDCTL_DSP_SETFRAGMENT, READWRITE, sizeof(int));
1379   _(SNDCTL_DSP_GETFMTS, WRITE, sizeof(int));
1380   _(SNDCTL_DSP_GETOSPACE, WRITE, struct_audio_buf_info_sz);
1381   _(SNDCTL_DSP_GETISPACE, WRITE, struct_audio_buf_info_sz);
1382   _(SNDCTL_DSP_NONBLOCK, NONE, 0);
1383   _(SNDCTL_DSP_GETCAPS, WRITE, sizeof(int));
1384   _(SNDCTL_DSP_GETTRIGGER, WRITE, sizeof(int));
1385   _(SNDCTL_DSP_SETTRIGGER, READ, sizeof(int));
1386   _(SNDCTL_DSP_GETIPTR, WRITE, struct_count_info_sz);
1387   _(SNDCTL_DSP_GETOPTR, WRITE, struct_count_info_sz);
1388   _(SNDCTL_DSP_MAPINBUF, WRITE, struct_buffmem_desc_sz);
1389   _(SNDCTL_DSP_MAPOUTBUF, WRITE, struct_buffmem_desc_sz);
1390   _(SNDCTL_DSP_SETSYNCRO, NONE, 0);
1391   _(SNDCTL_DSP_SETDUPLEX, NONE, 0);
1392   _(SNDCTL_DSP_PROFILE, READ, sizeof(int));
1393   _(SNDCTL_DSP_GETODELAY, WRITE, sizeof(int));
1394   _(SOUND_MIXER_INFO, WRITE, struct_mixer_info_sz);
1395   _(SOUND_OLD_MIXER_INFO, WRITE, struct__old_mixer_info_sz);
1396   _(OSS_GETVERSION, WRITE, sizeof(int));
1397   _(SNDCTL_SYSINFO, WRITE, struct_oss_sysinfo_sz);
1398   _(SNDCTL_AUDIOINFO, READWRITE, struct_oss_audioinfo_sz);
1399   _(SNDCTL_ENGINEINFO, READWRITE, struct_oss_audioinfo_sz);
1400   _(SNDCTL_DSP_GETPLAYVOL, WRITE, sizeof(unsigned int));
1401   _(SNDCTL_DSP_SETPLAYVOL, READ, sizeof(unsigned int));
1402   _(SNDCTL_DSP_GETRECVOL, WRITE, sizeof(unsigned int));
1403   _(SNDCTL_DSP_SETRECVOL, READ, sizeof(unsigned int));
1404   _(SNDCTL_DSP_SKIP, NONE, 0);
1405   _(SNDCTL_DSP_SILENCE, NONE, 0);
1406 #undef _
1407 }
1408
1409 static bool ioctl_initialized = false;
1410
1411 struct ioctl_desc_compare {
1412   bool operator()(const ioctl_desc &left, const ioctl_desc &right) const {
1413     return left.req < right.req;
1414   }
1415 };
1416
1417 static void ioctl_init() {
1418   ioctl_table_fill();
1419   Sort(ioctl_table, ioctl_table_size, ioctl_desc_compare());
1420
1421   bool bad = false;
1422   for (unsigned i = 0; i < ioctl_table_size - 1; ++i) {
1423     if (ioctl_table[i].req >= ioctl_table[i + 1].req) {
1424       Printf("Duplicate or unsorted ioctl request id %x >= %x (%s vs %s)\n",
1425              ioctl_table[i].req, ioctl_table[i + 1].req, ioctl_table[i].name,
1426              ioctl_table[i + 1].name);
1427       bad = true;
1428     }
1429   }
1430
1431   if (bad)
1432     Die();
1433
1434   ioctl_initialized = true;
1435 }
1436
1437 static const ioctl_desc *ioctl_table_lookup(unsigned req) {
1438   int left = 0;
1439   int right = ioctl_table_size;
1440   while (left < right) {
1441     int mid = (left + right) / 2;
1442     if (ioctl_table[mid].req < req)
1443       left = mid + 1;
1444     else
1445       right = mid;
1446   }
1447   if (left == right && ioctl_table[left].req == req)
1448     return ioctl_table + left;
1449   else
1450     return nullptr;
1451 }
1452
1453 static bool ioctl_decode(unsigned req, ioctl_desc *desc) {
1454   CHECK(desc);
1455   desc->req = req;
1456   desc->name = "<DECODED_IOCTL>";
1457   desc->size = IOC_SIZE(req);
1458   // Sanity check.
1459   if (desc->size > 0xFFFF)
1460     return false;
1461   unsigned dir = IOC_DIR(req);
1462   switch (dir) {
1463   case IOC_NONE:
1464     desc->type = ioctl_desc::NONE;
1465     break;
1466   case IOC_READ | IOC_WRITE:
1467     desc->type = ioctl_desc::READWRITE;
1468     break;
1469   case IOC_READ:
1470     desc->type = ioctl_desc::WRITE;
1471     break;
1472   case IOC_WRITE:
1473     desc->type = ioctl_desc::READ;
1474     break;
1475   default:
1476     return false;
1477   }
1478   // Size can be 0 iff type is NONE.
1479   if ((desc->type == IOC_NONE) != (desc->size == 0))
1480     return false;
1481   // Sanity check.
1482   if (IOC_TYPE(req) == 0)
1483     return false;
1484   return true;
1485 }
1486
1487 static const ioctl_desc *ioctl_lookup(unsigned req) {
1488   const ioctl_desc *desc = ioctl_table_lookup(req);
1489   if (desc)
1490     return desc;
1491
1492   // Try stripping access size from the request id.
1493   desc = ioctl_table_lookup(req & ~(IOC_SIZEMASK << IOC_SIZESHIFT));
1494   // Sanity check: requests that encode access size are either read or write and
1495   // have size of 0 in the table.
1496   if (desc && desc->size == 0 &&
1497       (desc->type == ioctl_desc::READWRITE || desc->type == ioctl_desc::WRITE ||
1498        desc->type == ioctl_desc::READ))
1499     return desc;
1500   return nullptr;
1501 }
1502
1503 static void ioctl_common_pre(void *ctx, const ioctl_desc *desc, int d,
1504                              unsigned request, void *arg) {
1505   if (desc->type == ioctl_desc::READ || desc->type == ioctl_desc::READWRITE) {
1506     unsigned size = desc->size ? desc->size : IOC_SIZE(request);
1507     COMMON_INTERCEPTOR_READ_RANGE(ctx, arg, size);
1508   }
1509   if (desc->type != ioctl_desc::CUSTOM)
1510     return;
1511   if (request == IOCTL_SIOCGIFCONF) {
1512     struct __sanitizer_ifconf *ifc = (__sanitizer_ifconf *)arg;
1513     COMMON_INTERCEPTOR_READ_RANGE(ctx, (char *)&ifc->ifc_len,
1514                                   sizeof(ifc->ifc_len));
1515   }
1516 }
1517
1518 static void ioctl_common_post(void *ctx, const ioctl_desc *desc, int res, int d,
1519                               unsigned request, void *arg) {
1520   if (desc->type == ioctl_desc::WRITE || desc->type == ioctl_desc::READWRITE) {
1521     // FIXME: add verbose output
1522     unsigned size = desc->size ? desc->size : IOC_SIZE(request);
1523     COMMON_INTERCEPTOR_WRITE_RANGE(ctx, arg, size);
1524   }
1525   if (desc->type != ioctl_desc::CUSTOM)
1526     return;
1527   if (request == IOCTL_SIOCGIFCONF) {
1528     struct __sanitizer_ifconf *ifc = (__sanitizer_ifconf *)arg;
1529     COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ifc->ifc_ifcu.ifcu_req, ifc->ifc_len);
1530   }
1531 }
1532
1533 #endif // SANITIZER_NETBSD