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
7package unix
8
9import "syscall"
10
11func 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
19func HasNonblockFlag(flag int) bool {
20	return flag&syscall.O_NONBLOCK != 0
21}
22