Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2] Backports #4048

Merged
merged 6 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/full_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -214,6 +241,7 @@ jobs:
- docker_linux_tier2
- macos
- windows
- solaris
- style_check
- build_channels_linux
- build_channels_macos
Expand Down
18 changes: 18 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ fn test_solarish(target: &str) {

headers! {
cfg:
"aio.h",
"ctype.h",
"dirent.h",
"dlfcn.h",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
}
});
Expand Down Expand Up @@ -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,
}
});
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions libc-test/semver/solarish.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
AIO_ALLDONE
AIO_CANCELED
AIO_NOTCANCELED
IPV6_DONTFRAG
IPV6_PKTINFO
IPV6_RECVTCLASS
Expand All @@ -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
2 changes: 2 additions & 0 deletions src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/unix/solarish/illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
43 changes: 43 additions & 0 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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")]
Expand Down
15 changes: 15 additions & 0 deletions src/unix/solarish/solaris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions src/unix/solarish/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
}
}

Expand Down