-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chapter2 confusing footnote description of tgid/pid #35
Comments
According to `man bpf-helpers` pid is located in the lower 32 bits of the return value. Pid can be easily extracted by using an and operation with `0xFFFFFFFF` Signed-off-by: Ali Javidi Ghasr <[email protected]>
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]>
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]>
This is pretty confusing but my understanding is that what we typically call "process ID" in user space is actually the thread group ID in the kernel. From the BCC reference for this helper function:
So, the footnote on p26 is wrong, and could explain this better, but (assuming the user is interested in the user space view of process ID) the code is correct. I'll need to do an errata to fix this in the book but for some reason can't log into the O'Reilly author portal right now, so I'll leave this issue to track it. But I think this means the PR in #36 is not needed |
Hi, Hope you're having a wonderful day!
This is a quote form bpf-helpers man page:
As you can see the top 32 bits contain tgid and the bottom 32 bits hold pid of the process.
In the book this is explained the other way around on page 26. The foot note of page 26 also refers to the lower 32 bits as tgid which is incorrect.
Edit: As I continued reading the book I noticed the same situation with hello-buffer-config.py, hello-ring-buffer-config.py and page 61.
The text was updated successfully, but these errors were encountered: