github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/container-hook/execruntime_x86_bpfel.go (about)

     1  // Code generated by bpf2go; DO NOT EDIT.
     2  //go:build 386 || amd64
     3  
     4  package containerhook
     5  
     6  import (
     7  	"bytes"
     8  	_ "embed"
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/cilium/ebpf"
    13  )
    14  
    15  type execruntimeRecord struct {
    16  	Pid        uint32
    17  	ArgsSize   uint32
    18  	CallerComm [16]uint8
    19  	Args       [15360]uint8
    20  }
    21  
    22  // loadExecruntime returns the embedded CollectionSpec for execruntime.
    23  func loadExecruntime() (*ebpf.CollectionSpec, error) {
    24  	reader := bytes.NewReader(_ExecruntimeBytes)
    25  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    26  	if err != nil {
    27  		return nil, fmt.Errorf("can't load execruntime: %w", err)
    28  	}
    29  
    30  	return spec, err
    31  }
    32  
    33  // loadExecruntimeObjects loads execruntime and converts it into a struct.
    34  //
    35  // The following types are suitable as obj argument:
    36  //
    37  //	*execruntimeObjects
    38  //	*execruntimePrograms
    39  //	*execruntimeMaps
    40  //
    41  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    42  func loadExecruntimeObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    43  	spec, err := loadExecruntime()
    44  	if err != nil {
    45  		return err
    46  	}
    47  
    48  	return spec.LoadAndAssign(obj, opts)
    49  }
    50  
    51  // execruntimeSpecs contains maps and programs before they are loaded into the kernel.
    52  //
    53  // It can be passed ebpf.CollectionSpec.Assign.
    54  type execruntimeSpecs struct {
    55  	execruntimeProgramSpecs
    56  	execruntimeMapSpecs
    57  }
    58  
    59  // execruntimeSpecs contains programs before they are loaded into the kernel.
    60  //
    61  // It can be passed ebpf.CollectionSpec.Assign.
    62  type execruntimeProgramSpecs struct {
    63  	IgExecveE *ebpf.ProgramSpec `ebpf:"ig_execve_e"`
    64  	IgExecveX *ebpf.ProgramSpec `ebpf:"ig_execve_x"`
    65  	IgFaPickE *ebpf.ProgramSpec `ebpf:"ig_fa_pick_e"`
    66  	IgFaPickX *ebpf.ProgramSpec `ebpf:"ig_fa_pick_x"`
    67  }
    68  
    69  // execruntimeMapSpecs contains maps before they are loaded into the kernel.
    70  //
    71  // It can be passed ebpf.CollectionSpec.Assign.
    72  type execruntimeMapSpecs struct {
    73  	ExecArgs    *ebpf.MapSpec `ebpf:"exec_args"`
    74  	IgFaPickCtx *ebpf.MapSpec `ebpf:"ig_fa_pick_ctx"`
    75  	IgFaRecords *ebpf.MapSpec `ebpf:"ig_fa_records"`
    76  	PidByTgid   *ebpf.MapSpec `ebpf:"pid_by_tgid"`
    77  }
    78  
    79  // execruntimeObjects contains all objects after they have been loaded into the kernel.
    80  //
    81  // It can be passed to loadExecruntimeObjects or ebpf.CollectionSpec.LoadAndAssign.
    82  type execruntimeObjects struct {
    83  	execruntimePrograms
    84  	execruntimeMaps
    85  }
    86  
    87  func (o *execruntimeObjects) Close() error {
    88  	return _ExecruntimeClose(
    89  		&o.execruntimePrograms,
    90  		&o.execruntimeMaps,
    91  	)
    92  }
    93  
    94  // execruntimeMaps contains all maps after they have been loaded into the kernel.
    95  //
    96  // It can be passed to loadExecruntimeObjects or ebpf.CollectionSpec.LoadAndAssign.
    97  type execruntimeMaps struct {
    98  	ExecArgs    *ebpf.Map `ebpf:"exec_args"`
    99  	IgFaPickCtx *ebpf.Map `ebpf:"ig_fa_pick_ctx"`
   100  	IgFaRecords *ebpf.Map `ebpf:"ig_fa_records"`
   101  	PidByTgid   *ebpf.Map `ebpf:"pid_by_tgid"`
   102  }
   103  
   104  func (m *execruntimeMaps) Close() error {
   105  	return _ExecruntimeClose(
   106  		m.ExecArgs,
   107  		m.IgFaPickCtx,
   108  		m.IgFaRecords,
   109  		m.PidByTgid,
   110  	)
   111  }
   112  
   113  // execruntimePrograms contains all programs after they have been loaded into the kernel.
   114  //
   115  // It can be passed to loadExecruntimeObjects or ebpf.CollectionSpec.LoadAndAssign.
   116  type execruntimePrograms struct {
   117  	IgExecveE *ebpf.Program `ebpf:"ig_execve_e"`
   118  	IgExecveX *ebpf.Program `ebpf:"ig_execve_x"`
   119  	IgFaPickE *ebpf.Program `ebpf:"ig_fa_pick_e"`
   120  	IgFaPickX *ebpf.Program `ebpf:"ig_fa_pick_x"`
   121  }
   122  
   123  func (p *execruntimePrograms) Close() error {
   124  	return _ExecruntimeClose(
   125  		p.IgExecveE,
   126  		p.IgExecveX,
   127  		p.IgFaPickE,
   128  		p.IgFaPickX,
   129  	)
   130  }
   131  
   132  func _ExecruntimeClose(closers ...io.Closer) error {
   133  	for _, closer := range closers {
   134  		if err := closer.Close(); err != nil {
   135  			return err
   136  		}
   137  	}
   138  	return nil
   139  }
   140  
   141  // Do not access this directly.
   142  //
   143  //go:embed execruntime_x86_bpfel.o
   144  var _ExecruntimeBytes []byte