mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-15 09:43:01 -06: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
90
vendor/github.com/cilium/ebpf/link/iter.go
generated
vendored
90
vendor/github.com/cilium/ebpf/link/iter.go
generated
vendored
|
|
@ -3,8 +3,10 @@ package link
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"unsafe"
|
||||
|
||||
"github.com/cilium/ebpf"
|
||||
"github.com/cilium/ebpf/internal/sys"
|
||||
)
|
||||
|
||||
type IterOptions struct {
|
||||
|
|
@ -15,77 +17,69 @@ type IterOptions struct {
|
|||
// AttachTo requires the kernel to include BTF of itself,
|
||||
// and it to be compiled with a recent pahole (>= 1.16).
|
||||
Program *ebpf.Program
|
||||
|
||||
// Map specifies the target map for bpf_map_elem and sockmap iterators.
|
||||
// It may be nil.
|
||||
Map *ebpf.Map
|
||||
}
|
||||
|
||||
// AttachIter attaches a BPF seq_file iterator.
|
||||
func AttachIter(opts IterOptions) (*Iter, error) {
|
||||
link, err := AttachRawLink(RawLinkOptions{
|
||||
Program: opts.Program,
|
||||
Attach: ebpf.AttachTraceIter,
|
||||
})
|
||||
if err := haveBPFLink(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
progFd := opts.Program.FD()
|
||||
if progFd < 0 {
|
||||
return nil, fmt.Errorf("invalid program: %s", sys.ErrClosedFd)
|
||||
}
|
||||
|
||||
var info bpfIterLinkInfoMap
|
||||
if opts.Map != nil {
|
||||
mapFd := opts.Map.FD()
|
||||
if mapFd < 0 {
|
||||
return nil, fmt.Errorf("invalid map: %w", sys.ErrClosedFd)
|
||||
}
|
||||
info.map_fd = uint32(mapFd)
|
||||
}
|
||||
|
||||
attr := sys.LinkCreateIterAttr{
|
||||
ProgFd: uint32(progFd),
|
||||
AttachType: sys.AttachType(ebpf.AttachTraceIter),
|
||||
IterInfo: sys.NewPointer(unsafe.Pointer(&info)),
|
||||
IterInfoLen: uint32(unsafe.Sizeof(info)),
|
||||
}
|
||||
|
||||
fd, err := sys.LinkCreateIter(&attr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't link iterator: %w", err)
|
||||
}
|
||||
|
||||
return &Iter{link}, err
|
||||
}
|
||||
|
||||
// LoadPinnedIter loads a pinned iterator from a bpffs.
|
||||
func LoadPinnedIter(fileName string) (*Iter, error) {
|
||||
link, err := LoadPinnedRawLink(fileName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Iter{link}, err
|
||||
return &Iter{RawLink{fd, ""}}, err
|
||||
}
|
||||
|
||||
// Iter represents an attached bpf_iter.
|
||||
type Iter struct {
|
||||
link *RawLink
|
||||
}
|
||||
|
||||
var _ Link = (*Iter)(nil)
|
||||
|
||||
func (it *Iter) isLink() {}
|
||||
|
||||
// FD returns the underlying file descriptor.
|
||||
func (it *Iter) FD() int {
|
||||
return it.link.FD()
|
||||
}
|
||||
|
||||
// Close implements Link.
|
||||
func (it *Iter) Close() error {
|
||||
return it.link.Close()
|
||||
}
|
||||
|
||||
// Pin implements Link.
|
||||
func (it *Iter) Pin(fileName string) error {
|
||||
return it.link.Pin(fileName)
|
||||
}
|
||||
|
||||
// Update implements Link.
|
||||
func (it *Iter) Update(new *ebpf.Program) error {
|
||||
return it.link.Update(new)
|
||||
RawLink
|
||||
}
|
||||
|
||||
// Open creates a new instance of the iterator.
|
||||
//
|
||||
// Reading from the returned reader triggers the BPF program.
|
||||
func (it *Iter) Open() (io.ReadCloser, error) {
|
||||
linkFd, err := it.link.fd.Value()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
attr := &sys.IterCreateAttr{
|
||||
LinkFd: it.fd.Uint(),
|
||||
}
|
||||
|
||||
attr := &bpfIterCreateAttr{
|
||||
linkFd: linkFd,
|
||||
}
|
||||
|
||||
fd, err := bpfIterCreate(attr)
|
||||
fd, err := sys.IterCreate(attr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't create iterator: %w", err)
|
||||
}
|
||||
|
||||
return fd.File("bpf_iter"), nil
|
||||
}
|
||||
|
||||
// union bpf_iter_link_info.map
|
||||
type bpfIterLinkInfoMap struct {
|
||||
map_fd uint32
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue