diff options
| author | Rutger Broekhoff | 2023-12-29 21:31:53 +0100 | 
|---|---|---|
| committer | Rutger Broekhoff | 2023-12-29 21:31:53 +0100 | 
| commit | 404aeae4545d2426c089a5f8d5e82dae56f5212b (patch) | |
| tree | 2d84e00af272b39fc04f3795ae06bc48970e57b5 /vendor/golang.org/x/sys/unix/fdset.go | |
| parent | 209d8b0187ed025dec9ac149ebcced3462877bff (diff) | |
| download | gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.tar.gz gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.zip | |
Make Nix builds work
Diffstat (limited to 'vendor/golang.org/x/sys/unix/fdset.go')
| -rw-r--r-- | vendor/golang.org/x/sys/unix/fdset.go | 29 | 
1 files changed, 29 insertions, 0 deletions
| diff --git a/vendor/golang.org/x/sys/unix/fdset.go b/vendor/golang.org/x/sys/unix/fdset.go new file mode 100644 index 0000000..9e83d18 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/fdset.go | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | // Copyright 2019 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 || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos | ||
| 6 | |||
| 7 | package unix | ||
| 8 | |||
| 9 | // Set adds fd to the set fds. | ||
| 10 | func (fds *FdSet) Set(fd int) { | ||
| 11 | fds.Bits[fd/NFDBITS] |= (1 << (uintptr(fd) % NFDBITS)) | ||
| 12 | } | ||
| 13 | |||
| 14 | // Clear removes fd from the set fds. | ||
| 15 | func (fds *FdSet) Clear(fd int) { | ||
| 16 | fds.Bits[fd/NFDBITS] &^= (1 << (uintptr(fd) % NFDBITS)) | ||
| 17 | } | ||
| 18 | |||
| 19 | // IsSet returns whether fd is in the set fds. | ||
| 20 | func (fds *FdSet) IsSet(fd int) bool { | ||
| 21 | return fds.Bits[fd/NFDBITS]&(1<<(uintptr(fd)%NFDBITS)) != 0 | ||
| 22 | } | ||
| 23 | |||
| 24 | // Zero clears the set fds. | ||
| 25 | func (fds *FdSet) Zero() { | ||
| 26 | for i := range fds.Bits { | ||
| 27 | fds.Bits[i] = 0 | ||
| 28 | } | ||
| 29 | } | ||