From 57ca644cad606398dc16bc69f961fd087146feb9 Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 25 Jul 2015 00:01:04 +0000 Subject: 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226196 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/mksysinfo.sh | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) (limited to 'libgo/mksysinfo.sh') 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} -- cgit v1.2.1