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