Skip to content

Commit

Permalink
Add GetProgramSpecs
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Nov 29, 2023
1 parent 5ac7854 commit 6318200
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,17 @@ func (m *Manager) GetPrograms() (map[string]*ebpf.Program, error) {
return maps.Clone(m.collection.Programs), nil
}

// GetProgramSpecs - Return the list of eBPF program specs in the manager
func (m *Manager) GetProgramSpecs() (map[string]*ebpf.ProgramSpec, error) {
m.stateLock.RLock()
defer m.stateLock.RUnlock()
if m.collectionSpec == nil || m.state < initialized {
return nil, ErrManagerNotInitialized
}

return maps.Clone(m.collectionSpec.Programs), nil
}

// getProgramSpec - Thread unsafe version of GetProgramSpec
func (m *Manager) getProgramSpec(id ProbeIdentificationPair) ([]*ebpf.ProgramSpec, bool, error) {
var programs []*ebpf.ProgramSpec
Expand Down

0 comments on commit 6318200

Please sign in to comment.