Skip to content
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

Expose more thread bindings for BSD-like OSes. #2733

Merged
merged 1 commit into from
Apr 3, 2022

Conversation

iddm
Copy link
Contributor

@iddm iddm commented Mar 26, 2022

Fixes #2721

@rust-highfive
Copy link

r? @Amanieu

(rust-highfive has picked a reviewer for you, use r? to override)

@iddm iddm force-pushed the add-pthread-functions-to-bsd branch from e580478 to d70b9e4 Compare March 26, 2022 12:35
@iddm iddm changed the title Expose more pthread bindings for BSD-like OSes. WIP: Expose more pthread bindings for BSD-like OSes. Mar 26, 2022
@iddm iddm force-pushed the add-pthread-functions-to-bsd branch 10 times, most recently from c6d150d to 0254cec Compare March 26, 2022 14:58
@iddm iddm changed the title WIP: Expose more pthread bindings for BSD-like OSes. Expose more thread bindings for BSD-like OSes. Mar 26, 2022
@iddm
Copy link
Contributor Author

iddm commented Mar 26, 2022

Is there anything I can do to let the Cirrus CI work?

@iddm iddm force-pushed the add-pthread-functions-to-bsd branch 2 times, most recently from e82fed7 to 838e439 Compare March 26, 2022 15:23
pub fn sched_setparam(pid: ::pid_t, param: *const sched_param) -> ::c_int;
pub fn sched_getparam(pid: ::pid_t, param: *mut sched_param) -> ::c_int;
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
pub fn sched_setscheduler(pid: ::pid_t, policy: ::c_int, param: *const sched_param) -> ::c_int;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 4 sched_* functions aren't defined on OpenBSD. In fact, they exists in sched.h but under #if 0. so it will not link.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no! :( Thanks for noticing this. Really love that "not yet" comment there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed those.

@iddm iddm force-pushed the add-pthread-functions-to-bsd branch from 838e439 to bb5bfc2 Compare March 26, 2022 20:03
@@ -2405,6 +2405,16 @@ extern "C" {
size: ::size_t,
set: *mut cpuset_t,
) -> ::c_int;
pub fn pthread_setschedparam(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I implied in your ticket, I suggest to put both these in src/unix/bsd/netbsd/mod.rs so both systems inherit it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially, I did that, but it lead to some errors. Trying once more.

@devnexen
Copy link
Contributor

other than that you can fill libc-test/semver/netbsd.txt and libc-test/semver/openbsd.txt lists so they will appear in the docs.

@iddm iddm force-pushed the add-pthread-functions-to-bsd branch 2 times, most recently from 7ad58ca to e3fc344 Compare March 27, 2022 12:59
pub struct sched_param {
pub sched_priority: ::c_int,
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the struct definition should be moved to src/unix/bsd/netbsdlike/mod.rs , and not just removed.
else it is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am sorry, didn't push that.

@iddm iddm force-pushed the add-pthread-functions-to-bsd branch from e3fc344 to 4454b97 Compare March 27, 2022 14:51
@devnexen
Copy link
Contributor

Looks ok now nice !

@Amanieu
Copy link
Member

Amanieu commented Mar 27, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Mar 27, 2022

📌 Commit 4454b97 has been approved by Amanieu

bors added a commit that referenced this pull request Mar 27, 2022
Expose more thread bindings for BSD-like OSes.

Fixes #2721
@bors
Copy link
Contributor

bors commented Mar 27, 2022

⌛ Testing commit 4454b97 with merge f6338e3...

@bors
Copy link
Contributor

bors commented Mar 27, 2022

💔 Test failed - checks-actions

@iddm
Copy link
Contributor Author

iddm commented Mar 27, 2022

Current error is:

error[E0658]: use of unstable library feature 'proc_macro_is_available'
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.36/src/detection.rs:28:21
   |
28 |     let available = proc_macro::is_available();
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #71436 <https://github.com/rust-lang/rust/issues/71436> for more information
   = help: add `#![feature(proc_macro_is_available)]` to the crate attributes to enable

For more information about this error, try `rustc --explain E0658`.
error: could not compile `proc-macro2` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `semverver v0.1.48`, intermediate artifacts can be found at `/tmp/cargo-installzIFZ77`

Caused by:
  build failed
Error: Process completed with exit code 101.

Also, can I push the Cargo.toml version bump?

@devnexen
Copy link
Contributor

devnexen commented Mar 27, 2022

actual error is this

error[E0412]: cannot find type `sched_param` in this scope
    --> src/unix/bsd/netbsdlike/netbsd/mod.rs:2516:53
     |
2516 |     pub fn sched_getparam(pid: ::pid_t, param: *mut sched_param) -> ::c_int;
     |                                                     ^^^^^^^^^^^ not found in this scope
     |
help: consider importing this struct
     |
2790 |         use sched_param;

@iddm
Copy link
Contributor Author

iddm commented Mar 27, 2022

actual error is this

error[E0412]: cannot find type `sched_param` in this scope
    --> src/unix/bsd/netbsdlike/netbsd/mod.rs:2516:53
     |
2516 |     pub fn sched_getparam(pid: ::pid_t, param: *mut sched_param) -> ::c_int;
     |                                                     ^^^^^^^^^^^ not found in this scope
     |
help: consider importing this struct
     |
2790 |         use sched_param;

Interesting! How were you able to find it? I will fix it if there is just this one error, but I don't know how to actually check if it builds cuz I don't have an openbsd. :(

@Amanieu
Copy link
Member

Amanieu commented Mar 30, 2022

Click on the checks-actions link from bors then scroll on the left to find the actual builder that failed. Ignore the semver builders, the result from those is currently ignored.

@iddm iddm force-pushed the add-pthread-functions-to-bsd branch from 4454b97 to 576f86d Compare April 1, 2022 15:21
@Amanieu
Copy link
Member

Amanieu commented Apr 2, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Apr 2, 2022

📌 Commit 576f86d has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Apr 2, 2022

⌛ Testing commit 576f86d with merge 02bdb0a...

@bors
Copy link
Contributor

bors commented Apr 3, 2022

☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13
Approved by: Amanieu
Pushing 02bdb0a to master...

@bors bors merged commit 02bdb0a into rust-lang:master Apr 3, 2022
@iddm iddm deleted the add-pthread-functions-to-bsd branch April 4, 2022 11:30
@iddm
Copy link
Contributor Author

iddm commented Apr 4, 2022

Thanks everyone.

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

Successfully merging this pull request may close these issues.

The sched_param structure and pthread functions arent't available for OpenBSD
6 participants