-
Notifications
You must be signed in to change notification settings - Fork 1.1k
linux: add missing SOL_* constants #228
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,6 +155,15 @@ fn main() { | |
cfg.header("linux/netlink.h"); | ||
cfg.header("linux/magic.h"); | ||
|
||
if !android { | ||
cfg.header("netinet/udp.h"); | ||
cfg.header("netipx/ipx.h"); | ||
cfg.header("netax25/ax25.h"); | ||
cfg.header("netatalk/at.h"); | ||
cfg.header("netrose/rose.h"); | ||
cfg.header("netrom/netrom.h"); | ||
} | ||
|
||
if !mips { | ||
cfg.header("linux/quota.h"); | ||
} | ||
|
@@ -289,6 +298,24 @@ fn main() { | |
"FILE_ATTRIBUTE_INTEGRITY_STREAM" | | ||
"ERROR_NOTHING_TO_TERMINATE" if mingw => true, | ||
|
||
// these are not in musl | ||
"SOL_NETLINK" | | ||
"SOL_UDP" | | ||
"SOL_AX25" | | ||
"SOL_ATALK" | | ||
"SOL_NETROM" | | ||
"SOL_IPX" | | ||
"SOL_ROSE" if musl => true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could these constants be perhaps non-MUSL? I guess they're defined in the kernel so the MUSL definitions shouldn't change in theory? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bionic seems to be the only libc implementation that takes a reasonable approach (automating) to keeping constants like this from the kernel reasonably up-to-date (it would be nice if this crate could move toward a similar approach for appropriate items). These constants get passed straight to the kernel and I do not see any potential conflict with musl. The kernel takes modification of constants like this very seriously, so I believe the risk of inclusion is extremely low. Without definitions like this in libc, they must be defined by downstream crates (possibly inconsistently). I don't think that the failure of musl/glibc to provide a complete set of constants to the operating system should prevent us from doing so. |
||
|
||
// these are not in glibc or musl yet (but they are in android) | ||
"SOL_SCTP" | | ||
"SOL_UDPLITE" | | ||
"SOL_NETBEUI" | | ||
"SOL_LLC" | | ||
"SOL_DCCP" | | ||
"SOL_NETLINK" | | ||
"SOL_TIPC" if linux => true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm I'm a little wary of including constants that aren't in glibc or musl yet. Perhaps these could be android-only for now? Or should we update glibc to start verifying them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Working with glibc to verify these seems like it might be a reasonable approach although they probably move forward at a snails pace for fear of breaking existing code that has already defined constants missing from its headers (I found several major projects defining Another angle would be to verify some definitions against the kernel headers. I don't see a good way of mixing glibc headers and kernel headers together, but having a separate set of tests which verify against kernel sources might have some legs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm ok, I'm largely just wary to include such a large set of constants in the ignore list. This'd mean that they're never validated, and I don't necessarily trust architectures like MIPS to have all the same values for all the constants. It's ok if they're not tested on MUSL, but they should be tested somewhere. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood. I'll see what I can come up with. I would be fine with dropping all of these as well except There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, sounds good to me! |
||
|
||
"SIG_IGN" => true, // sighandler_t weirdness | ||
|
||
// types on musl are defined a little differently | ||
|
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 is not in musl or glibc and should be removed from this list. Will handle.