Skip to content

Commit

Permalink
chore: merge upstream PR valyala#8 from valyala/tcplisten: z/OS Compa…
Browse files Browse the repository at this point in the history
…tibility
  • Loading branch information
ksw2000 committed Dec 29, 2024
1 parent 9d31554 commit 93114cc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tcplisten/socket.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun
//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun || (zos && s390x)

package tcplisten

Expand Down
19 changes: 19 additions & 0 deletions tcplisten/socket_zos_s390x.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//go:build zos && s390x

package tcplisten

import (
"fmt"

"golang.org/x/sys/unix"
)

func newSocketCloexec(domain, typ, proto int) (int, error) {
fd, err := unix.Socket(domain, typ, proto)
_, err = unix.FcntlInt(uintptr(fd), unix.F_SETFD, unix.FD_CLOEXEC)
_, err = unix.FcntlInt(uintptr(fd), unix.F_SETFL, unix.O_NONBLOCK)
if err == nil {
return fd, nil
}
return -1, fmt.Errorf("cannot create listening unblocked socket: %s", err)
}
2 changes: 1 addition & 1 deletion tcplisten/tcplisten.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun
//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun || (zos && s390x)

// Package tcplisten provides customizable TCP net.Listener with various
// performance-related options:
Expand Down
2 changes: 1 addition & 1 deletion tcplisten/tcplisten_bsd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || rumprun
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || rumprun || (zos && s390x)

package tcplisten

Expand Down

0 comments on commit 93114cc

Please sign in to comment.