diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-04 22:04:04 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-04 22:04:04 +0000 |
commit | dfbaa3b5c9084feded553a0213b517aa52f6aab8 (patch) | |
tree | 1cf6ba10e07e06fdb861e28688e5b8f94f59a889 | |
parent | aca4ecda944a121fbeba75efd5cdc9f45b4f69bb (diff) | |
download | gcc-dfbaa3b5c9084feded553a0213b517aa52f6aab8.tar.gz |
Backport from mainline:
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
syscall: Fix to libgo/mksysinfo.sh
In a recent change to mksysinfo.sh, a space was missing on
some lines which caused the libgo build to hang on some
systems. This corrects that problem.
Fixes golang/go#11924
Reviewed-on: https://go-review.googlesource.com/12835
syscall: RawSockaddr fix for ppc64, ppc64le
The struct RawSockaddr contains a field Data which
should be uint8 on ppc64 and ppc64le, but is declared
as int8 in gccgo. This change adds a two new files
which contain the structure declaration for
RawSockaddr, one with the correct types for for ppc64
and ppc64le, and the other for non-ppc64 platforms.
Fixes golang/go#11469
Reviewed-on: https://go-review.googlesource.com/11946
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@226595 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libgo/Makefile.am | 11 | ||||
-rw-r--r-- | libgo/Makefile.in | 5 | ||||
-rw-r--r-- | libgo/go/syscall/socket_linux.go | 5 | ||||
-rw-r--r-- | libgo/go/syscall/socket_linux_ppc64x_type.go | 14 | ||||
-rw-r--r-- | libgo/go/syscall/socket_linux_type.go | 14 | ||||
-rwxr-xr-x | libgo/mksysinfo.sh | 187 |
6 files changed, 231 insertions, 5 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am index fa4fcaa6404..1676624360d 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -1676,7 +1676,17 @@ endif # !LIBGO_IS_LINUX # Define socket sizes and types. if LIBGO_IS_LINUX syscall_socket_file = go/syscall/socket_linux.go epoll.go +if LIBGO_IS_PPC64LE +syscall_socket_type_file = go/syscall/socket_linux_ppc64x_type.go else +if LIBGO_IS_PPC64 +syscall_socket_type_file = go/syscall/socket_linux_ppc64x_type.go +else +syscall_socket_type_file = go/syscall/socket_linux_type.go +endif +endif +else +syscall_socket_type_file = if LIBGO_IS_SOLARIS syscall_socket_file = go/syscall/socket_solaris.go else @@ -1762,6 +1772,7 @@ go_base_syscall_files = \ $(syscall_size_file) \ $(syscall_socket_file) \ $(syscall_socket_os_file) \ + $(syscall_socket_type_file) \ $(syscall_uname_file) \ $(syscall_netlink_file) \ $(syscall_lsf_file) \ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 99ffbb27611..7f0ee54c1df 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -1848,6 +1848,10 @@ go_unicode_utf8_files = \ # Define socket sizes and types. @LIBGO_IS_LINUX_TRUE@syscall_socket_file = go/syscall/socket_linux.go epoll.go +@LIBGO_IS_LINUX_FALSE@syscall_socket_type_file = +@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_PPC64LE_FALSE@@LIBGO_IS_PPC64_FALSE@syscall_socket_type_file = go/syscall/socket_linux_type.go +@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_PPC64LE_FALSE@@LIBGO_IS_PPC64_TRUE@syscall_socket_type_file = go/syscall/socket_linux_ppc64x_type.go +@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_PPC64LE_TRUE@syscall_socket_type_file = go/syscall/socket_linux_ppc64x_type.go @LIBGO_IS_SOLARIS_FALSE@syscall_socket_os_file = go/syscall/socket_posix.go # Define socket functions. @@ -1898,6 +1902,7 @@ go_base_syscall_files = \ $(syscall_size_file) \ $(syscall_socket_file) \ $(syscall_socket_os_file) \ + $(syscall_socket_type_file) \ $(syscall_uname_file) \ $(syscall_netlink_file) \ $(syscall_lsf_file) \ diff --git a/libgo/go/syscall/socket_linux.go b/libgo/go/syscall/socket_linux.go index 8546abc3e06..5064e771221 100644 --- a/libgo/go/syscall/socket_linux.go +++ b/libgo/go/syscall/socket_linux.go @@ -136,11 +136,6 @@ type RawSockaddrNetlink struct { Groups uint32 } -type RawSockaddr struct { - Family uint16 - Data [14]int8 -} - // BindToDevice binds the socket associated with fd to device. func BindToDevice(fd int, device string) (err error) { return SetsockoptString(fd, SOL_SOCKET, SO_BINDTODEVICE, device) diff --git a/libgo/go/syscall/socket_linux_ppc64x_type.go b/libgo/go/syscall/socket_linux_ppc64x_type.go new file mode 100644 index 00000000000..8a707ce49da --- /dev/null +++ b/libgo/go/syscall/socket_linux_ppc64x_type.go @@ -0,0 +1,14 @@ +// socket_linux_ppc64x_type.go -- Socket handling specific to ppc64 GNU/Linux. + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package syscall + +// Type needed on ppc64le & ppc64 + +type RawSockaddr struct { + Family uint16 + Data [14]uint8 +} diff --git a/libgo/go/syscall/socket_linux_type.go b/libgo/go/syscall/socket_linux_type.go new file mode 100644 index 00000000000..45b8c6ec1d0 --- /dev/null +++ b/libgo/go/syscall/socket_linux_type.go @@ -0,0 +1,14 @@ +// socket_linux_type.go -- Socket handling specific to GNU/Linux. + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package syscall + +// Type needed if not on ppc64le or ppc64 + +type RawSockaddr struct { + Family uint16 + Data [14]int8 +} diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index c2e7c24974a..942e8319ea5 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} |