Skip to content

Commit

Permalink
freebsd 15 support proposal.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 30, 2023
1 parent b514302 commit 2dc04b8
Show file tree
Hide file tree
Showing 7 changed files with 650 additions and 27 deletions.
14 changes: 14 additions & 0 deletions .cirrus.yml
Expand Up @@ -25,3 +25,17 @@ task:
- . $HOME/.cargo/env
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
- sh ci/run.sh x86_64-unknown-freebsd

task:
name: nightly x86_64-unknown-freebsd-15
freebsd_instance:
image_family: freebsd-15-0-snap
setup_script:
- pkg install -y libnghttp2 curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y --default-toolchain nightly --profile=minimal
- . $HOME/.cargo/env
test_script:
- . $HOME/.cargo/env
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
- sh ci/run.sh x86_64-unknown-freebsd
3 changes: 3 additions & 0 deletions build.rs
Expand Up @@ -13,6 +13,7 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
"freebsd12",
"freebsd13",
"freebsd14",
"freebsd15",
"libc_align",
"libc_cfg_target_vendor",
"libc_const_extern_fn",
Expand Down Expand Up @@ -70,6 +71,7 @@ fn main() {
Some(12) if libc_ci || rustc_dep_of_std => set_cfg("freebsd12"),
Some(13) if libc_ci => set_cfg("freebsd13"),
Some(14) if libc_ci => set_cfg("freebsd14"),
Some(15) if libc_ci => set_cfg("freebsd15"),
Some(_) | None => set_cfg("freebsd11"),
}

Expand Down Expand Up @@ -252,6 +254,7 @@ fn which_freebsd() -> Option<i32> {
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
s if s.starts_with("14") => Some(14),
s if s.starts_with("15") => Some(15),
_ => None,
}
}
Expand Down
11 changes: 10 additions & 1 deletion libc-test/build.rs
Expand Up @@ -2013,6 +2013,7 @@ fn test_freebsd(target: &str) {
Some(12) => cfg.cfg("freebsd12", None),
Some(13) => cfg.cfg("freebsd13", None),
Some(14) => cfg.cfg("freebsd14", None),
Some(15) => cfg.cfg("freebsd15", None),
_ => &mut cfg,
};

Expand All @@ -2031,6 +2032,10 @@ fn test_freebsd(target: &str) {
Some(n) if n >= 14 => true,
_ => false,
};
let freebsd15 = match freebsd_ver {
Some(n) if n >= 15 => true,
_ => false,
};

headers! { cfg:
"aio.h",
Expand Down Expand Up @@ -2118,7 +2123,7 @@ fn test_freebsd(target: &str) {
"sys/sysctl.h",
"sys/thr.h",
"sys/time.h",
[freebsd14]:"sys/timerfd.h",
[freebsd14 || freebsd15]:"sys/timerfd.h",
"sys/times.h",
"sys/timex.h",
"sys/types.h",
Expand Down Expand Up @@ -2402,6 +2407,9 @@ fn test_freebsd(target: &str) {
true
}

// Introduced in FreeBSD 14 then removed ?
"TCP_LRD" if freebsd_ver >= Some(15) => true,

// Added in FreeBSD 14
"LIO_READV" | "LIO_WRITEV" | "LIO_VECTORED" if Some(14) > freebsd_ver => true,

Expand Down Expand Up @@ -4487,6 +4495,7 @@ fn which_freebsd() -> Option<i32> {
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
s if s.starts_with("14") => Some(14),
s if s.starts_with("15") => Some(15),
_ => None,
}
}
Expand Down
34 changes: 34 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs
@@ -0,0 +1,34 @@
#[repr(C)]
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
st_padding0: i16,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
st_padding1: i32,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u64,
pub st_spare: [u64; 10],
}

impl ::Copy for ::stat {}
impl ::Clone for ::stat {
fn clone(&self) -> ::stat {
*self
}
}

0 comments on commit 2dc04b8

Please sign in to comment.