Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/backend/libc/thread/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::io;
use crate::pid::Pid;
#[cfg(not(any(
apple,
freebsdlike,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "espidf",
target_os = "haiku",
Expand Down Expand Up @@ -51,7 +51,6 @@ weak!(fn __nanosleep64(*const LibcTimespec, *mut LibcTimespec) -> c::c_int);
target_os = "dragonfly",
target_os = "emscripten",
target_os = "espidf",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment was no longer accurate. libc has targeted FreeBSD 12 since 0.2.176 . I think that if you simply raise your minimum libc version to 0.2.176 you can delete lines like this, safe in the knowledge that clock_nanosleep will always be available on FreeBSD.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That proposal is about removing the FreeBSD 11 bindings. Making 12 the default was a different PR: rust-lang/libc#2406 .

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the comments!

I updated the PR to accommodate FreeBSD 12 as the default minimum. Rustix's libc is already at the correct version anyway. I'll work on adding gates for FreeBSD 13+ after this lands.

target_os = "haiku",
target_os = "horizon",
target_os = "openbsd",
Expand Down Expand Up @@ -162,7 +161,6 @@ fn clock_nanosleep_relative_old(
target_os = "dragonfly",
target_os = "emscripten",
target_os = "espidf",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
target_os = "horizon",
target_os = "openbsd",
Expand Down
6 changes: 6 additions & 0 deletions src/fs/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,11 @@ pub fn fclonefileat<Fd: AsFd, DstFd: AsFd, P: path::Arg>(
/// # References
/// - [POSIX]
/// - [Linux]
/// - [FreeBSD]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/mknodat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/mknodat.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mknodat&sektion=2
#[cfg(not(any(
apple,
target_os = "espidf",
Expand All @@ -494,8 +496,12 @@ pub fn mknodat<P: path::Arg, Fd: AsFd>(
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [FreeBSD]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/mkfifoat.html
/// [Linux]: https://www.man7.org/linux/man-pages/man3/mkfifo.3.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mkfifoat&sektion=2
#[cfg(not(any(
apple,
target_os = "espidf",
Expand Down
9 changes: 6 additions & 3 deletions src/thread/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub use crate::timespec::{Nsecs, Secs, Timespec};
apple,
target_os = "dragonfly",
target_os = "espidf",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "openbsd",
target_os = "redox",
target_os = "vita",
Expand All @@ -24,15 +23,16 @@ pub use crate::clockid::ClockId;
/// # References
/// - [POSIX]
/// - [Linux]
/// - [FreeBSD]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_nanosleep.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_nanosleep.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=nanosleep&sektion=2
#[cfg(not(any(
apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "espidf",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
target_os = "horizon",
target_os = "openbsd",
Expand All @@ -54,15 +54,16 @@ pub fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRel
/// # References
/// - [POSIX]
/// - [Linux]
/// - [FreeBSD]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_nanosleep.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_nanosleep.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=nanosleep&sektion=2
#[cfg(not(any(
apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "espidf",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
target_os = "horizon",
target_os = "openbsd",
Expand All @@ -82,9 +83,11 @@ pub fn clock_nanosleep_absolute(id: ClockId, request: &Timespec) -> io::Result<(
/// # References
/// - [POSIX]
/// - [Linux]
/// - [FreeBSD]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/nanosleep.html
/// [Linux]: https://man7.org/linux/man-pages/man2/nanosleep.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=nanosleep&sektion=2
#[inline]
pub fn nanosleep(request: &Timespec) -> NanosleepRelativeResult {
backend::thread::syscalls::nanosleep(request)
Expand Down
10 changes: 5 additions & 5 deletions tests/thread/clocks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(not(any(
apple,
freebsdlike,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "haiku",
target_os = "openbsd",
Expand Down Expand Up @@ -49,7 +49,7 @@ fn test_invalid_nanosleep() {

#[cfg(not(any(
apple,
freebsdlike,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "haiku",
target_os = "openbsd",
Expand Down Expand Up @@ -103,7 +103,7 @@ fn test_invalid_nanosleep_absolute() {

#[cfg(not(any(
apple,
freebsdlike,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "haiku",
target_os = "openbsd",
Expand Down Expand Up @@ -168,7 +168,7 @@ fn test_zero_nanosleep() {

#[cfg(not(any(
apple,
freebsdlike,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "haiku",
target_os = "openbsd",
Expand All @@ -191,7 +191,7 @@ fn test_zero_nanosleep_absolute() {

#[cfg(not(any(
apple,
freebsdlike,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "haiku",
target_os = "openbsd",
Expand Down
Loading