diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 5e594a9a88079..74386c64948a3 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -194,6 +194,33 @@ jobs: - name: Execute run-docker.sh run: sh ./ci/run-docker.sh ${{ matrix.target }} + solaris: + name: Solaris + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + target: + - x86_64-pc-solaris + steps: + - uses: actions/checkout@v4 + - name: test on Solaris + uses: vmactions/solaris-vm@v1 + with: + release: "11.4-gcc" + usesh: true + mem: 4096 + copyback: false + prepare: | + source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install) + echo "~~~~ rustc --version ~~~~" + rustc --version + echo "~~~~ Solaris-version ~~~~" + uname -a + run: | + export PATH=$HOME/.rust_solaris/bin:$PATH + bash ./ci/run.sh ${{ matrix.target }} + check_cfg: name: "Check #[cfg]s" runs-on: ubuntu-22.04 @@ -214,6 +241,7 @@ jobs: - docker_linux_tier2 - macos - windows + - solaris - style_check - build_channels_linux - build_channels_macos diff --git a/libc-test/build.rs b/libc-test/build.rs index 37ca243033ca8..8283d704ee4e6 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -847,6 +847,7 @@ fn test_solarish(target: &str) { headers! { cfg: + "aio.h", "ctype.h", "dirent.h", "dlfcn.h", @@ -1009,6 +1010,11 @@ fn test_solarish(target: &str) { } }); + cfg.skip_field_type(move |struct_, field| { + // aio_buf is "volatile void*" + struct_ == "aiocb" && field == "aio_buf" + }); + cfg.skip_field(move |s, field| { match s { // C99 sizing on this is tough @@ -1064,6 +1070,9 @@ fn test_solarish(target: &str) { // const-ness issues "execv" | "execve" | "execvp" | "settimeofday" | "sethostname" => true, + // FIXME(1.0): https://github.com/rust-lang/libc/issues/1272 + "fexecve" => true, + // Solaris-different "getpwent_r" | "getgrent_r" | "updwtmpx" if is_illumos => true, "madvise" | "mprotect" if is_illumos => true, @@ -1087,6 +1096,12 @@ fn test_solarish(target: &str) { // excluded from the tests. "getifaddrs" if is_illumos => true, + // FIXME: Our API is unsound. The Rust API allows aliasing + // pointers, but the C API requires pointers not to alias. + // We should probably be at least using `&`/`&mut` here, see: + // https://github.com/gnzlbg/ctest/issues/68 + "lio_listio" => true, + _ => false, } }); @@ -2585,6 +2600,9 @@ fn test_freebsd(target: &str) { // FIXME: The values has been changed in FreeBSD 15: "CLOCK_BOOTTIME" if Some(15) <= freebsd_ver => true, + // Added in FreeBSD 14.0 + "TCP_FUNCTION_ALIAS" if Some(14) > freebsd_ver => true, + _ => false, } }); diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 096133a059520..ba4902ee780a2 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -1505,6 +1505,8 @@ TCP_DELACK TCP_FASTOPEN TCP_FASTOPEN_PSK_LEN TCP_FIN_IS_RST +TCP_FUNCTION_ALIAS +TCP_FUNCTION_BLK TCP_FUNCTION_NAME_LEN_MAX TCP_IDLE_REDUCE TCP_INFO diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt index 8f51b3ceca6fa..076eb5988bcb7 100644 --- a/libc-test/semver/solarish.txt +++ b/libc-test/semver/solarish.txt @@ -1,3 +1,6 @@ +AIO_ALLDONE +AIO_CANCELED +AIO_NOTCANCELED IPV6_DONTFRAG IPV6_PKTINFO IPV6_RECVTCLASS @@ -6,9 +9,26 @@ IP_DONTFRAG IP_PKTINFO IP_TOS IP_TTL +LIO_NOP +LIO_NOWAIT +LIO_READ +LIO_WAIT +LIO_WRITE PIPE_BUF +SIGEV_PORT +aio_cancel +aio_error +aio_fsync +aio_read +aio_result_t +aio_return +aio_suspend +aio_waitn +aio_write +aiocb bind in6_pktinfo in_pktinfo +lio_listio recvmsg sendmsg diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 10e2974aa648e..16ca0cd602e4b 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -708,6 +708,8 @@ pub const RTLD_LAZY: ::c_int = 0x4; pub const RTLD_NOW: ::c_int = 0x2; pub const RTLD_GLOBAL: ::c_int = 0x10000; pub const RTLD_LOCAL: ::c_int = 0x80000; +pub const RTLD_MEMBER: ::c_int = 0x40000; +pub const RTLD_NOAUTODEFER: ::c_int = 0x20000; pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void; pub const RTLD_MYSELF: *mut ::c_void = -2isize as *mut ::c_void; pub const RTLD_NEXT: *mut ::c_void = -3isize as *mut ::c_void; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 7e8d6486d7981..eef1b2a99bd1d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3895,6 +3895,8 @@ pub const TCP_KEEPINIT: ::c_int = 128; pub const TCP_FASTOPEN: ::c_int = 1025; pub const TCP_PCAP_OUT: ::c_int = 2048; pub const TCP_PCAP_IN: ::c_int = 4096; +pub const TCP_FUNCTION_BLK: ::c_int = 8192; +pub const TCP_FUNCTION_ALIAS: ::c_int = 8193; pub const TCP_FASTOPEN_PSK_LEN: ::c_int = 16; pub const TCP_FUNCTION_NAME_LEN_MAX: ::c_int = 32; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 11a2491b2c4c7..db60f8ef29ee4 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1492,6 +1492,9 @@ cfg_if! { all(target_os = "macos", target_arch = "x86"), link_name = "confstr$UNIX2003" )] + #[cfg_attr(target_os = "solaris", + link_name = "__confstr_xpg7" + )] pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t; } } diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 121b5fa06fe7b..62a07f6279030 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -10,6 +10,19 @@ pub type lgrp_rsrc_t = ::c_int; pub type lgrp_affinity_t = ::c_int; s! { + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_offset: ::off_t, + pub aio_reqprio: ::c_int, + pub aio_sigevent: ::sigevent, + pub aio_lio_opcode: ::c_int, + pub aio_resultp: ::aio_result_t, + pub aio_state: ::c_int, + pub aio__pad: [::c_int; 1], + } + pub struct shmid_ds { pub shm_perm: ::ipc_perm, pub shm_segsz: ::size_t, diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 2e3bc3ed0013d..b30ab7e76c387 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -420,6 +420,11 @@ s! { pub portnfy_user: *mut ::c_void, } + pub struct aio_result_t { + pub aio_return: ::ssize_t, + pub aio_errno: ::c_int, + } + pub struct exit_status { e_termination: ::c_short, e_exit: ::c_short, @@ -1133,9 +1138,19 @@ pub const SIG_BLOCK: ::c_int = 1; pub const SIG_UNBLOCK: ::c_int = 2; pub const SIG_SETMASK: ::c_int = 3; +pub const AIO_CANCELED: ::c_int = 0; +pub const AIO_ALLDONE: ::c_int = 1; +pub const AIO_NOTCANCELED: ::c_int = 2; +pub const LIO_NOP: ::c_int = 0; +pub const LIO_READ: ::c_int = 1; +pub const LIO_WRITE: ::c_int = 2; +pub const LIO_NOWAIT: ::c_int = 0; +pub const LIO_WAIT: ::c_int = 1; + pub const SIGEV_NONE: ::c_int = 1; pub const SIGEV_SIGNAL: ::c_int = 2; pub const SIGEV_THREAD: ::c_int = 3; +pub const SIGEV_PORT: ::c_int = 4; pub const CLD_EXITED: ::c_int = 1; pub const CLD_KILLED: ::c_int = 2; @@ -3045,9 +3060,37 @@ extern "C" { pub fn sync(); + pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_error(aiocbp: *const aiocb) -> ::c_int; + pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t; + pub fn aio_suspend( + aiocb_list: *const *const aiocb, + nitems: ::c_int, + timeout: *const ::timespec, + ) -> ::c_int; + pub fn aio_waitn( + aiocb_list: *mut *mut aiocb, + nent: ::c_uint, + nwait: *mut ::c_uint, + timeout: *const ::timespec, + ) -> ::c_int; + pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; + pub fn lio_listio( + mode: ::c_int, + aiocb_list: *const *mut aiocb, + nitems: ::c_int, + sevp: *mut sigevent, + ) -> ::c_int; + pub fn __major(version: ::c_int, devnum: ::dev_t) -> ::major_t; pub fn __minor(version: ::c_int, devnum: ::dev_t) -> ::minor_t; pub fn __makedev(version: ::c_int, majdev: ::major_t, mindev: ::minor_t) -> ::dev_t; + + pub fn arc4random() -> u32; + pub fn arc4random_buf(buf: *mut ::c_void, nbytes: ::size_t); + pub fn arc4random_uniform(upper_bound: u32) -> u32; } #[link(name = "sendfile")] diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index 62653489af721..7db0bd0fc9146 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -20,6 +20,21 @@ e! { } s! { + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_offset: ::off_t, + pub aio_reqprio: ::c_int, + pub aio_sigevent: ::sigevent, + pub aio_lio_opcode: ::c_int, + pub aio_resultp: ::aio_result_t, + pub aio_state: ::c_char, + pub aio_returned: ::c_char, + pub aio__pad1: [::c_char; 2], + pub aio_flags: ::c_int, + } + pub struct shmid_ds { pub shm_perm: ::ipc_perm, pub shm_segsz: ::size_t, diff --git a/src/unix/solarish/x86_64.rs b/src/unix/solarish/x86_64.rs index c7cb52c47749e..e95eecd6211c0 100644 --- a/src/unix/solarish/x86_64.rs +++ b/src/unix/solarish/x86_64.rs @@ -90,9 +90,7 @@ s_no_extra_traits! { #[cfg(target_os = "solaris")] pub uc_xrs: solaris::xrs_t, #[cfg(target_os = "solaris")] - pub uc_lwpid: ::c_uint, - #[cfg(target_os = "solaris")] - pub uc_filler: [::c_long; 2], + pub uc_filler: [::c_long; 3], } }