| 170 | } |
| 171 | |
| 172 | int main() { |
| 173 | ebpf::BPF bpf; |
| 174 | auto res = bpf.init(BPF_PROGRAM); |
| 175 | if (!res.ok()) { |
| 176 | std::cerr << res.msg() << std::endl; |
| 177 | return 1; |
| 178 | } |
| 179 | |
| 180 | uint32_t key = 0, val = getpid(); |
| 181 | auto pid_table = bpf.get_array_table<uint32_t>("target_pid"); |
| 182 | res = pid_table.update_value(key, val); |
| 183 | if (!res.ok()) { |
| 184 | std::cerr << res.msg() << std::endl; |
| 185 | return 1; |
| 186 | } |
| 187 | |
| 188 | if (modify_return(bpf)) |
| 189 | return 1; |
| 190 | |
| 191 | if (not_modify_return(bpf)) |
| 192 | return 1; |
| 193 | |
| 194 | return 0; |
| 195 | } |
nothing calls this directly
no test coverage detected