Skip to content

[breaking change] Cleanup linux and update MUSL #1365

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

Merged
merged 4 commits into from
May 28, 2019

Conversation

gnzlbg
Copy link
Contributor

@gnzlbg gnzlbg commented May 24, 2019

  • Update MUSL kernel headers to 4.4.2 (non-breaking)
  • [breaking] MADV_SOFT_OFFLINE is not defined on MIPS
  • [breaking] sendmmsg/recvmmsg take an unsigned int flag on MUSL
  • [breaking] pthread_t is a pointer on MUSL
  • rlimit resources should use a type alias on GNU (non-breaking)
  • Deprecate SIGNUNUSED (should use SIGSYS instead)

@rust-highfive
Copy link

@gnzlbg: no appropriate reviewer found, use r? to override

@gnzlbg
Copy link
Contributor Author

gnzlbg commented May 24, 2019

So IPV6_FLOWINFO is here: https://elixir.bootlin.com/linux/v5.0/source/include/uapi/linux/in6.h#L165
and that header "linux/in6.h" is included, but the tests fail with "undeclared ...". @mati865

@gnzlbg
Copy link
Contributor Author

gnzlbg commented May 24, 2019

ah, duh, it appears that these are only included if the linux headers are included first -.-

@mati865
Copy link
Contributor

mati865 commented May 24, 2019

I don't fully understand libc testsuite, it's a bit complicated for newcomer.
Anyway don't worry to ping me if you have issue with something.

@gnzlbg gnzlbg force-pushed the cleanup_linux branch 6 times, most recently from 4254d59 to 04b7312 Compare May 25, 2019 19:07
@bors
Copy link
Contributor

bors commented May 26, 2019

☔ The latest upstream changes (presumably #1346) made this pull request unmergeable. Please resolve the merge conflicts.

@gnzlbg gnzlbg force-pushed the cleanup_linux branch 2 times, most recently from ccca614 to 088a772 Compare May 27, 2019 13:15
@gnzlbg
Copy link
Contributor Author

gnzlbg commented May 27, 2019

I think the current way things are structured is quite weird, but maybe that's life.

For example, we have linux as a platform, and then musl, !musl+mips, !musl+s390x, and !musl (called other) as sub-modules. Where AFAICT !musl is just gnu. From the code !musl could also be uclib, newlib, etc. but since none of those are tested chances are none of those is working anyways.

So i'm tending towards just splitting the linux module into two modules: musl, and gnu, moving mips and s390x into the gnu submodule. If target_env is not musl or gnu for linux, we should error, and if there is someone using a different target_env on linux, they can just add it in parallel, instead of adding all sorts of workarounds to the gnu module.

@mati865
Copy link
Contributor

mati865 commented May 27, 2019

Seems reasonable, chances for any other Linux libc to be fully compatible with gnu are close to zero.

@gnzlbg gnzlbg changed the title WIP: Cleanup linux [breaking change] Cleanup linux and update MUSL May 28, 2019
@gnzlbg
Copy link
Contributor Author

gnzlbg commented May 28, 2019

cc @asomers @alexcrichton - this enables most of the previously skipped tests on MUSL, fixing a couple of issues. Some of the breaking changes, like MADV_SOFT_OFFLINE not being available on MIPS, fix things that were already broken (this is not available on the latest 5.x kernel either). Other changes like pthread_t being a pointer on MUSL, could be breaking, but pthread_t should be handled like an opaque type by Rust code, so unless someone is manipulating these in ways they shouldn't, this should not break any code.

The only real breaking change is the argument type of sendmmsg/recvmmsg on MUSL, but AFAICT nix is not exposing these yet, and the std lib is not using them, so.. I hope we can get away with this one.

@gnzlbg
Copy link
Contributor Author

gnzlbg commented May 28, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented May 28, 2019

📌 Commit 1a3d152 has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented May 28, 2019

⌛ Testing commit 1a3d152 with merge 48193e8...

bors added a commit that referenced this pull request May 28, 2019
[breaking change] Cleanup linux and update MUSL

* Update MUSL kernel headers to 4.4.2 (non-breaking)
* [breaking] `MADV_SOFT_OFFLINE` is not defined on MIPS
* [breaking] `sendmmsg`/`recvmmsg` take an `unsigned int` flag on MUSL
* [breaking] `pthread_t` is a pointer on MUSL
* `rlimit` resources should use a type alias on GNU (non-breaking)
* Deprecate `SIGNUNUSED` (should use SIGSYS instead)
@bors
Copy link
Contributor

bors commented May 28, 2019

☀️ Test successful - checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-travis, status-appveyor
Approved by: gnzlbg
Pushing 48193e8 to master...

@bors bors merged commit 1a3d152 into rust-lang:master May 28, 2019
@apmanol
Copy link

apmanol commented Jun 2, 2019

Compilation for mips :
nix-0.14 for broke too.

info: component 'rust-std' for target 'mips-unknown-linux-gnu' is up to date
   Compiling nix v0.14.0
error[E0425]: cannot find value `MADV_SOFT_OFFLINE` in module `libc`
   --> /.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.14.0/src/sys/mman.rs:143:9
    |
143 |         MADV_SOFT_OFFLINE,
    |         ^^^^^^^^^^^^^^^^^ not found in `libc`
help: possible candidate is found in another module, you can import it into scope
    |
1   | use sys::mman::MmapAdvise::MADV_SOFT_OFFLINE;
    |

error[E0081]: discriminant value `14` already exists
   --> /.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.14.0/src/macros.rs:197:26
    |
197 |                   $entry = libc::$entry,
    |                            ^^^^
    |                            |
    |                            first use of `14`
    |                            enum already has `14`
    |
   ::: /.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.14.0/src/sys/mman.rs:105:1
    |
105 | / libc_enum!{
106 | |     /// Usage information for a range of memory to allow for performance optimizations by the kernel.
107 | |     ///
108 | |     /// Used by [`madvise`](./fn.madvise.html).
...   |
187 | |     }
188 | | }
    | |_- in this macro invocation

error: aborting due to 2 previous errors


@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jun 2, 2019

MADV_SOFT_OFFLINE not found

That's a nix error, that constant is not available on MIPS on any released Linux kernel.

asomers added a commit to dario23/nix that referenced this pull request Jun 3, 2019
libc just undefined MADV_SOFT_OFFLINE on mips.
rust-lang/libc#1365

Fixes nix-rust#1074
asomers added a commit to dario23/nix that referenced this pull request Jun 3, 2019
libc just undefined MADV_SOFT_OFFLINE on mips.
rust-lang/libc#1365

Fixes nix-rust#1074
asomers added a commit to nix-rust/nix that referenced this pull request Jun 7, 2019
libc just undefined MADV_SOFT_OFFLINE on mips.
rust-lang/libc#1365

Fixes #1074
asomers added a commit to nix-rust/nix that referenced this pull request Jun 8, 2019
libc just undefined MADV_SOFT_OFFLINE on mips.
rust-lang/libc#1365

Fixes #1074
asomers added a commit to nix-rust/nix that referenced this pull request Jun 9, 2019
libc just undefined MADV_SOFT_OFFLINE on mips.
rust-lang/libc#1365

Fixes #1074
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants