diff mbox

libgo patch committed: Backport some patches to GCC 5 branch

Message ID CAOyqgcUs86SPe3QXZc8Pi7a+hF7+KR7sd_sf80_Q3PZN8isC8Q@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor Aug. 4, 2015, 10:04 p.m. UTC
I've backported three recent libgo patches to the GCC 5 branch, as follows.

Ian
diff mbox

Patch

Index: libgo/Makefile.am
===================================================================
--- libgo/Makefile.am	(revision 226591)
+++ libgo/Makefile.am	(working copy)
@@ -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) \
Index: libgo/go/syscall/socket_linux.go
===================================================================
--- libgo/go/syscall/socket_linux.go	(revision 226591)
+++ libgo/go/syscall/socket_linux.go	(working copy)
@@ -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)
Index: libgo/go/syscall/socket_linux_ppc64x_type.go
===================================================================
--- libgo/go/syscall/socket_linux_ppc64x_type.go	(revision 0)
+++ libgo/go/syscall/socket_linux_ppc64x_type.go	(working copy)
@@ -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
+}
Index: libgo/go/syscall/socket_linux_type.go
===================================================================
--- libgo/go/syscall/socket_linux_type.go	(revision 0)
+++ libgo/go/syscall/socket_linux_type.go	(working copy)
@@ -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
+}
Index: libgo/mksysinfo.sh
===================================================================
--- libgo/mksysinfo.sh	(revision 226591)
+++ libgo/mksysinfo.sh	(working copy)
@@ -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/
   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}