8 echo "usage: sh $0 include-dir"
14 LC_ALL=C; export LC_ALL
16 # Build a list of headers that have ioctls in them.
17 # XXX should we use an ANSI cpp?
22 if [ "${MK_PF}" == "no" ]; then
23 filter='egrep -v (net/pfvar|net/if_pfsync)\.h'
26 find -H -s * -name '*.h' | \
29 '^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO[^a-z0-9_]' |
30 awk '{printf("#include <%s>\\n", $1)}'
33 awk -v x="$ioctl_includes" 'BEGIN {print x}' |
34 $CPP -nostdinc -I$includedir -dM -DCOMPAT_43TTY - |
35 awk -v ioctl_includes="$ioctl_includes" '
37 print "/* XXX obnoxious prerequisites. */"
38 print "#define COMPAT_43"
39 print "#define COMPAT_43TTY"
40 print "#include <sys/param.h>"
41 print "#include <sys/devicestat.h>"
42 print "#include <sys/disklabel.h>"
43 print "#include <sys/socket.h>"
44 print "#include <sys/time.h>"
45 print "#include <sys/tty.h>"
46 print "#include <bsm/audit.h>"
47 print "#include <net/ethernet.h>"
48 print "#include <net/if.h>"
50 print "#include <net/pfvar.h>"
51 print "#include <net/if_pfsync.h>"
53 print "#include <net/route.h>"
54 print "#include <netinet/in.h>"
55 print "#include <netinet/ip_mroute.h>"
56 print "#include <netinet6/in6_var.h>"
57 print "#include <netinet6/nd6.h>"
58 print "#include <netinet6/ip6_mroute.h>"
59 print "#include <stdio.h>"
60 print "#include <cam/cam.h>"
61 print "#include <stdbool.h>"
62 print "#include <stddef.h>"
63 print "#include <stdint.h>"
64 print "#include <sysdecode.h>"
69 print "sysdecode_ioctlname(unsigned long val)"
71 print "\tconst char *str = NULL;"
75 /^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO/ {
77 # find where the name starts
78 for (i = 1; i <= NF; i++)
86 printf("if (val == %s)\n", $i);
87 printf("\t\tstr = \"%s\";\n", $i);
91 print "\treturn (str);"