1// Copyright 2009 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// This file provides the Accept function used on all systems
6// other than arm. See syscall_linux_accept.go for why.
7
8//go:build linux && !arm
9
10package syscall
11
12func Accept(fd int) (nfd int, sa Sockaddr, err error) {
13	var rsa RawSockaddrAny
14	var len _Socklen = SizeofSockaddrAny
15	nfd, err = accept4(fd, &rsa, &len, 0)
16	if err != nil {
17		return
18	}
19	sa, err = anyToSockaddr(&rsa)
20	if err != nil {
21		Close(nfd)
22		nfd = 0
23	}
24	return
25}
26