8000 unix: add Connectx for darwin · golang/sys@88c1a14 · GitHub
[go: up one dir, main page]

Skip to content

Commit 88c1a14

Browse files
committed
unix: add Connectx for darwin
connectx(2) can be used to open TCP sockets with TCP Fast Open.
1 parent da77c6b commit 88c1a14

13 files changed

+97
-0
lines changed

unix/darwin_amd64_test.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/darwin_arm64_test.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/mkerrors.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ ccflags="$@"
552552
$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
553553
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
554554
$2 ~ /^SOCK_|SK_DIAG_|SKNLGRP_$/ ||
555+
$2 ~ /^(CONNECT|SAE)_/ ||
555556
$2 ~ /^FIORDCHK$/ ||
556557
$2 ~ /^SIOC/ ||
557558
$2 ~ /^TIOC/ ||

unix/syscall_darwin.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,16 @@ func PthreadFchdir(fd int) (err error) {
566566
return pthread_fchdir_np(fd)
567567
}
568568

569+
func Connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, connid *SaeConnID) (n uint, err error) {
570+
var iovp *Iovec
571+
if len(iov) > 0 {
572+
iovp = &iov[0]
573+
}
574+
err = connectx(fd, endpoints, associd, flags, iovp, uint32(len(iov)), &n, connid)
575+
return
576+
}
577+
578+
//sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov *Iovec, iovcnt uint32, len *uint, connid *SaeConnID) (err error)
569579
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
570580

571581
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)

unix/types_darwin.go

Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ type XVSockPgen C.struct_xvsockpgen
177177

178178
type _Socklen C.socklen_t
179179

180+
type SaeAssocID C.sae_associd_t
181+
182+
type SaeConnID C.sae_connid_t
183+
184+
type SaEndpoints C.struct_sa_endpoints
185+
180186
type Xucred C.struct_xucred
181187

182188
type Linger C.struct_linger

unix/zerrors_darwin_amd64.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zerrors_darwin_arm64.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_amd64.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_amd64.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0
248248
GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8
249249
DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB)
250250

251+
TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0
252+
JMP libc_connectx(SB)
253+
GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8
254+
DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB)
255+
251256
TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
252257
JMP libc_sendfile(SB)
253258
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8

unix/zsyscall_darwin_arm64.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0