bytecodealliance / rustix

Safe Rust bindings to POSIX-ish APIs
Other
1.46k stars 152 forks source link

Patch low-hanging fruit semver removals for libc and linux-raw-sys #1063

Closed notgull closed 4 months ago

notgull commented 4 months ago

libc and linux-raw-sys are exposed in the public API, which makes it problematic for us to change their versions. As linux-raw-sys has released a new breaking change and libc is planning on releasing one soon, this will cause a major issue for us if this is not patched in v1.0

This PR takes care of some of the low hanging fruit. Mostly bitflag types are taken care of by making sure they export types from the crate::ffi module instead of the crate::c module. I also add a tcflag_t type alias for the types in the termios module.

Remaining exposed types from linux-raw-sys:

    pub type rustix::fs::FsWord = linux_raw_sys::general::__fsword_t
    pub type rustix::fs::RawMode = linux_raw_sys::general::__kernel_mode_t
    pub type rustix::fs::Stat = linux_raw_sys::general::stat
    pub type rustix::fs::StatFs = linux_raw_sys::general::statfs64
    pub type rustix::fs::Statx = linux_raw_sys::general::statx
    pub type rustix::fs::StatxTimestamp = linux_raw_sys::general::statx_timestamp
    pub rustix::io_uring::io_uring_cqe::big_cqe: linux_raw_sys::io_uring::__IncompleteArrayField<u64>
    pub rustix::io_uring::io_uring_probe::ops: linux_raw_sys::io_uring::__IncompleteArrayField<rustix::io_uring::io_uring_probe_op>
    pub type rustix::io_uring::Statx = linux_raw_sys::general::statx
    pub type rustix::net::SocketAddrStorage = linux_raw_sys::net::sockaddr
    pub const fn rustix::process::WaitidStatus::as_raw(&self) -> &linux_raw_sys::general::siginfo_t
    pub type rustix::system::Sysinfo = linux_raw_sys::system::sysinfo
    pub type rustix::termios::Winsize = linux_raw_sys::general::winsize

Remaining exposed types for libc, at least on x86_64 Linux-GNU:

pub type rustix::fs::Dev = libc::unix::linux_like::linux::dev_t
pub type rustix::fs::FsWord = libc::unix::linux_like::linux::gnu::b64::__fsword_t
pub type rustix::fs::RawMode = libc::unix::linux_like::linux::mode_t
pub type rustix::fs::Stat = libc::unix::linux_like::linux::gnu::b64::x86_64::stat64
pub type rustix::fs::StatFs = libc::unix::linux_like::linux::gnu::b64::x86_64::statfs64
pub type rustix::fs::Statx = libc::unix::linux_like::linux::gnu::statx
pub type rustix::fs::StatxTimestamp = libc::unix::linux_like::linux::gnu::statx
pub type rustix::io_uring::Statx = libc::unix::linux_like::linux::gnu::statx
pub type rustix::net::SocketAddrStorage = libc::unix::linux_like::sockaddr_storage
pub const fn rustix::process::WaitidStatus::as_raw(&self) -> &libc::unix::linux_like::linux::gnu::b64::x86_64::siginfo_t
pub type rustix::system::Sysinfo = libc::unix::linux_like::linux::gnu::b64::sysinfo
pub type rustix::termios::Winsize = libc::unix::winsize
notgull commented 4 months ago

Extant CI errors are due to https://github.com/bytecodealliance/rustix/issues/1062