Source file src/internal/syscall/unix/nonblocking_libc.go

     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  //go: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)
    25  

View as plain text