mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-30 16:52:25 -05:00
[chore]: Bump github.com/KimMachineGun/automemlimit from 0.2.4 to 0.2.5 (#1666)
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.2.4 to 0.2.5. - [Release notes](https://github.com/KimMachineGun/automemlimit/releases) - [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.2.4...v0.2.5) --- updated-dependencies: - dependency-name: github.com/KimMachineGun/automemlimit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
3f9b2336c0
commit
57dc742c76
200 changed files with 16392 additions and 38190 deletions
108
vendor/github.com/cilium/ebpf/link/syscalls.go
generated
vendored
108
vendor/github.com/cilium/ebpf/link/syscalls.go
generated
vendored
|
|
@ -2,35 +2,33 @@ package link
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"unsafe"
|
||||
|
||||
"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 uint32
|
||||
type Type = sys.LinkType
|
||||
|
||||
// Valid link types.
|
||||
//
|
||||
// Equivalent to enum bpf_link_type.
|
||||
const (
|
||||
UnspecifiedType Type = iota
|
||||
RawTracepointType
|
||||
TracingType
|
||||
CgroupType
|
||||
IterType
|
||||
NetNsType
|
||||
XDPType
|
||||
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,
|
||||
AttachType: ebpf.AttachCGroupInetIngress,
|
||||
License: "MIT",
|
||||
Type: ebpf.CGroupSKB,
|
||||
License: "MIT",
|
||||
Instructions: asm.Instructions{
|
||||
asm.Mov.Imm(asm.R0, 0),
|
||||
asm.Return(),
|
||||
|
|
@ -69,7 +67,7 @@ var haveProgAttachReplace = internal.FeatureTest("BPF_PROG_ATTACH atomic replace
|
|||
// 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 := internal.BPFProgAttachAttr{
|
||||
attr := sys.ProgAttachAttr{
|
||||
// We rely on this being checked after attachFlags.
|
||||
TargetFd: ^uint32(0),
|
||||
AttachBpfFd: uint32(prog.FD()),
|
||||
|
|
@ -77,7 +75,7 @@ var haveProgAttachReplace = internal.FeatureTest("BPF_PROG_ATTACH atomic replace
|
|||
AttachFlags: uint32(flagReplace),
|
||||
}
|
||||
|
||||
err = internal.BPFProgAttach(&attr)
|
||||
err = sys.ProgAttach(&attr)
|
||||
if errors.Is(err, unix.EINVAL) {
|
||||
return internal.ErrNotSupported
|
||||
}
|
||||
|
|
@ -87,55 +85,14 @@ var haveProgAttachReplace = internal.FeatureTest("BPF_PROG_ATTACH atomic replace
|
|||
return err
|
||||
})
|
||||
|
||||
type bpfLinkCreateAttr struct {
|
||||
progFd uint32
|
||||
targetFd uint32
|
||||
attachType ebpf.AttachType
|
||||
flags uint32
|
||||
}
|
||||
|
||||
func bpfLinkCreate(attr *bpfLinkCreateAttr) (*internal.FD, error) {
|
||||
ptr, err := internal.BPF(internal.BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return internal.NewFD(uint32(ptr)), nil
|
||||
}
|
||||
|
||||
type bpfLinkUpdateAttr struct {
|
||||
linkFd uint32
|
||||
newProgFd uint32
|
||||
flags uint32
|
||||
oldProgFd uint32
|
||||
}
|
||||
|
||||
func bpfLinkUpdate(attr *bpfLinkUpdateAttr) error {
|
||||
_, err := internal.BPF(internal.BPF_LINK_UPDATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr))
|
||||
return err
|
||||
}
|
||||
|
||||
var haveBPFLink = internal.FeatureTest("bpf_link", "5.7", func() error {
|
||||
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()
|
||||
|
||||
attr := bpfLinkCreateAttr{
|
||||
attr := sys.LinkCreateAttr{
|
||||
// This is a hopefully invalid file descriptor, which triggers EBADF.
|
||||
targetFd: ^uint32(0),
|
||||
progFd: uint32(prog.FD()),
|
||||
attachType: ebpf.AttachCGroupInetIngress,
|
||||
TargetFd: ^uint32(0),
|
||||
ProgFd: ^uint32(0),
|
||||
AttachType: sys.AttachType(ebpf.AttachCGroupInetIngress),
|
||||
}
|
||||
_, err = bpfLinkCreate(&attr)
|
||||
_, err := sys.LinkCreate(&attr)
|
||||
if errors.Is(err, unix.EINVAL) {
|
||||
return internal.ErrNotSupported
|
||||
}
|
||||
|
|
@ -144,30 +101,3 @@ var haveBPFLink = internal.FeatureTest("bpf_link", "5.7", func() error {
|
|||
}
|
||||
return err
|
||||
})
|
||||
|
||||
type bpfIterCreateAttr struct {
|
||||
linkFd uint32
|
||||
flags uint32
|
||||
}
|
||||
|
||||
func bpfIterCreate(attr *bpfIterCreateAttr) (*internal.FD, error) {
|
||||
ptr, err := internal.BPF(internal.BPF_ITER_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr))
|
||||
if err == nil {
|
||||
return internal.NewFD(uint32(ptr)), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
type bpfRawTracepointOpenAttr struct {
|
||||
name internal.Pointer
|
||||
fd uint32
|
||||
_ uint32
|
||||
}
|
||||
|
||||
func bpfRawTracepointOpen(attr *bpfRawTracepointOpenAttr) (*internal.FD, error) {
|
||||
ptr, err := internal.BPF(internal.BPF_RAW_TRACEPOINT_OPEN, unsafe.Pointer(attr), unsafe.Sizeof(*attr))
|
||||
if err == nil {
|
||||
return internal.NewFD(uint32(ptr)), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue