summaryrefslogtreecommitdiff
path: root/vendor/github.com/cilium/ebpf/link/syscalls.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2025-02-03 10:12:35 +0000
committerLibravatar GitHub <noreply@github.com>2025-02-03 10:12:35 +0000
commitc086d4048c2a26a0bf70c1ced24c78680a786710 (patch)
treecf7606e8452e9047d7f0e0d9b6de10edf7ebdc89 /vendor/github.com/cilium/ebpf/link/syscalls.go
parent[chore]: Bump golang.org/x/oauth2 from 0.24.0 to 0.25.0 (#3725) (diff)
downloadgotosocial-c086d4048c2a26a0bf70c1ced24c78680a786710.tar.xz
[chore]: Bump github.com/KimMachineGun/automemlimit from 0.6.1 to 0.7.0 (#3726)
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.6.1 to 0.7.0. - [Release notes](https://github.com/KimMachineGun/automemlimit/releases) - [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.6.1...v0.7.0) --- updated-dependencies: - dependency-name: github.com/KimMachineGun/automemlimit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/cilium/ebpf/link/syscalls.go')
-rw-r--r--vendor/github.com/cilium/ebpf/link/syscalls.go103
1 files changed, 0 insertions, 103 deletions
diff --git a/vendor/github.com/cilium/ebpf/link/syscalls.go b/vendor/github.com/cilium/ebpf/link/syscalls.go
deleted file mode 100644
index a661395b3..000000000
--- a/vendor/github.com/cilium/ebpf/link/syscalls.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package link
-
-import (
- "errors"
-
- "github.com/cilium/ebpf"
- "github.com/cilium/ebpf/asm"
- "github.com/cilium/ebpf/internal"
- "github.com/cilium/ebpf/internal/sys"
- "github.com/cilium/ebpf/internal/unix"
-)
-
-// Type is the kind of link.
-type Type = sys.LinkType
-
-// Valid link types.
-const (
- UnspecifiedType = sys.BPF_LINK_TYPE_UNSPEC
- RawTracepointType = sys.BPF_LINK_TYPE_RAW_TRACEPOINT
- TracingType = sys.BPF_LINK_TYPE_TRACING
- CgroupType = sys.BPF_LINK_TYPE_CGROUP
- IterType = sys.BPF_LINK_TYPE_ITER
- NetNsType = sys.BPF_LINK_TYPE_NETNS
- XDPType = sys.BPF_LINK_TYPE_XDP
- PerfEventType = sys.BPF_LINK_TYPE_PERF_EVENT
-)
-
-var haveProgAttach = internal.FeatureTest("BPF_PROG_ATTACH", "4.10", func() error {
- prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{
- Type: ebpf.CGroupSKB,
- License: "MIT",
- Instructions: asm.Instructions{
- asm.Mov.Imm(asm.R0, 0),
- asm.Return(),
- },
- })
- if err != nil {
- return internal.ErrNotSupported
- }
-
- // BPF_PROG_ATTACH was introduced at the same time as CGgroupSKB,
- // so being able to load the program is enough to infer that we
- // have the syscall.
- prog.Close()
- return nil
-})
-
-var haveProgAttachReplace = internal.FeatureTest("BPF_PROG_ATTACH atomic replacement", "5.5", func() error {
- if err := haveProgAttach(); err != nil {
- return err
- }
-
- prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{
- Type: ebpf.CGroupSKB,
- AttachType: ebpf.AttachCGroupInetIngress,
- License: "MIT",
- Instructions: asm.Instructions{
- asm.Mov.Imm(asm.R0, 0),
- asm.Return(),
- },
- })
- if err != nil {
- return internal.ErrNotSupported
- }
- defer prog.Close()
-
- // We know that we have BPF_PROG_ATTACH since we can load CGroupSKB programs.
- // If passing BPF_F_REPLACE gives us EINVAL we know that the feature isn't
- // present.
- attr := sys.ProgAttachAttr{
- // We rely on this being checked after attachFlags.
- TargetFd: ^uint32(0),
- AttachBpfFd: uint32(prog.FD()),
- AttachType: uint32(ebpf.AttachCGroupInetIngress),
- AttachFlags: uint32(flagReplace),
- }
-
- err = sys.ProgAttach(&attr)
- if errors.Is(err, unix.EINVAL) {
- return internal.ErrNotSupported
- }
- if errors.Is(err, unix.EBADF) {
- return nil
- }
- return err
-})
-
-var haveBPFLink = internal.FeatureTest("bpf_link", "5.7", func() error {
- attr := sys.LinkCreateAttr{
- // This is a hopefully invalid file descriptor, which triggers EBADF.
- TargetFd: ^uint32(0),
- ProgFd: ^uint32(0),
- AttachType: sys.AttachType(ebpf.AttachCGroupInetIngress),
- }
- _, err := sys.LinkCreate(&attr)
- if errors.Is(err, unix.EINVAL) {
- return internal.ErrNotSupported
- }
- if errors.Is(err, unix.EBADF) {
- return nil
- }
- return err
-})