Debian Codegraph @

internal/testutils/fd_other.go

raw symbols SCIP
1 //go:build !windows
2
3 package testutils
4
5 import (
6 "testing"
7
8 "github.com/go-quicktest/qt"
9
10 "github.com/cilium/ebpf/internal/unix"
11 )
12
13 func DupFD(tb testing.TB, fd int) int {
14 tb.Helper()
15
16 dup, err := unix.FcntlInt(uintptr(fd), unix.F_DUPFD_CLOEXEC, 1)
17 qt.Assert(tb, qt.IsNil(err))
18
19 return dup
20 }