Skip to content

Commit

Permalink
Auto merge of #3508 - devnexen:freebsd_15_support, r=JohnTitor
Browse files Browse the repository at this point in the history
freebsd 15 support proposal.
  • Loading branch information
bors committed Jan 4, 2024
2 parents d3238e0 + 2dc04b8 commit e077dbf
Show file tree
Hide file tree
Showing 7 changed files with 650 additions and 27 deletions.
14 changes: 14 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,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 @@ -2032,6 +2033,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 @@ -2119,7 +2124,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 @@ -2403,6 +2408,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 @@ -4512,6 +4520,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
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading

0 comments on commit e077dbf

Please sign in to comment.