mirror of
https://github.com/eunomia-bpf/bpf-developer-tutorial.git
synced 2026-04-08 21:30:29 +08:00
[bootstrap] add some compile infomation (#64)
This commit is contained in:
@@ -602,6 +602,7 @@ sudo dnf install clang elfutils-libelf elfutils-libelf-devel zlib-devel
|
|||||||
编译运行上述代码:
|
编译运行上述代码:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|
$ git submodule update --init --recursive
|
||||||
$ make
|
$ make
|
||||||
BPF .output/bootstrap.bpf.o
|
BPF .output/bootstrap.bpf.o
|
||||||
GEN-SKEL .output/bootstrap.skel.h
|
GEN-SKEL .output/bootstrap.skel.h
|
||||||
|
|||||||
@@ -191,7 +191,9 @@ int handle_exec(struct trace_event_raw_sched_process_exec *ctx)
|
|||||||
|
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```Then, we reserve an event structure from the circular buffer map `rb` and fill in the relevant data, such as the process ID, parent process ID, and process name. Afterwards, we send this data to the user-mode program for processing.
|
```
|
||||||
|
|
||||||
|
Then, we reserve an event structure from the circular buffer map `rb` and fill in the relevant data, such as the process ID, parent process ID, and process name. Afterwards, we send this data to the user-mode program for processing.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
// reserve sample from BPF ringbuf
|
// reserve sample from BPF ringbuf
|
||||||
@@ -515,8 +517,9 @@ In the main() function, we first parse the command line arguments, and then set
|
|||||||
```c
|
```c
|
||||||
err = argp_parse(&argp, argc, argv, 0, NULL, NULL);
|
err = argp_parse(&argp, argc, argv, 0, NULL, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
return err;```c
|
return err;
|
||||||
libbpf_set_print(libbpf_print_fn);
|
libbpf_set_print(libbpf_print_fn);
|
||||||
|
```
|
||||||
|
|
||||||
Next, we open the eBPF skeleton file, pass the minimum duration parameter to the eBPF program, and load and attach the eBPF program:
|
Next, we open the eBPF skeleton file, pass the minimum duration parameter to the eBPF program, and load and attach the eBPF program:
|
||||||
|
|
||||||
@@ -597,6 +600,7 @@ sudo dnf install clang elfutils-libelf elfutils-libelf-devel zlib-devel
|
|||||||
Compile and run the above code:
|
Compile and run the above code:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|
$ git submodule update --init --recursive
|
||||||
$ make
|
$ make
|
||||||
BPF .output/bootstrap.bpf.o
|
BPF .output/bootstrap.bpf.o
|
||||||
GEN-SKEL .output/bootstrap.skel.h
|
GEN-SKEL .output/bootstrap.skel.h
|
||||||
|
|||||||
Reference in New Issue
Block a user