mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-25 16:53:19 +01:00
b962d7d791
Signed-off-by: Brady OBrien <brady.obrien128@gmail.com>
23 lines
486 B
Go
23 lines
486 B
Go
/* SPDX-License-Identifier: GPL-2.0
|
|
*
|
|
* Copyright (C) 2017-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
|
*/
|
|
|
|
package rwcancel
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
type fdSet struct {
|
|
fdset unix.FdSet
|
|
}
|
|
|
|
func (fdset *fdSet) set(i int) {
|
|
bits := 32 << (^uint(0) >> 63)
|
|
fdset.fdset.X__fds_bits[i/bits] |= 1 << uint(i%bits)
|
|
}
|
|
|
|
func (fdset *fdSet) check(i int) bool {
|
|
bits := 32 << (^uint(0) >> 63)
|
|
return (fdset.fdset.X__fds_bits[i/bits] & (1 << uint(i%bits))) != 0
|
|
}
|