gimlet, propolis, agent: fix compilation errors on linux#90
Open
emilyalbini wants to merge 1 commit intomainfrom
Open
gimlet, propolis, agent: fix compilation errors on linux#90emilyalbini wants to merge 1 commit intomainfrom
emilyalbini wants to merge 1 commit intomainfrom
Conversation
Collaborator
|
I'm hesitant to introduce a bunch of ifdef noise into code that's intended to only ever work on one platform. The example you found in the gimlet disk thing is actually an artefact of my having copied and pasted that file out of pilot almost (perhaps entirely?) unchanged as part of standing up the gimlet factory. I appreciate the value of the LSP stuff. I edit all of the code on illumos under neovim and rust-analyser is certainly helpful there. Is it possible to tell rust-analyser that you're actually building illumos-only code for the illumos target? I have to imagine we already do something like that with Hubris, as that's presumably not self-hosting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As we are doing in some places already, this fixes compilation errors and warnings when building and running tests on Linux. Having the list of diagnostics polluted in my editor is fairly annoying, and this fixes that.
Most changes are not invasive, except for gating the code handling zones: I can't just cfg out that module outside illumos, as it's relied upon in multiple places. What I ended up doing was creating a
ZoneIdwrapper that can be eitherZoneId(zoneid_t)on illumos or (the stable equivalent of)ZoneId(!)on Linux. This way the rest of the code is not cfg'd out. Another option would be topub use libc::c_int as zoneid_ton Linux if you'd prefer.An alternative to this approach would be to compile out the entirety of the propolis and gimlet factories outside of illumos. While that would avoid some of the noise in the code, when looking at the glue between the buildomat server and the factory having LSP working on the OS-agnostic parts is useful.