Commit 4a3e2571 by Ian Lance Taylor

os, net, crypto/x509: add hurd support

    
    Patch by Svante Signell.
    
    Reviewed-on: https://go-review.googlesource.com/c/161519

From-SVN: r268604
parent 4321f202
db618eeabdcf1ba56861d21d5639ca4514cd6934 28b65174d9c9163f4ab2cfaf70dca646f1a7611f
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
// 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 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build hurd linux
package poll package poll
import "syscall" import "syscall"
......
// 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 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build hurd linux
package net package net
import ( import (
......
// 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) { ...@@ -19,7 +19,7 @@ var executablePath, executablePathErr = func() (string, error) {
switch runtime.GOOS { switch runtime.GOOS {
default: default:
return "", errors.New("Executable not implemented for " + runtime.GOOS) return "", errors.New("Executable not implemented for " + runtime.GOOS)
case "linux", "android": case "hurd", "linux", "android":
procfn = "/proc/self/exe" procfn = "/proc/self/exe"
case "netbsd": case "netbsd":
procfn = "/proc/curproc/exe" procfn = "/proc/curproc/exe"
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build hurd linux
package os package os
import "syscall" import "syscall"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment