1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
#!/bin/sh
# $NetBSD: mkioctls,v 1.57 2020/09/12 01:36:26 roy Exp $
#
# Copyright (c) 1994
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the University of
# California, Berkeley and its contributors.
# 4. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#)mkioctls 8.2 (Berkeley) 4/28/95
#
: ${AWK:=awk}
: ${CC:=cc}
: ${SED:=sed}
echo "/* Automatically generated file, do not edit! */"
#echo "#define const" # XXX: timepps lossage
echo "#define COMPAT_43"
echo "#define COMPAT_FREEBSD_NET80211"
echo "struct lwp;"
echo "struct crap { int _xxx; };" # XXX arm video lossage
echo "typedef struct crap videomemory_t;" # XXX arm video lossage
echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage
echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage
echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage
echo "#include <stdio.h>"
echo "#include <sys/types.h>"
echo "#include <sys/param.h>"
echo "#include <sys/mutex.h>"
echo "#ifndef NBPG"
echo "#define NBPG 4096 /* workaround / dummy for sparc */"
echo "#endif /* NBPG */"
echo "#include <sys/disk.h>"
echo "#include <sys/dkbad.h>"
echo "#include <sys/mount.h>"
echo "#include <sys/termios.h>"
echo "#include <sys/disklabel.h>"
echo "#include <sys/exec_elf.h>"
echo "#include <net/if.h>"
echo "#include <net/if_ether.h>"
echo "#include <net/route.h>"
echo "#include <net/ppp_defs.h>"
echo "#include <netinet/in.h>"
echo "#include <netinet/in_var.h>"
echo "#include <netinet/in_systm.h>"
echo "#include <netinet/ip.h>"
echo "#include <netinet/ip_mroute.h>"
echo "#include <netinet/ip_compat.h>"
echo "#include <net80211/ieee80211.h>"
echo "#include <net80211/ieee80211_radiotap.h>"
echo "#include <netinet6/in6_var.h>"
echo "#include <netinet6/nd6.h>"
echo "#include <dev/ic/hd44780reg.h>"
echo "#include <dev/pci/mlyreg.h>"
echo "#include <prop/proplib.h>"
echo "#include <nv.h>"
echo
# kernel headers <sys/*.h> and <net/*.h> should not include stdbool.h
# but they do; then xf86Opt.h needs a bool struct field.
needundef=true
for i
do
case $i in
*X11*)
if $needundef; then
echo "#undef bool"
needundef=false;
fi;;
esac
echo "#include <$i>"
done | ${SED} -e "s,${DESTDIR}/usr/include/,,g" \
-e "s,${DESTDIR}/usr/X11R7/include/,,g" \
-e "s,${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common/,,g"
if ! $needundef; then
echo "#define bool _Bool"
fi
${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include ${CPPFLAGS} -dM "${@}" | \
${AWK} '
BEGIN {
keep["SLIOCGUNIT"] = 1; # Same as PPPIOCGASYNCMAP
keep["TUNSLMODE"] = 1; # Same as PPPIOCGASYNCMAP
keep["SIOCRMNAT"] = 1; # Same as SIOCRMAFR
keep["SIOCADNAT"] = 1; # Same as SIOCADAFR
keep["SIOCDELST"] = 1; # Same as SIOCRMNAT
keep["SIOCPROXY"] = 1; # Same as SIOCLOOKUPSTAT
keep["CHIOGPICKER"] = 1; # Same as CDIOREADTOCHEADER
keep["KBDSTPMAT"] = 1; # Same as LMREADY, pcvt is gone so ok.
keep["SIOCSLOWAT"] = 1; # Same as SATIOSBUFSIZE
keep["UTOPPYIOTURBO"] = 1; # Same as OTIOCSETD
keep["TIOCHPCL"] = 1; # Same as UTOPPYIOCANCEL
keep["TIOCCBRK"] = 1; # Same as CONSOLE_X_MODE_OFF
keep["TIOCSDTR"] = 1; # Same as CONSOLE_X_MODE_ON
keep["APM_IOC_SUSPEND"] = 1; # Same as AGPIOC_RELEASE
keep["APM_IOC_STANDBY"] = 1; # Same as AGPIOC_ACQUIRE
keep["BTDEV_GETINFO"] = 1; # Same as BTSCO_GETINFO
keep["BTHSET_GETINFO"] = 1; # Same as BTSCO_GETINFO
keep["JOY_GET_X_OFFSET"] = 1; # Same as GDT_IOCTL_CTRCNT
keep["JOY_GET_X_OFFSET"] = 1; # Same as GDT_IOCTL_CTRCNT
keep["SCIOC_USE_ADF"] = 1; # Same as STICIO_STARTQ
keep["SCBUSIOLLSCAN"] = 1; # Same as USB_DISCOVER
keep["OPIOCGETNEXT"] = 1; # Same as OFIOCGETNEXT
keep["OPIOCGET"] = 1; # Same as OFIOCGET
keep["OPIOCGETCHILD"] = 1; # Same as OFIOCGETCHILD
keep["OPIOCFINDDEVICE"] = 1; # Same as OFIOCFINDDEVICE
keep["OPIOCGETOPTNODE"] = 1; # Same as OFIOCGETOPTNODE
keep["OPIOCNEXTPROP"] = 1; # Same as OFIOCNEXTPROP
keep["OPIOCSET"] = 1; # Same as OFIOCSET
keep["MBPPIOCSPARAM"] = 1; # Same as PARIOCSPARAM
keep["MBPPIOCGPARAM"] = 1; # Same as PARIOCGPARAM
keep["CLOCKCTL_ADJTIME"] = 1; # Same as TCTRL_MODEM_PWR
keep["OFIOCNEXTPROP"] = 1; # Same as PNVIOCGETNUMGE
keep["OFIOCGET"] = 1; # Same as PNVIOCGET
keep["SIOCPHASE2"] = 1; # Same as GRESADDRS
keep["I4B_CTL_CLR_CHIPSTAT"] = 1; # Same as CLOCKCTL_NTP_ADJTIME
keep["STICIO_STARTQ"] = 1; # Same as SPKRTONE
keep["STICIO_RESET860"] = 1; # Same as SCIOCRESTART
keep["STICIO_START860"] = 1; # Same as SPKRTUNE
keep["I4B_CTL_SET_DEBUG"] = 1; # Same as CLOCKCTL_SETTIMEOFDAY
keep["SIOCGETSGCNT_IN6"] = 1; # Type sioc_sg_req6 not exported
keep["SIOCGPRLST_IN6"] = 1; Type in6_oprlist not exported
keep["SIOCGETMIFCNT_IN6"] = 1; Type sioc_mif_req6 not exported
i = 1;
altqt[i++] = "RED";
altqt[i++] = "BLUE";
altqt[i++] = "RIO";
altqt[i++] = "FIFOQ";
altqt[i++] = "HFSC";
altqt[i++] = "PRIQ";
altqt[i++] = "WFQ";
altqt[i++] = "CBQ";
altqt[i++] = "CNDR";
i = 1;
altqf[i++] = "IF_ATTACH";
altqf[i++] = "DISABLE";
altqf[i++] = "ENABLE";
altqf[i++] = "CONFIG";
altqf[i++] = "GETSTATS";
altqf[i++] = "IF_DETACH";
altqf[i++] = "ADD_CLASS";
altqf[i++] = "DEL_CLASS";
altqf[i++] = "MOD_CLASS";
altqf[i++] = "ADD_FILTER";
altqf[i++] = "DEL_FILTER";
altqf[i++] = "CLEAR_HIERARCHY";
for (t in altqt) {
for (f in altqf) {
keep[altqt[t] "_" altqf[f]] = 1;
}
}
print ""
print "#include \"ktrace.h\""
print ""
print "const char *"
print "ioctlname(u_long val)"
print "{"
print ""
print "\tswitch (val) {\n"
}
/^#[ ]*define[ ]*[A-Z0-9_]*[ ]*[D]*[R]*[M]*_IO[W]*[R]*[ ]*\(/ {
# find where the name starts
for (i = 1; i <= NF; i++)
if ($i ~ /define/)
break;
++i;
name = $i;
printf("/* %s [%s] */\n", $0, name);
#
if (name !~ /^[A-Z0-9a-z_]*$/)
next;
if (keep[name] == 1)
next;
keep[name] = 1;
printf("\t#ifdef %s\n", name);
printf("\tcase %s:\n\t\treturn \"%s\";\n", name, name);
printf("\t#endif /* %s */\n", $i);
name = name;
names[name] = name;
exprs[name] = "";
files[name] = filename;
do {
++i;
exprs[name] = exprs[name] " " $i;
} while ($i !~ /.*)/);
exprs[name] = substr(exprs[name], 2);
}
END {
print "\tdefault:\n\t\treturn NULL;\n"
print "\t}\n"
print "}"
print "const struct ioctlinfo ioctlinfo[] = {\n";
for (name in names) {
printf("\t{ .name = \"%s\", .expr = \"%s\", .value = %s },\n",
names[name], exprs[name], names[name]);
}
print "\t{ .name = NULL, .expr = NULL, .value = 0 },\n};";
}
'
|