accept.go 419 B

12345678910111213141516171819202122
  1. //+build !freebsd,!linux
  2. package socket
  3. import (
  4. "fmt"
  5. "runtime"
  6. "golang.org/x/sys/unix"
  7. )
  8. const sysAccept = "accept"
  9. // accept wraps accept(2).
  10. func accept(fd, flags int) (int, unix.Sockaddr, error) {
  11. if flags != 0 {
  12. // These operating systems have no support for flags to accept(2).
  13. return 0, nil, fmt.Errorf("socket: Conn.Accept flags are ineffective on %s", runtime.GOOS)
  14. }
  15. return unix.Accept(fd)
  16. }