github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/audit/seccomp/tracer/auditseccomp_x86_bpfel.go (about)

     1  // Code generated by bpf2go; DO NOT EDIT.
     2  //go:build 386 || amd64
     3  
     4  package tracer
     5  
     6  import (
     7  	"bytes"
     8  	_ "embed"
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/cilium/ebpf"
    13  )
    14  
    15  type auditseccompEvent struct {
    16  	Pid       uint64
    17  	MntnsId   uint64
    18  	Timestamp uint64
    19  	Syscall   uint64
    20  	Code      uint64
    21  	Comm      [16]uint8
    22  }
    23  
    24  // loadAuditseccomp returns the embedded CollectionSpec for auditseccomp.
    25  func loadAuditseccomp() (*ebpf.CollectionSpec, error) {
    26  	reader := bytes.NewReader(_AuditseccompBytes)
    27  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    28  	if err != nil {
    29  		return nil, fmt.Errorf("can't load auditseccomp: %w", err)
    30  	}
    31  
    32  	return spec, err
    33  }
    34  
    35  // loadAuditseccompObjects loads auditseccomp and converts it into a struct.
    36  //
    37  // The following types are suitable as obj argument:
    38  //
    39  //	*auditseccompObjects
    40  //	*auditseccompPrograms
    41  //	*auditseccompMaps
    42  //
    43  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    44  func loadAuditseccompObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    45  	spec, err := loadAuditseccomp()
    46  	if err != nil {
    47  		return err
    48  	}
    49  
    50  	return spec.LoadAndAssign(obj, opts)
    51  }
    52  
    53  // auditseccompSpecs contains maps and programs before they are loaded into the kernel.
    54  //
    55  // It can be passed ebpf.CollectionSpec.Assign.
    56  type auditseccompSpecs struct {
    57  	auditseccompProgramSpecs
    58  	auditseccompMapSpecs
    59  }
    60  
    61  // auditseccompSpecs contains programs before they are loaded into the kernel.
    62  //
    63  // It can be passed ebpf.CollectionSpec.Assign.
    64  type auditseccompProgramSpecs struct {
    65  	IgAuditSecc *ebpf.ProgramSpec `ebpf:"ig_audit_secc"`
    66  }
    67  
    68  // auditseccompMapSpecs contains maps before they are loaded into the kernel.
    69  //
    70  // It can be passed ebpf.CollectionSpec.Assign.
    71  type auditseccompMapSpecs struct {
    72  	Events               *ebpf.MapSpec `ebpf:"events"`
    73  	GadgetMntnsFilterMap *ebpf.MapSpec `ebpf:"gadget_mntns_filter_map"`
    74  	TmpEvent             *ebpf.MapSpec `ebpf:"tmp_event"`
    75  }
    76  
    77  // auditseccompObjects contains all objects after they have been loaded into the kernel.
    78  //
    79  // It can be passed to loadAuditseccompObjects or ebpf.CollectionSpec.LoadAndAssign.
    80  type auditseccompObjects struct {
    81  	auditseccompPrograms
    82  	auditseccompMaps
    83  }
    84  
    85  func (o *auditseccompObjects) Close() error {
    86  	return _AuditseccompClose(
    87  		&o.auditseccompPrograms,
    88  		&o.auditseccompMaps,
    89  	)
    90  }
    91  
    92  // auditseccompMaps contains all maps after they have been loaded into the kernel.
    93  //
    94  // It can be passed to loadAuditseccompObjects or ebpf.CollectionSpec.LoadAndAssign.
    95  type auditseccompMaps struct {
    96  	Events               *ebpf.Map `ebpf:"events"`
    97  	GadgetMntnsFilterMap *ebpf.Map `ebpf:"gadget_mntns_filter_map"`
    98  	TmpEvent             *ebpf.Map `ebpf:"tmp_event"`
    99  }
   100  
   101  func (m *auditseccompMaps) Close() error {
   102  	return _AuditseccompClose(
   103  		m.Events,
   104  		m.GadgetMntnsFilterMap,
   105  		m.TmpEvent,
   106  	)
   107  }
   108  
   109  // auditseccompPrograms contains all programs after they have been loaded into the kernel.
   110  //
   111  // It can be passed to loadAuditseccompObjects or ebpf.CollectionSpec.LoadAndAssign.
   112  type auditseccompPrograms struct {
   113  	IgAuditSecc *ebpf.Program `ebpf:"ig_audit_secc"`
   114  }
   115  
   116  func (p *auditseccompPrograms) Close() error {
   117  	return _AuditseccompClose(
   118  		p.IgAuditSecc,
   119  	)
   120  }
   121  
   122  func _AuditseccompClose(closers ...io.Closer) error {
   123  	for _, closer := range closers {
   124  		if err := closer.Close(); err != nil {
   125  			return err
   126  		}
   127  	}
   128  	return nil
   129  }
   130  
   131  // Do not access this directly.
   132  //
   133  //go:embed auditseccomp_x86_bpfel.o
   134  var _AuditseccompBytes []byte