Skip to content

Commit fe196a0

Browse files
tklausergopherbot
authored andcommitted
syscall: remove cloexecSocket fallback path
Support for Linux kernel versions requiring the fallback to CloseOnExec was dropped from recent Go versions. The minimum Linux kernel version is 2.6.32 as of Go 1.18. The SOCK_CLOEXEC flag for the socket syscall is supported since kernel version 2.6.27. Follows a similar change for net.sysSocket in CL 403634. For #45964 Change-Id: I8b6311f07c4ed7900a9af3ecb2e146c49db08665 Reviewed-on: https://go-review.googlesource.com/c/go/+/422374 Reviewed-by: Joedian Reid <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Tobias Klauser <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Tobias Klauser <[email protected]>
1 parent 5729419 commit fe196a0

File tree

3 files changed

+2
-31
lines changed

3 files changed

+2
-31
lines changed

src/syscall/lsf_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type iflags struct {
4848

4949
// Deprecated: Use golang.org/x/net/bpf instead.
5050
func SetLsfPromisc(name string, m bool) error {
51-
s, e := cloexecSocket(AF_INET, SOCK_DGRAM, 0)
51+
s, e := Socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0)
5252
if e != nil {
5353
return e
5454
}

src/syscall/netlink_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func newNetlinkRouteRequest(proto, seq, family int) []byte {
5050
// NetlinkRIB returns routing information base, as known as RIB, which
5151
// consists of network facility information, states and parameters.
5252
func NetlinkRIB(proto, family int) ([]byte, error) {
53-
s, err := cloexecSocket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)
53+
s, err := Socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_ROUTE)
5454
if err != nil {
5555
return nil, err
5656
}

src/syscall/sock_cloexec_linux.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)