os, net, crypto/x509: add hurd support
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/161519 From-SVN: r268604
This commit is contained in:
parent
4321f202f9
commit
4a3e25712f
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
}
|
|
@ -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"
|
|
@ -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
|
|
@ -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 (
|
|
@ -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
|
||||
}
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
Loading…
Reference in New Issue