]> Cypherpunks repositories - gostls13.git/commitdiff
all: drop support for FreeBSD 9 or below
authorMikio Hara <mikioh.mikioh@gmail.com>
Sat, 19 Aug 2017 04:46:48 +0000 (13:46 +0900)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 28 Nov 2017 18:57:25 +0000 (18:57 +0000)
This change drops the support for FreeBSD 9 or below and simplifies
platform-dependent code for the sake of maintenance.

Updates #7187.
Fixes #11412.
Updates #16064.
Updates #18854.
Fixes #19072.

Change-Id: I9129130aafbfc7d0d7e9b674b6fc6cb31b7381be
Reviewed-on: https://go-review.googlesource.com/64910
Reviewed-by: Ian Lance Taylor <iant@golang.org>
doc/install.html
src/net/platform_test.go
src/net/sock_bsd.go
src/os/pipe_freebsd.go
src/os/sys_freebsd.go
src/os/wait_wait6.go
src/syscall/exec_freebsd.go
src/syscall/syscall_freebsd.go
src/syscall/zsyscall_freebsd_386.go
src/syscall/zsyscall_freebsd_amd64.go
src/syscall/zsyscall_freebsd_arm.go

index 7f32f68cd324473f598f493dada89c8ce564c05c..abf7fa6daed2ad66fe2867a0f0690c9356b4d4ff 100644 (file)
@@ -16,7 +16,7 @@
 
 <p>
 <a href="https://golang.org/dl/" target="_blank">Official binary
-distributions</a> are available for the FreeBSD (release 8-STABLE and above),
+distributions</a> are available for the FreeBSD (release 10-STABLE and above),
 Linux, Mac OS X (10.8 and above), and Windows operating systems and
 the 32-bit (<code>386</code>) and 64-bit (<code>amd64</code>) x86 processor
 architectures.
@@ -47,7 +47,7 @@ If your OS or architecture is not on the list, you may be able to
 <th align="center">Notes</th>
 </tr>
 <tr><td colspan="3"><hr></td></tr>
-<tr><td>FreeBSD 9.3 or later</td> <td>amd64, 386</td> <td>Debian GNU/kFreeBSD not supported</td></tr>
+<tr><td>FreeBSD 10.3 or later</td> <td>amd64, 386</td> <td>Debian GNU/kFreeBSD not supported</td></tr>
 <tr valign='top'><td>Linux 2.6.23 or later with glibc</td> <td>amd64, 386, arm, arm64,<br>s390x, ppc64le</td> <td>CentOS/RHEL 5.x not supported.<br>Install from source for other libc.</td></tr>
 <tr><td>macOS 10.8 or later</td> <td>amd64</td> <td>use the clang or gcc<sup>&#8224;</sup> that comes with Xcode<sup>&#8225;</sup> for <code>cgo</code> support</td></tr>
 <tr><td>Windows XP SP2 or later</td> <td>amd64, 386</td> <td>use MinGW gcc<sup>&#8224;</sup>. No need for cygwin or msys.</td></tr>
index 2b87bf4d0ae2b3e73c3b69bc44175b9586d52247..eca1202beb200d87c630b38abedd8908b9604faf 100644 (file)
@@ -43,8 +43,6 @@ func testableNetwork(network string) bool {
        case "unixpacket":
                switch runtime.GOOS {
                case "android", "darwin", "nacl", "plan9", "windows":
-                       fallthrough
-               case "freebsd": // FreeBSD 8 and below don't support unixpacket
                        return false
                }
        }
