mirror of
https://github.com/golang/go.git
synced 2025-11-10 05:31:03 +00:00
net: use syscall.fcntl on libc systems
Should fix the AIX builder. Change-Id: I3498805fb2eee2f0ad50268b5afbbf091c5f6e63 Reviewed-on: https://go-review.googlesource.com/c/go/+/311650 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
0ccdcb2102
commit
fe26dfadc3
3 changed files with 43 additions and 8 deletions
|
|
@ -82,22 +82,22 @@ func TestUnixConnReadMsgUnixSCMRightsCloseOnExec(t *testing.T) {
|
|||
t.Fatalf("got scms = %#v; expected 1 SocketControlMessage", scms)
|
||||
}
|
||||
scm := scms[0]
|
||||
gotFds, err := syscall.ParseUnixRights(&scm)
|
||||
gotFDs, err := syscall.ParseUnixRights(&scm)
|
||||
if err != nil {
|
||||
t.Fatalf("syscall.ParseUnixRights: %v", err)
|
||||
}
|
||||
if len(gotFds) != 1 {
|
||||
t.Fatalf("got FDs %#v: wanted only 1 fd", gotFds)
|
||||
if len(gotFDs) != 1 {
|
||||
t.Fatalf("got FDs %#v: wanted only 1 fd", gotFDs)
|
||||
}
|
||||
defer func() {
|
||||
if err := syscall.Close(int(gotFds[0])); err != nil {
|
||||
t.Fatalf("fail to close gotFds: %v", err)
|
||||
if err := syscall.Close(gotFDs[0]); err != nil {
|
||||
t.Fatalf("fail to close gotFDs: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
flags, _, errno := syscall.Syscall(syscall.SYS_FCNTL, uintptr(gotFds[0]), uintptr(syscall.F_GETFD), 0)
|
||||
if errno != 0 {
|
||||
t.Fatalf("Can't get flags of fd:%#v, with err:%v", gotFds[0], errno)
|
||||
flags, err := fcntl(gotFDs[0], syscall.F_GETFD, 0)
|
||||
if err != nil {
|
||||
t.Fatalf("Can't get flags of fd:%#v, with err:%v", gotFDs[0], err)
|
||||
}
|
||||
if flags&syscall.FD_CLOEXEC == 0 {
|
||||
t.Fatalf("got flags %#x, want %#x (FD_CLOEXEC) set", flags, syscall.FD_CLOEXEC)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue