Skip to content

Commit

Permalink
Merge #66
Browse files Browse the repository at this point in the history
66: Automated pull from `rust-lang/libc` r=pietroalbini a=github-actions[bot]

This PR pulls the following changes from the [`rust-lang/libc`](https://github.com/rust-lang/libc) repository:

* rust-lang/libc#3320
* rust-lang/libc#3406
* rust-lang/libc#3355


Co-authored-by: Brando <fong.m.brandon97@gmail.com>
Co-authored-by: Brandon Fong <55638760+BrandonMFong@users.noreply.github.com>
Co-authored-by: Alan Somers <asomers@gmail.com>
Co-authored-by: Jonathan Dygert <jdygert@spideroak.com>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
7 people committed Oct 26, 2023
2 parents af19303 + 5617eeb commit e70a1d8
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 14 deletions.
4 changes: 1 addition & 3 deletions ferrocene/library/libc/.cirrus.yml
Expand Up @@ -29,9 +29,7 @@ task:
task:
name: nightly x86_64-unknown-freebsd-14
freebsd_instance:
# FIXME: FreeBSD 14 CI fails due to pkg installation.
# Use 14 again once a new image is available on Cirrus CI.
image_family: freebsd-13-2
image: freebsd-14-0-rc1-amd64
setup_script:
- pkg install -y libnghttp2 curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
Expand Down
15 changes: 13 additions & 2 deletions ferrocene/library/libc/libc-test/build.rs
Expand Up @@ -1987,6 +1987,10 @@ fn test_freebsd(target: &str) {
Some(n) if n >= 13 => true,
_ => false,
};
let freebsd14 = match freebsd_ver {
Some(n) if n >= 14 => true,
_ => false,
};

headers! { cfg:
"aio.h",
Expand Down Expand Up @@ -2074,6 +2078,7 @@ fn test_freebsd(target: &str) {
"sys/sysctl.h",
"sys/thr.h",
"sys/time.h",
[freebsd14]:"sys/timerfd.h",
"sys/times.h",
"sys/timex.h",
"sys/types.h",
Expand Down Expand Up @@ -2196,6 +2201,12 @@ fn test_freebsd(target: &str) {
// should've been used anywhere anyway.
"TDF_UNUSED23" => true,

// Removed in FreeBSD 14 (git a6b55ee6be1)
"IFF_KNOWSEPOCH" => true,

// Removed in FreeBSD 14 (git 7ff9ae90f0b)
"IFF_NOGROUP" => true,

// FIXME: These are deprecated - remove in a couple of releases.
// These symbols are not stable across OS-versions. They were
// changed for FreeBSD 14 in git revisions b62848b0c3f and
Expand Down Expand Up @@ -2277,8 +2288,8 @@ fn test_freebsd(target: &str) {
// Added in freebsd 14.
"IFCAP_MEXTPG" if Some(14) > freebsd_ver => true,
// Added in freebsd 13.
"IFF_KNOWSEPOCH" | "IFCAP_TXTLS4" | "IFCAP_TXTLS6" | "IFCAP_VXLAN_HWCSUM"
| "IFCAP_VXLAN_HWTSO" | "IFCAP_TXTLS_RTLMT" | "IFCAP_TXTLS"
"IFCAP_TXTLS4" | "IFCAP_TXTLS6" | "IFCAP_VXLAN_HWCSUM" | "IFCAP_VXLAN_HWTSO"
| "IFCAP_TXTLS_RTLMT" | "IFCAP_TXTLS"
if Some(13) > freebsd_ver =>
{
true
Expand Down
10 changes: 10 additions & 0 deletions ferrocene/library/libc/libc-test/semver/linux.txt
Expand Up @@ -895,6 +895,14 @@ IFF_MULTICAST
IFF_MULTI_QUEUE
IFF_NOARP
IFF_NOFILTER
TUN_TX_TIMESTAMP
TUN_F_CSUM
TUN_F_TSO4
TUN_F_TSO6
TUN_F_TSO_ECN
TUN_F_UFO
TUN_PKT_STRIP
TUN_FLT_ALLMULTI
IFF_NOTRAILERS
IFF_NO_PI
IFF_ONE_QUEUE
Expand All @@ -906,6 +914,8 @@ IFF_RUNNING
IFF_SLAVE
IFF_TAP
IFF_TUN
IFF_NAPI
IFF_NAPI_FRAGS
IFF_TUN_EXCL
IFF_UP
IFF_VNET_HDR
Expand Down
36 changes: 32 additions & 4 deletions ferrocene/library/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
Expand Up @@ -365,9 +365,13 @@ s! {
}

pub struct cpuset_t {
#[cfg(target_pointer_width = "64")]
#[cfg(all(freebsd14, target_pointer_width = "64"))]
__bits: [::c_long; 16],
#[cfg(all(freebsd14, target_pointer_width = "32"))]
__bits: [::c_long; 32],
#[cfg(all(not(freebsd14), target_pointer_width = "64"))]
__bits: [::c_long; 4],
#[cfg(target_pointer_width = "32")]
#[cfg(all(not(freebsd14), target_pointer_width = "32"))]
__bits: [::c_long; 8],
}

Expand Down Expand Up @@ -998,6 +1002,8 @@ s! {
pub pcbcnt: u32,
}

// Note: this structure will change in a backwards-incompatible way in
// FreeBSD 15.
pub struct tcp_info {
pub tcpi_state: u8,
pub __tcpi_ca_state: u8,
Expand Down Expand Up @@ -1055,7 +1061,21 @@ s! {
#[cfg(freebsd14)]
pub __tcpi_received_ce_bytes: u32,
#[cfg(freebsd14)]
pub __tcpi_pad: [u32; 19],
pub tcpi_total_tlp: u32,
#[cfg(freebsd14)]
pub tcpi_total_tlp_bytes: u64,
#[cfg(freebsd14)]
pub tcpi_snd_una: u32,
#[cfg(freebsd14)]
pub tcpi_snd_max: u32,
#[cfg(freebsd14)]
pub tcpi_rcv_numsacks: u32,
#[cfg(freebsd14)]
pub tcpi_rcv_adv: u32,
#[cfg(freebsd14)]
pub tcpi_dupacks: u32,
#[cfg(freebsd14)]
pub __tcpi_pad: [u32; 10],
#[cfg(not(freebsd14))]
pub __tcpi_pad: [u32; 26],
}
Expand Down Expand Up @@ -2599,7 +2619,13 @@ pub const DEVSTAT_N_TRANS_FLAGS: ::c_int = 4;
pub const DEVSTAT_NAME_LEN: ::c_int = 16;

// sys/cpuset.h
pub const CPU_SETSIZE: ::c_int = 256;
cfg_if! {
if #[cfg(freebsd14)] {
pub const CPU_SETSIZE: ::c_int = 1024;
} else {
pub const CPU_SETSIZE: ::c_int = 256;
}
}

pub const SIGEV_THREAD_ID: ::c_int = 4;

Expand Down Expand Up @@ -3172,6 +3198,7 @@ pub const IFF_LOOPBACK: ::c_int = 0x8;
/// (i) is a point-to-point link
pub const IFF_POINTOPOINT: ::c_int = 0x10;
/// (i) calls if_input in net epoch
#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")]
pub const IFF_KNOWSEPOCH: ::c_int = 0x20;
/// (d) resources allocated
pub const IFF_RUNNING: ::c_int = 0x40;
Expand Down Expand Up @@ -3219,6 +3246,7 @@ pub const IFF_DYING: ::c_int = 0x200000;
/// (n) interface is being renamed
pub const IFF_RENAMING: ::c_int = 0x400000;
/// interface is not part of any groups
#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")]
pub const IFF_NOGROUP: ::c_int = 0x800000;

/// link invalid/unknown
Expand Down
14 changes: 14 additions & 0 deletions ferrocene/library/libc/src/unix/linux_like/linux/mod.rs
Expand Up @@ -1830,6 +1830,8 @@ pub const IFLA_INFO_SLAVE_DATA: ::c_ushort = 5;
// linux/if_tun.h
pub const IFF_TUN: ::c_int = 0x0001;
pub const IFF_TAP: ::c_int = 0x0002;
pub const IFF_NAPI: ::c_int = 0x0010;
pub const IFF_NAPI_FRAGS: ::c_int = 0x0020;
pub const IFF_NO_PI: ::c_int = 0x1000;
// Read queue size
pub const TUN_READQ_SIZE: ::c_short = 500;
Expand All @@ -1847,6 +1849,18 @@ pub const IFF_DETACH_QUEUE: ::c_int = 0x0400;
// read-only flag
pub const IFF_PERSIST: ::c_int = 0x0800;
pub const IFF_NOFILTER: ::c_int = 0x1000;
// Socket options
pub const TUN_TX_TIMESTAMP: ::c_int = 1;
// Features for GSO (TUNSETOFFLOAD)
pub const TUN_F_CSUM: ::c_ushort = 0x01; /* You can hand me unchecksummed packets. */
pub const TUN_F_TSO4: ::c_ushort = 0x02; /* I can handle TSO for IPv4 packets */
pub const TUN_F_TSO6: ::c_ushort = 0x04; /* I can handle TSO for IPv6 packets */
pub const TUN_F_TSO_ECN: ::c_ushort = 0x08; /* I can handle TSO with ECN bits. */
pub const TUN_F_UFO: ::c_ushort = 0x10; /* I can handle UFO packets */
// Protocol info prepended to the packets (when IFF_NO_PI is not set)
pub const TUN_PKT_STRIP: ::c_int = 0x0001;
// Accept all multicast packets
pub const TUN_FLT_ALLMULTI: ::c_int = 0x0001;

// Since Linux 3.1
pub const SEEK_DATA: ::c_int = 3;
Expand Down
27 changes: 22 additions & 5 deletions ferrocene/library/libc/src/vxworks/mod.rs
Expand Up @@ -1018,6 +1018,21 @@ pub const O_WRONLY: ::c_int = 0x0001;
pub const O_RDONLY: ::c_int = 0;
pub const O_NONBLOCK: ::c_int = 0x4000;

// mman.h
pub const PROT_NONE: ::c_int = 0x0000;
pub const PROT_READ: ::c_int = 0x0001;
pub const PROT_WRITE: ::c_int = 0x0002;
pub const PROT_EXEC: ::c_int = 0x0004;

pub const MAP_SHARED: ::c_int = 0x0001;
pub const MAP_PRIVATE: ::c_int = 0x0002;
pub const MAP_ANON: ::c_int = 0x0004;
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
pub const MAP_FIXED: ::c_int = 0x0010;
pub const MAP_CONTIG: ::c_int = 0x0020;

pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
impl ::Copy for FILE {}
Expand Down Expand Up @@ -1218,6 +1233,8 @@ extern "C" {
) -> *mut ::c_void;
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int;
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;

pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pub fn pthread_exit(value: *mut ::c_void) -> !;
Expand Down Expand Up @@ -1909,19 +1926,19 @@ cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::*;
} else if #[cfg(any(target_arch = "arm"))] {
} else if #[cfg(target_arch = "arm")] {
mod arm;
pub use self::arm::*;
} else if #[cfg(any(target_arch = "x86"))] {
} else if #[cfg(target_arch = "x86")] {
mod x86;
pub use self::x86::*;
} else if #[cfg(any(target_arch = "x86_64"))] {
} else if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
} else if #[cfg(any(target_arch = "powerpc"))] {
} else if #[cfg(target_arch = "powerpc")] {
mod powerpc;
pub use self::powerpc::*;
} else if #[cfg(any(target_arch = "powerpc64"))] {
} else if #[cfg(target_arch = "powerpc64")] {
mod powerpc64;
pub use self::powerpc64::*;
} else {
Expand Down

0 comments on commit e70a1d8

Please sign in to comment.