2004-04-23 02:31:18 +04:00
|
|
|
#!/bin/sh
|
2015-10-22 03:29:58 +03:00
|
|
|
# $NetBSD: mkioctls,v 1.45 2015/10/22 00:29:58 christos Exp $
|
1995-09-01 02:50:22 +04:00
|
|
|
#
|
|
|
|
# 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
|
1994-10-06 18:44:32 +03:00
|
|
|
#
|
2008-10-20 02:10:04 +04:00
|
|
|
|
|
|
|
: ${AWK:=awk}
|
2008-10-26 02:18:15 +04:00
|
|
|
: ${CC:=cc}
|
|
|
|
: ${SED:=sed}
|
2008-10-20 02:10:04 +04:00
|
|
|
|
2004-05-10 19:25:57 +04:00
|
|
|
echo "/* Automatically generated file, do not edit! */"
|
2005-07-17 02:00:01 +04:00
|
|
|
#echo "#define const" # XXX: timepps lossage
|
2004-04-23 02:31:18 +04:00
|
|
|
echo "#define COMPAT_43"
|
2008-03-11 23:39:57 +03:00
|
|
|
echo "#define COMPAT_FREEBSD_NET80211"
|
2004-04-23 02:31:18 +04:00
|
|
|
echo "struct lwp;"
|
2006-08-28 00:31:26 +04:00
|
|
|
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
|
2015-02-06 23:08:23 +03:00
|
|
|
echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage
|
2006-08-28 00:31:26 +04:00
|
|
|
echo "#include <stdio.h>"
|
2004-04-23 02:31:18 +04:00
|
|
|
echo "#include <sys/types.h>"
|
|
|
|
echo "#include <sys/param.h>"
|
2006-09-01 02:41:14 +04:00
|
|
|
echo "#ifndef NBPG"
|
|
|
|
echo "#define NBPG 4096 /* workaround / dummy for sparc */"
|
|
|
|
echo "#endif /* NBPG */"
|
2004-04-23 02:31:18 +04:00
|
|
|
echo "#include <sys/disk.h>"
|
2004-05-11 00:41:32 +04:00
|
|
|
echo "#include <sys/dkbad.h>"
|
2004-04-23 02:31:18 +04:00
|
|
|
echo "#include <sys/mount.h>"
|
|
|
|
echo "#include <sys/termios.h>"
|
2004-05-10 19:25:57 +04:00
|
|
|
echo "#include <sys/disklabel.h>"
|
2015-05-20 10:16:15 +03:00
|
|
|
echo "#include <sys/exec_elf.h>"
|
2004-04-23 02:31:18 +04:00
|
|
|
echo "#include <net/if.h>"
|
2006-08-28 00:31:26 +04:00
|
|
|
echo "#include <net/if_ether.h>"
|
2004-04-23 02:31:18 +04:00
|
|
|
echo "#include <net/route.h>"
|
|
|
|
echo "#include <net/ppp_defs.h>"
|
|
|
|
echo "#include <netinet/in.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>"
|
2006-08-28 00:31:26 +04:00
|
|
|
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>"
|
2013-04-05 02:32:12 +04:00
|
|
|
echo
|
2008-10-20 02:10:04 +04:00
|
|
|
|
2004-04-23 02:31:18 +04:00
|
|
|
for i
|
|
|
|
do
|
|
|
|
echo "#include <$i>"
|
2008-10-26 02:18:15 +04:00
|
|
|
done | ${SED} -e "s,${DESTDIR}/usr/include/,,g"
|
2004-04-23 02:31:18 +04:00
|
|
|
|
2015-02-06 23:08:23 +03:00
|
|
|
${CC} -E -nostdinc -isystem ${DESTDIR}/usr/include \
|
|
|
|
-I${DESTDIR}/usr/X11R7/include \
|
|
|
|
-I${DESTDIR}/usr/X11R7/include/pixman-1 \
|
|
|
|
-I${DESTDIR}/usr/X11R7/include/libdrm \
|
|
|
|
-D_VIA_DRM_H_ \
|
2015-10-22 03:29:58 +03:00
|
|
|
-dM "${@}" | \
|
2008-10-20 02:10:04 +04:00
|
|
|
${AWK} '
|
1994-05-11 11:10:27 +04:00
|
|
|
BEGIN {
|
2004-05-11 00:41:32 +04:00
|
|
|
keep["SLIOCGUNIT"] = 1; # Same as PPPIOCGASYNCMAP
|
2004-06-22 21:30:52 +04:00
|
|
|
keep["TUNSLMODE"] = 1; # Same as PPPIOCGASYNCMAP
|
2004-05-11 00:41:32 +04:00
|
|
|
keep["SIOCRMNAT"] = 1; # Same as SIOCRMAFR
|
|
|
|
keep["SIOCADNAT"] = 1; # Same as SIOCADAFR
|
|
|
|
keep["SIOCDELST"] = 1; # Same as SIOCRMNAT
|
2006-06-03 04:02:51 +04:00
|
|
|
keep["SIOCPROXY"] = 1; # Same as SIOCLOOKUPSTAT
|
2004-05-11 00:41:32 +04:00
|
|
|
keep["CHIOGPICKER"] = 1; # Same as CDIOREADTOCHEADER
|
2004-07-08 07:22:32 +04:00
|
|
|
keep["KBDSTPMAT"] = 1; # Same as LMREADY, pcvt is gone so ok.
|
2006-08-28 00:31:26 +04:00
|
|
|
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
|
2006-08-29 18:53:57 +04:00
|
|
|
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
|
2006-08-31 03:26:25 +04:00
|
|
|
keep["MBPPIOCSPARAM"] = 1; # Same as PARIOCSPARAM
|
|
|
|
keep["MBPPIOCGPARAM"] = 1; # Same as PARIOCGPARAM
|
2006-09-01 02:25:34 +04:00
|
|
|
keep["CLOCKCTL_ADJTIME"] = 1; # Same as TCTRL_MODEM_PWR
|
2007-03-05 20:38:25 +03:00
|
|
|
keep["OFIOCNEXTPROP"] = 1; # Same as PNVIOCGETNUMGE
|
|
|
|
keep["OFIOCGET"] = 1; # Same as PNVIOCGET
|
2008-03-11 23:39:57 +03:00
|
|
|
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
|
2006-08-28 00:31:26 +04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2004-05-10 19:25:57 +04:00
|
|
|
|
1994-05-11 11:10:27 +04:00
|
|
|
print ""
|
2005-07-17 02:00:01 +04:00
|
|
|
print "#include \"ktrace.h\""
|
1997-10-19 07:38:27 +04:00
|
|
|
print ""
|
2005-07-17 02:00:01 +04:00
|
|
|
print "const char *"
|
|
|
|
print "ioctlname(u_long val)"
|
1994-05-11 11:10:27 +04:00
|
|
|
print "{"
|
|
|
|
print ""
|
2004-05-10 19:25:57 +04:00
|
|
|
print "\tswitch (val) {\n"
|
1994-05-11 11:10:27 +04:00
|
|
|
}
|
|
|
|
|
2015-02-06 23:08:23 +03:00
|
|
|
/^#[ ]*define[ ]*[A-Z0-9_]*[ ]*[D]*[R]*[M]*_IO[W]*[R]*[ ]*\(/ {
|
1994-05-11 11:10:27 +04:00
|
|
|
|
|
|
|
# find where the name starts
|
|
|
|
for (i = 1; i <= NF; i++)
|
|
|
|
if ($i ~ /define/)
|
|
|
|
break;
|
|
|
|
++i;
|
2004-06-22 21:30:52 +04:00
|
|
|
printf("/* %s [%s] */\n", $0, $i);
|
1994-05-11 11:10:27 +04:00
|
|
|
#
|
2004-06-22 21:30:52 +04:00
|
|
|
if ($i ~ /^[A-Z0-9a-z_]*$/) {
|
|
|
|
if (keep[$i] != 1) {
|
2008-03-23 21:53:51 +03:00
|
|
|
printf("\t#ifdef %s\n", $i);
|
2004-06-22 21:30:52 +04:00
|
|
|
printf("\tcase %s:\n\t\treturn \"%s\";\n", $i, $i);
|
2008-03-23 21:53:51 +03:00
|
|
|
printf("\t#endif /* %s */\n", $i);
|
2004-06-22 21:30:52 +04:00
|
|
|
keep[$i] = 1;
|
|
|
|
}
|
2004-05-10 19:25:57 +04:00
|
|
|
}
|
1994-05-11 11:10:27 +04:00
|
|
|
}
|
|
|
|
END {
|
2004-05-10 19:25:57 +04:00
|
|
|
print "\tdefault:\n\t\treturn NULL;\n"
|
|
|
|
print "\t}\n"
|
1994-05-11 11:10:27 +04:00
|
|
|
print "}"
|
|
|
|
}
|
1995-01-15 10:51:08 +03:00
|
|
|
'
|