freebsd(13.2): add netlink/netlink.h support - #5326
Conversation
This comment has been minimized.
This comment has been minimized.
653f197 to
0b6bb29
Compare
This comment has been minimized.
This comment has been minimized.
|
The API looks fine from a quick skim, but since there is no hurry, I think it may be worth trying to add support to ctest first so the tricky test setup isn't needed. (It's useful otherwise too.) Sketched some of that up at #5344 |
|
Noted. Since you already pinged some contributor on that issue, I'll wait and |
|
Could you try adding a separate |
|
Either author or blocked, depending on whether that works. @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a6a6a8d to
266acdf
Compare
This comment has been minimized.
This comment has been minimized.
|
It seems having separate invocations gets the job done just fine. Still, that Those seem to me like they're going to need extending (though it's notably less |
This comment has been minimized.
This comment has been minimized.
745bf15 to
be6cc74
Compare
|
@rustbot ready |
There was a problem hiding this comment.
Cc @asomers, could you take a look when you get the chance?
be6cc74 to
09bbab3
Compare
This comment has been minimized.
This comment has been minimized.
09bbab3 to
d22b942
Compare
|
@rustbot ready |
|
|
||
| pub use freebsd::netlink::netlink::*; | ||
| pub use freebsd::netlink::netlink_generic::*; | ||
| } |
There was a problem hiding this comment.
Maybe just rename src/new/freebsd/netlink/netlink.rs to netlink_.rs or something, so we can keep the glob export? Think this might be done elsewhere as well.
Just add a comment by the mod netlink_ explaining why it has that name.
There was a problem hiding this comment.
I don't think this is a good idea. The new module's directory layout
is meant to provide a fairly accurate mapping between upstream and our
Rust module tree. Starting to allow this type of "exceptions" seems to
me like we're just muddying things up (to eventually be back at having
something as hard to grok as we have now outside new.)
I don't know of prior precedent to this, so we could very well be
already allowing this. Still, considering this is simply to replace an
inline module with the containing reexports, it doesn't seem worth it.
There was a problem hiding this comment.
We do have a few exceptions when things don't work well, e.g. if.h is a common header that needs to be named if_.rs because of the keyword. To me it's worth a minor exception to avoid duplicate the API list in new/mod.rs, those should be pretty few and far between. But I won't block on it.
There was a problem hiding this comment.
I am guessing you mean to rename the top-level freebsd::netlink
module, as that is the one that is reexported in new's root module. If
so, done.
| .skip_union(|_| true) | ||
| .skip_alias(|_| true) | ||
| .skip_static(|_| true) | ||
| .skip_fn(|_| true) | ||
| .skip_c_enum(|_| true); |
There was a problem hiding this comment.
These shouldn't be needed anymore right?
There was a problem hiding this comment.
I don't think so. IIUC, TestGenerator will parse the Rust files, which
we presently can't restrict to a subset of the codebase. If these are
removed, we'd be setting up test for all the types that are not part of
the netlink module, even if we've only provided the #include for the
netlink interfaces (a few lines above this comment.)
There was a problem hiding this comment.
Ah, right, that's inconvenient. Mind adding a comment?
Would be nice if we had a way to restrict to certain modules, feel free to open an issue if you're up to it.
There was a problem hiding this comment.
Flawless nerd sniping.
d22b942 to
fe70cbd
Compare
|
@rustbot ready |
fe70cbd to
422946e
Compare
This comment has been minimized.
This comment has been minimized.
422946e to
6c80d96
Compare
This is an early subset of the Netlink interface, but it proves sufficient for monitoring changes in IP addresses. Coverage can be extended later as needed. See [^1] and [^2]. [^1]: <https://github.com/freebsd/freebsd-src/blob/df9d6403caa6426e92f5e100602f4d2be474bbae/sys/netlink/netlink.h> [^2]: <https://github.com/freebsd/freebsd-src/blob/df9d6403caa6426e92f5e100602f4d2be474bbae/sys/netlink/netlink_generic.h> A small workaround has been necessary in the SemVer tests to ensure we get the right paths to the public submodules for the `netlink/netlink.h` and `netlink/netling_generic.h` interfaces. Those symbols now are prepended a `netlink` super module path. Signed-off-by: Yann Dirson <yann.dirson@vates.fr> Co-authored-by: Yann Dirson <yann.dirson@vates.fr>
Add specific test for `netlink/netlink.h` bindings. This is necessary to avoid conflicts with the bindings for `net/if_mib.h`. libc-test now builds two different `TestGenerator` instances. One of the instances builds tests for the same set of bindings as before this patchset, while the other builds tests only for the `netlink/netlink.h` bindings.
6c80d96 to
a030f33
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Description
This PR updates #3201 with merge conflicts resolved and follows the new plan at
1.
The patch adds support for
netlink.hinterfaces in OpenBSD, where there's anitem resolution conflict if we expose the Rust bindings alongside those of
if_mib.h. This set of APIs is "scoped" in C because they live on separateheaders. In rust-lang/libc, we reexport all items at the root crate level, which
makes item resolution fail.
Note this depends on #5325. It won't pass tests but it will build. This is
because the test templates will gather all items in a single file, so item
resolution fails. We can't really skip these items altogether from the tests, so
it may just be necessary to extend
ctestto allow skipping module-specificRust items.
Closes: #3201
Closes: #3194
Checklist
libc-test/semverhave been updated*LASTor*MAXhave the standarddoc comment
cargo test -p libc-test --target mytarget); especiallyrelevant for platforms that may not be checked in CI
@rustbot label +stable-nominated
Footnotes
https://github.com/rust-lang/libc/pull/3201#issuecomment-4736374182 ↩