From: Ian Lance Taylor Date: Sat, 25 Jul 2015 00:01:04 +0000 (+0000) Subject: syscall: Add ioctl consts from if_tun.h X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2850beb940a4a05e901fe608cf7d45dc8efbb49e;p=gcc.git syscall: Add ioctl consts from if_tun.h During the gccgo build define constants from some header files are processed by mksysinfo.sh and added to syscall.go. In some cases the constants are based on macros which are not processed correctly by mksysinfo.sh. This adds the support to generate the correct values for the TUN* constants from linux/if_tun.h. Fixes golang/go#11707 Reviewed-on: https://go-review.googlesource.com/12491 From-SVN: r226196 --- diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 09ff6c316e7..663ad8087b9 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -e4a5e2b2a9dc556685db09421a95871f195f768b +3aa95d96181dc4525b1b8ec189f9104afa6d7609 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index c2e7c24974a..029098ffaaf 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -201,6 +201,67 @@ enum { #ifdef TCSETS TCSETS_val = TCSETS, #endif +#ifdef TUNSETIFF + TUNSETIFF_val = TUNSETIFF, +#endif +#ifdef TUNSETNOCSUM + TUNSETNOCSUM_val = TUNSETNOCSUM, +#endif +#ifdef TUNSETDEBUG + TUNSETDEBUG_val = TUNSETDEBUG, +#endif +#ifdef TUNSETPERSIST + TUNSETPERSIST_val = TUNSETPERSIST, +#endif +#ifdef TUNSETOWNER + TUNSETOWNER_val = TUNSETOWNER, +#endif +#ifdef TUNSETLINK + TUNSETLINK_val = TUNSETLINK, +#endif +#ifdef TUNSETGROUP + TUNSETGROUP_val = TUNSETGROUP, +#endif +#ifdef TUNGETFEATURES + TUNGETFEATURES_val = TUNGETFEATURES, +#endif +#ifdef TUNSETOFFLOAD + TUNSETOFFLOAD_val = TUNSETOFFLOAD, +#endif +#ifdef TUNSETTXFILTER + TUNSETTXFILTER_val = TUNSETTXFILTER, +#endif +#ifdef TUNGETIFF + TUNGETIFF_val = TUNGETIFF, +#endif +#ifdef TUNGETSNDBUF + TUNGETSNDBUF_val = TUNGETSNDBUF, +#endif +#ifdef TUNSETSNDBUF + TUNSETSNDBUF_val = TUNSETSNDBUF, +#endif +#ifdef TUNATTACHFILTER + TUNATTACHFILTER_val = TUNATTACHFILTER, +#endif +#ifdef TUNDETACHFILTER + TUNDETACHFILTER_val = TUNDETACHFILTER, +#endif +#ifdef TUNGETVNETHDRSZ + TUNGETVNETHDRSZ_val = TUNGETVNETHDRSZ, +#endif +#ifdef TUNSETVNETHDRSZ + TUNSETVNETHDRSZ_val = TUNSETVNETHDRSZ, +#endif +#ifdef TUNSETQUEUE + TUNSETQUEUE_val = TUNSETQUEUE, +#endif +#ifdef TUNSETIFINDEX + TUNSETIFINDEX_val = TUNSETIFINDEX, +#endif +#ifdef TUNGETFILTER + TUNGETFILTER_val = TUNGETFILTER, +#endif + }; EOF @@ -830,6 +891,9 @@ grep '^type _passwd ' gen-sysinfo.go | \ grep '^const _TIOC' gen-sysinfo.go | \ grep -v '_val =' | \ sed -e 's/^\(const \)_\(TIOC[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} +grep '^const _TUNSET' gen-sysinfo.go | \ + grep -v '_val =' | \ + sed -e 's/^\(const \)_\(TUNSET[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} # We need TIOCGWINSZ. if ! grep '^const TIOCGWINSZ' ${OUT} >/dev/null 2>&1; then if grep '^const _TIOCGWINSZ_val' ${OUT} >/dev/null 2>&1; then @@ -872,6 +936,129 @@ if ! grep '^const TIOCSIG' ${OUT} >/dev/null 2>&1; then fi fi +if ! grep '^const TUNSETNOCSUM' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETNOCSUM_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETNOCSUM = _TUNSETNOCSUM_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETDEBUG' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETDEBUG_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETDEBUG = _TUNSETDEBUG_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETIFF' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETIFF_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETIFF = _TUNSETIFF_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETPERSIST' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETPERSIST_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETPERSIST = _TUNSETPERSIST_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETOWNER' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETOWNER_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETOWNER = _TUNSETOWNER_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETLINK' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETLINK_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETLINK = _TUNSETLINK_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETGROUP' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETGROUP_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETGROUP = _TUNSETGROUP_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNGETFEATURES' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNGETFEATURES_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNGETFEATURES = _TUNGETFEATURES_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETOFFLOAD' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETOFFLOAD_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETOFFLOAD = _TUNSETOFFLOAD_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETTXFILTER' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETTXFILTER_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETTXFILTER = _TUNSETTXFILTER_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNGETIFF' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNGETIFF_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNGETIFF = _TUNGETIFF_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNGETSNDBUF' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNGETSNDBUF_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNGETSNDBUF = _TUNGETSNDBUF_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETSNDBUF' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETSNDBUF_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETSNDBUF = _TUNSETSNDBUF_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNATTACHFILTER' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNATTACHFILTER_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNATTACHFILTER = _TUNATTACHFILTER_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNDETACHFILTER' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNDETACHFILTER_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNDETACHFILTER = _TUNDETACHFILTER_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNGETVNETHDRSZ'${OUT} >/dev/null 2>&1; then + if grep '^const _TUNGETVNETHDRSZ_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNGETVNETHDRSZ = _TUNGETVNETHDRSZ_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETVNETHDRSZ'${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETVNETHDRSZ_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETVNETHDRSZ = _TUNSETVNETHDRSZ_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNSETQUEUE'${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETQUEUE_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETQUEUE = _TUNSETQUEUE_val' >> ${OUT} + fi +fi + + +if ! grep '^const TUNSETIFINDEX' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNSETIFINDEX_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNSETIFINDEX = _TUNSETIFINDEX_val' >> ${OUT} + fi +fi + +if ! grep '^const TUNGETFILTER' ${OUT} >/dev/null 2>&1; then + if grep '^const _TUNGETFILTER_val' ${OUT} >/dev/null 2>&1; then + echo 'const TUNGETFILTER = _TUNGETFILTER_val' >> ${OUT} + fi +fi + + + # The ioctl flags for terminal control grep '^const _TC[GS]ET' gen-sysinfo.go | grep -v _val | \ sed -e 's/^\(const \)_\(TC[GS]ET[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}