MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / body

Method body

plugins/wasm_bpf/func-attach-bpf-program.cpp:10–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace Host {
9
10Expect<int32_t> AttachBpfProgram::body(const Runtime::CallingFrame &Frame,
11 handle_t program, uint32_t name,
12 uint32_t attach_target) {
13 auto *memory = Frame.getMemoryByIndex(0);
14 if (unlikely(!memory)) {
15 return Unexpect(ErrCode::Value::HostFuncError);
16 }
17 std::shared_lock lock(state->lock);
18 auto program_ptr = state->handles.find(program);
19 if (program_ptr == state->handles.end()) {
20 return Unexpect(ErrCode::Value::HostFuncError);
21 }
22
23 const char *name_str = nullptr;
24 const char *attach_target_str = nullptr;
25 checkAndSetCstr(memory, name, name_str);
26 checkAndSetCstr(memory, attach_target, attach_target_str);
27 return program_ptr->second->attach_bpf_program(name_str, attach_target_str);
28}
29
30} // namespace Host
31} // namespace WasmEdge

Callers

nothing calls this directly

Calls 6

unlikelyFunction · 0.85
UnexpectFunction · 0.85
getMemoryByIndexMethod · 0.80
attach_bpf_programMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected