]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
os, net, crypto/x509: add hurd support
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Feb 2019 04:45:01 +0000 (04:45 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Feb 2019 04:45:01 +0000 (04:45 +0000)
    Patch by Svante Signell.

    Reviewed-on: https://go-review.googlesource.com/c/161519

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268604 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/MERGE
libgo/go/crypto/x509/root_hurd.go [new file with mode: 0644]
libgo/go/internal/poll/sendfile_glibc.go [moved from libgo/go/internal/poll/sendfile_linux.go with 98% similarity]
libgo/go/net/cgo_hurd.go [new file with mode: 0644]
libgo/go/net/sendfile_glibc.go [moved from libgo/go/net/sendfile_linux.go with 98% similarity]
libgo/go/net/sockopt_hurd.go [new file with mode: 0644]
libgo/go/os/executable_procfs.go
libgo/go/os/pipe_glibc.go [moved from libgo/go/os/pipe_linux.go with 97% similarity]

index 53780e1bc2139cdc480d0b54260757650fcc991e..b7efb211ca505b2f82cc42c4e334b0a658582b67 100644 (file)
@@ -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 (file)
index 0000000..59e9ff0
--- /dev/null
@@ -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.
+}
similarity index 98%
rename from libgo/go/internal/poll/sendfile_linux.go
rename to libgo/go/internal/poll/sendfile_glibc.go
index 8e938065f17ad3685b068ab446561163b962d193..6652e3fedc104a99f1e4c782eb96025726962be3 100644 (file)
@@ -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 (file)
index 0000000..98e4cfa
--- /dev/null
@@ -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
similarity index 98%
rename from libgo/go/net/sendfile_linux.go
rename to libgo/go/net/sendfile_glibc.go
index 297e625d24b1d86623316abb51c32e5fc313f6d3..a71cfc961c26b41dcb6be87ab2b329f4c67b9f9d 100644 (file)
@@ -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 (file)
index 0000000..c6de7a9
--- /dev/null
@@ -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
+}
index d6ac270ace49688b28d1f4fdf705dba7af19dc88..e690103b0adf8a1272fbbd07c045c1589caeef20 100644 (file)
@@ -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"
similarity index 97%
rename from libgo/go/os/pipe_linux.go
rename to libgo/go/os/pipe_glibc.go
index acd7b88e1d45d70d5f29e197699d72ddfc74e081..31b144e92c7eea655a76f24df03675234356166d 100644 (file)
@@ -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"