github.com/sandwichdev/go-internals@v0.0.0-20210605002614-12311ac6b2c5/syscall/unix/nonblocking_libc.go (about) 1 // Copyright 2018 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 // +build aix darwin solaris 6 7 package unix 8 9 import ( 10 "syscall" 11 _ "unsafe" // for go:linkname 12 ) 13 14 func IsNonblock(fd int) (nonblocking bool, err error) { 15 flag, e1 := fcntl(fd, syscall.F_GETFL, 0) 16 if e1 != nil { 17 return false, e1 18 } 19 return flag&syscall.O_NONBLOCK != 0, nil 20 } 21 22 // Implemented in the syscall package. 23 //go:linkname fcntl syscall.fcntl 24 func fcntl(fd int, cmd int, arg int) (int, error)