<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.
<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>†</sup> that comes with Xcode<sup>‡</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>†</sup>. No need for cygwin or msys.</td></tr>
case "unixpacket":
switch runtime.GOOS {
case "android", "darwin", "nacl", "plan9", "windows":
- fallthrough
- case "freebsd": // FreeBSD 8 and below don't support unixpacket
return false
}
}
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":
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
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
}
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
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)
}
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)
// 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 {
// 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 {
// 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 {