-
Notifications
You must be signed in to change notification settings - Fork 638
Typedef for __kernel_sa_family_t in linux/socket.h #578
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
Conversation
| #include "_fake_defines.h" | ||
| #include "_fake_typedefs.h" | ||
|
|
||
| typedef unsigned short __kernel_sa_family_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typedefs typically go into _fake_defines.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be moved to _fake_defines.h, no problem.
| @@ -1,2 +1,9 @@ | |||
| #ifndef _LINUX_SOCKET_H | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these needed? All fake includes share a single ifndef guard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They won't be needed if the typedef goes to _fake_defines.h
ced7b02 to
bb74d6b
Compare
| memory_order_acq_rel, | ||
| memory_order_seq_cst | ||
| } memory_order; | ||
| typedef unsigned short __kernel_sa_family_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could you please move next to other socket typedefs (search for "socket" in this file)? Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
This typedef that exists in the real `linux/socket.h` is masked by the `fake_libc_include` hierarchy. Having it in place allows to successfully parse a large number of Linux kernel headers necessary for netlink operations. This is very useful for Python projects that communicate with the kernel over netlink socket. In particular, this project: https://github.com/ionos-cloud/netlinklib/tree/main/netlinklib plans to use pyparser for parsing strcts defined in the kernel headers. Signed-off-by: Eugene Crosser <crosser@average.org>
bb74d6b to
359212b
Compare
eliben
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This typedef that exists in the real
linux/socket.his masked by thefake_libc_includehierarchy. Having it in place allows to successfully parse a large number of Linux kernel headers necessary for netlink operations. This is very useful for Python projects that communicate with the kernel over netlink socket. In particular, this project:https://github.com/ionos-cloud/netlinklib/tree/main/netlinklib
plans to use pyparser for parsing strcts defined in the kernel headers.