Path: blob/main/vendor/golang.org/x/sys/unix/fdset.go
2880 views
// Copyright 2019 The Go Authors. All rights reserved.1// Use of this source code is governed by a BSD-style2// license that can be found in the LICENSE file.34//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos56package unix78// Set adds fd to the set fds.9func (fds *FdSet) Set(fd int) {10fds.Bits[fd/NFDBITS] |= (1 << (uintptr(fd) % NFDBITS))11}1213// Clear removes fd from the set fds.14func (fds *FdSet) Clear(fd int) {15fds.Bits[fd/NFDBITS] &^= (1 << (uintptr(fd) % NFDBITS))16}1718// IsSet returns whether fd is in the set fds.19func (fds *FdSet) IsSet(fd int) bool {20return fds.Bits[fd/NFDBITS]&(1<<(uintptr(fd)%NFDBITS)) != 021}2223// Zero clears the set fds.24func (fds *FdSet) Zero() {25clear(fds.Bits[:])26}272829