Skip to content

Commit

Permalink
Fix extracting pid form bpf_get_current_pid_tgid()
Browse files Browse the repository at this point in the history
Based on Issue lizrice#35,
pid must be extracted from the return value by using an and operation with 0xFFFFFFFF.

Signed-off-by: Ali Javidi Ghasr <[email protected]>
  • Loading branch information
AliJavidiCS authored Dec 16, 2023
1 parent 527713d commit d03712d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chapter4/hello-ring-buffer-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
char message[12] = "Hello World";
struct user_msg_t *p;
data.pid = bpf_get_current_pid_tgid() >> 32;
data.pid = bpf_get_current_pid_tgid() & 0xFFFFFFFF;
data.uid = bpf_get_current_uid_gid() & 0xFFFFFFFF;
bpf_get_current_comm(&data.command, sizeof(data.command));
Expand Down

0 comments on commit d03712d

Please sign in to comment.