aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-02-07 04:45:01 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-02-07 04:45:01 +0000
commit4a3e25712f25271876e83dfafe8ff2df4f643df7 (patch)
treef08bcfb2d4ad242945fd0534e39ed5753e4aab62
parent4321f202f985f659e0150ee72ed3e14e554f9735 (diff)
downloadgcc-4a3e25712f25271876e83dfafe8ff2df4f643df7.zip
gcc-4a3e25712f25271876e83dfafe8ff2df4f643df7.tar.gz
gcc-4a3e25712f25271876e83dfafe8ff2df4f643df7.tar.bz2
os, net, crypto/x509: add hurd support
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/161519 From-SVN: r268604
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--libgo/go/crypto/x509/root_hurd.go11
-rw-r--r--libgo/go/internal/poll/sendfile_glibc.go (renamed from libgo/go/internal/poll/sendfile_linux.go)2
-rw-r--r--libgo/go/net/cgo_hurd.go17
-rw-r--r--libgo/go/net/sendfile_glibc.go (renamed from libgo/go/net/sendfile_linux.go)2
-rw-r--r--libgo/go/net/sockopt_hurd.go41
-rw-r--r--libgo/go/os/executable_procfs.go2
-rw-r--r--libgo/go/os/pipe_glibc.go (renamed from libgo/go/os/pipe_linux.go)2
8 files changed, 77 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 53780e1..b7efb21 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-db618eeabdcf1ba56861d21d5639ca4514cd6934
+28b65174d9c9163f4ab2cfaf70dca646f1a7611f
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/libgo/go/crypto/x509/root_hurd.go b/libgo/go/crypto/x509/root_hurd.go
new file mode 100644
index 0000000..59e9ff0
--- /dev/null
+++ b/libgo/go/crypto/x509/root_hurd.go
@@ -0,0 +1,11 @@
+// Copyright 2019 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.
+// This file is derived from root_linux.go
+
+package x509
+
+// Possible certificate files; stop after finding one.
+var certFiles = []string{
+ "/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc.
+}
diff --git a/libgo/go/internal/poll/sendfile_linux.go b/libgo/go/internal/poll/sendfile_glibc.go
index 8e93806..6652e3f 100644
--- a/libgo/go/internal/poll/sendfile_linux.go
+++ b/libgo/go/internal/poll/sendfile_glibc.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build hurd linux
+
package poll
import "syscall"
diff --git a/libgo/go/net/cgo_hurd.go b/libgo/go/net/cgo_hurd.go
new file mode 100644
index 0000000..98e4cfa
--- /dev/null
+++ b/libgo/go/net/cgo_hurd.go
@@ -0,0 +1,17 @@
+// Copyright 2019 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.
+// This file is derived from cgo_bsd.go
+
+// +build cgo,!netgo
+// +build hurd
+
+package net
+
+/*
+#include <netdb.h>
+*/
+
+import "syscall"
+
+const cgoAddrInfoFlags = syscall.AI_CANONNAME | syscall.AI_V4MAPPED | syscall.AI_ALL
diff --git a/libgo/go/net/sendfile_linux.go b/libgo/go/net/sendfile_glibc.go
index 297e625..a71cfc9 100644
--- a/libgo/go/net/sendfile_linux.go
+++ b/libgo/go/net/sendfile_glibc.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build hurd linux
+
package net
import (
diff --git a/libgo/go/net/sockopt_hurd.go b/libgo/go/net/sockopt_hurd.go
new file mode 100644
index 0000000..c6de7a9
--- /dev/null
+++ b/libgo/go/net/sockopt_hurd.go
@@ -0,0 +1,41 @@
+// Copyright 2019 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 net
+
+import (
+ "os"
+ "syscall"
+)
+
+func setDefaultSockopts(s, family, sotype int, ipv6only bool) error {
+ if family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW {
+ // Allow both IP versions even if the OS default
+ // is otherwise. Note that some operating systems
+ // never admit this option.
+ syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, boolint(ipv6only))
+ }
+ // Allow broadcast.
+ if err := syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1); err != nil {
+ return os.NewSyscallError("setsockopt", err)
+ }
+ return nil
+}
+
+func setDefaultListenerSockopts(s int) error {
+ // Allow reuse of recently-used addresses.
+ if err := syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1); err != nil {
+ return os.NewSyscallError("setsockopt", err)
+ }
+ return nil
+}
+
+func setDefaultMulticastSockopts(s int) error {
+ // Allow multicast UDP and raw IP datagram sockets to listen
+ // concurrently across multiple listeners.
+ if err := syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1); err != nil {
+ return os.NewSyscallError("setsockopt", err)
+ }
+ return nil
+}
diff --git a/libgo/go/os/executable_procfs.go b/libgo/go/os/executable_procfs.go
index d6ac270..e690103 100644
--- a/libgo/go/os/executable_procfs.go
+++ b/libgo/go/os/executable_procfs.go
@@ -19,7 +19,7 @@ var executablePath, executablePathErr = func() (string, error) {
switch runtime.GOOS {
default:
return "", errors.New("Executable not implemented for " + runtime.GOOS)
- case "linux", "android":
+ case "hurd", "linux", "android":
procfn = "/proc/self/exe"
case "netbsd":
procfn = "/proc/curproc/exe"
diff --git a/libgo/go/os/pipe_linux.go b/libgo/go/os/pipe_glibc.go
index acd7b88..31b144e 100644
--- a/libgo/go/os/pipe_linux.go
+++ b/libgo/go/os/pipe_glibc.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build hurd linux
+
package os
import "syscall"