...

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

Documentation: internal/syscall/unix

     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 unix
     6  
     7  package unix
     8  
     9  import "syscall"
    10  
    11  func IsNonblock(fd int) (nonblocking bool, err error) {
    12  	flag, e1 := Fcntl(fd, syscall.F_GETFL, 0)
    13  	if e1 != nil {
    14  		return false, e1
    15  	}
    16  	return flag&syscall.O_NONBLOCK != 0, nil
    17  }
    18  
    19  func HasNonblockFlag(flag int) bool {
    20  	return flag&syscall.O_NONBLOCK != 0
    21  }
    22  

View as plain text