index 4e0e9e01f2c61ba982da4616712c99ec00d38531..dfb092055021f3956311ea93907e667f6dd4367e 100644 (file)
@@ -17,8 +17,10 @@ func maxListenerBacklog() int {
                err error
        )
        switch runtime.GOOS {
-       case "darwin", "freebsd":
+       case "darwin":
                n, err = syscall.SysctlUint32("kern.ipc.somaxconn")
+       case "freebsd":
+               n, err = syscall.SysctlUint32("kern.ipc.acceptqueue")
        case "netbsd":
                // NOTE: NetBSD has no somaxconn-like kernel state so far
        case "openbsd":
index 47983065d922199e1bd9fc31e9160a2711a31b3c..93bd869afd4f3f294c38e10744cd8716a5f380fe 100644 (file)
@@ -13,21 +13,7 @@ func Pipe() (r *File, w *File, err error) {
 
        e := syscall.Pipe2(p[0:], syscall.O_CLOEXEC)
        if e != nil {
-               // Fallback support for FreeBSD 9, which lacks Pipe2.
-               //
-               // TODO: remove this for Go 1.10 when FreeBSD 9
-               // is removed (Issue 19072).
-
-               // See ../syscall/exec.go for description of lock.
-               syscall.ForkLock.RLock()
-               e := syscall.Pipe(p[0:])
-               if e != nil {
-                       syscall.ForkLock.RUnlock()
-                       return nil, nil, NewSyscallError("pipe", e)
-               }
-               syscall.CloseOnExec(p[0])
-               syscall.CloseOnExec(p[1])
-               syscall.ForkLock.RUnlock()
+               return nil, nil, NewSyscallError("pipe", e)
        }
 
        return newFile(uintptr(p[0]), "|0", kindPipe), newFile(uintptr(p[1]), "|1", kindPipe), nil
index 273c2df1c12400d9450c86ad01500562e4c4677d..3ec49faedf10e92fc3d18fe0a4720aa12c9a72ec 100644 (file)
@@ -4,20 +4,7 @@
 
 package os
 
-import "syscall"
-
 // supportsCloseOnExec reports whether the platform supports the
 // O_CLOEXEC flag.
-var supportsCloseOnExec bool
-
-func init() {
-       osrel, err := syscall.SysctlUint32("kern.osreldate")
-       if err != nil {
-               return
-       }
-       // The O_CLOEXEC flag was introduced in FreeBSD 8.3.
-       // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
-       if osrel >= 803000 {
-               supportsCloseOnExec = true
-       }
-}
+// The O_CLOEXEC flag was introduced in FreeBSD 8.3.
+const supportsCloseOnExec bool = true
index b30981199e19f3fe55488944cff5cc29c7439d65..891f242dacd140e00ef939c7719285cfbbdddf69 100644 (file)
@@ -30,11 +30,6 @@ func (p *Process) blockUntilWaitable() (bool, error) {
        }
        runtime.KeepAlive(p)
        if errno != 0 {
-               // The wait6 system call is supported only on FreeBSD
-               // 9.3 and above, so it may return an ENOSYS error.
-               if errno == syscall.ENOSYS {
-                       return false, nil
-               }
                return false, NewSyscallError("wait6", errno)
        }
        return true, nil
index 4ed32c0614fb7d719bf700d3fa97c492b71e9bf8..1654b4ba2a64b7db9e49cd38982af59653701ecc 100644 (file)
@@ -5,21 +5,5 @@
 package syscall
 
 func forkExecPipe(p []int) error {
-       err := Pipe2(p, O_CLOEXEC)
-       if err == nil {
-               return nil
-       }
-
-       // FreeBSD 9 fallback.
-       // TODO: remove this for Go 1.10 per Issue 19072
-       err = Pipe(p)
-       if err != nil {
-               return err
-       }
-       _, err = fcntl(p[0], F_SETFD, FD_CLOEXEC)
-       if err != nil {
-               return err
-       }
-       _, err = fcntl(p[1], F_SETFD, FD_CLOEXEC)
-       return err
+       return Pipe2(p, O_CLOEXEC)
 }
index 2c7533c157c9d85de6499968f4d510c309418305..5fb9655e5a6ac583e41930395275bd837e93ec34 100644 (file)
@@ -66,15 +66,8 @@ func direntNamlen(buf []byte) (uint64, bool) {
        return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
 }
 
-//sysnb pipe() (r int, w int, err error)
-
 func Pipe(p []int) error {
-       if len(p) != 2 {
-               return EINVAL
-       }
-       var err error
-       p[0], p[1], err = pipe()
-       return err
+       return Pipe2(p, 0)
 }
 
 //sysnb pipe2(p *[2]_C_int, flags int) (err error)
index e1d371423cfb4560eb6ab9b9af1951f67d6140a3..4ada995e540f256c57e7c87d6d244d8dec68b73d 100644 (file)
@@ -261,18 +261,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func pipe() (r int, w int, err error) {
-       r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
-       r = int(r0)
-       w = int(r1)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func pipe2(p *[2]_C_int, flags int) (err error) {
        _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
        if e1 != 0 {
index 561870ccce5042adacb90a0982aa39db2647017f..5bbc5c4f34ce93b6076646cf3137031528488528 100644 (file)
@@ -261,18 +261,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func pipe() (r int, w int, err error) {
-       r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
-       r = int(r0)
-       w = int(r1)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func pipe2(p *[2]_C_int, flags int) (err error) {
        _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
        if e1 != 0 {
index cefebb941769b70063b5ffabbd6a9eceeb801b99..011ac0e25a20fffb56618ede64ade8b7652679a1 100644 (file)
@@ -261,18 +261,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func pipe() (r int, w int, err error) {
-       r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
-       r = int(r0)
-       w = int(r1)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func pipe2(p *[2]_C_int, flags int) (err error) {
        _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
        if e1 != 0 {