Skip to content

Commit 1eb76a8

Browse files
authored
Merge pull request #4048 from tgross35/backport-yam
[0.2] Backports
2 parents bea7771 + 8294423 commit 1eb76a8

File tree

11 files changed

+147
-3
lines changed

11 files changed

+147
-3
lines changed

.github/workflows/full_ci.yml

+28
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,33 @@ jobs:
194194
- name: Execute run-docker.sh
195195
run: sh ./ci/run-docker.sh ${{ matrix.target }}
196196

197+
solaris:
198+
name: Solaris
199+
runs-on: ubuntu-latest
200+
strategy:
201+
fail-fast: true
202+
matrix:
203+
target:
204+
- x86_64-pc-solaris
205+
steps:
206+
- uses: actions/checkout@v4
207+
- name: test on Solaris
208+
uses: vmactions/solaris-vm@v1
209+
with:
210+
release: "11.4-gcc"
211+
usesh: true
212+
mem: 4096
213+
copyback: false
214+
prepare: |
215+
source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install)
216+
echo "~~~~ rustc --version ~~~~"
217+
rustc --version
218+
echo "~~~~ Solaris-version ~~~~"
219+
uname -a
220+
run: |
221+
export PATH=$HOME/.rust_solaris/bin:$PATH
222+
bash ./ci/run.sh ${{ matrix.target }}
223+
197224
check_cfg:
198225
name: "Check #[cfg]s"
199226
runs-on: ubuntu-22.04
@@ -214,6 +241,7 @@ jobs:
214241
- docker_linux_tier2
215242
- macos
216243
- windows
244+
- solaris
217245
- style_check
218246
- build_channels_linux
219247
- build_channels_macos

libc-test/build.rs

+18
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ fn test_solarish(target: &str) {
847847

848848
headers! {
849849
cfg:
850+
"aio.h",
850851
"ctype.h",
851852
"dirent.h",
852853
"dlfcn.h",
@@ -1009,6 +1010,11 @@ fn test_solarish(target: &str) {
10091010
}
10101011
});
10111012

1013+
cfg.skip_field_type(move |struct_, field| {
1014+
// aio_buf is "volatile void*"
1015+
struct_ == "aiocb" && field == "aio_buf"
1016+
});
1017+
10121018
cfg.skip_field(move |s, field| {
10131019
match s {
10141020
// C99 sizing on this is tough
@@ -1064,6 +1070,9 @@ fn test_solarish(target: &str) {
10641070
// const-ness issues
10651071
"execv" | "execve" | "execvp" | "settimeofday" | "sethostname" => true,
10661072

1073+
// FIXME(1.0): https://github.com/rust-lang/libc/issues/1272
1074+
"fexecve" => true,
1075+
10671076
// Solaris-different
10681077
"getpwent_r" | "getgrent_r" | "updwtmpx" if is_illumos => true,
10691078
"madvise" | "mprotect" if is_illumos => true,
@@ -1087,6 +1096,12 @@ fn test_solarish(target: &str) {
10871096
// excluded from the tests.
10881097
"getifaddrs" if is_illumos => true,
10891098

1099+
// FIXME: Our API is unsound. The Rust API allows aliasing
1100+
// pointers, but the C API requires pointers not to alias.
1101+
// We should probably be at least using `&`/`&mut` here, see:
1102+
// https://github.com/gnzlbg/ctest/issues/68
1103+
"lio_listio" => true,
1104+
10901105
_ => false,
10911106
}
10921107
});
@@ -2585,6 +2600,9 @@ fn test_freebsd(target: &str) {
25852600
// FIXME: The values has been changed in FreeBSD 15:
25862601
"CLOCK_BOOTTIME" if Some(15) <= freebsd_ver => true,
25872602

2603+
// Added in FreeBSD 14.0
2604+
"TCP_FUNCTION_ALIAS" if Some(14) > freebsd_ver => true,
2605+
25882606
_ => false,
25892607
}
25902608
});

libc-test/semver/freebsd.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,8 @@ TCP_DELACK
15051505
TCP_FASTOPEN
15061506
TCP_FASTOPEN_PSK_LEN
15071507
TCP_FIN_IS_RST
1508+
TCP_FUNCTION_ALIAS
1509+
TCP_FUNCTION_BLK
15081510
TCP_FUNCTION_NAME_LEN_MAX
15091511
TCP_IDLE_REDUCE
15101512
TCP_INFO

libc-test/semver/solarish.txt

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
AIO_ALLDONE
2+
AIO_CANCELED
3+
AIO_NOTCANCELED
14
IPV6_DONTFRAG
25
IPV6_PKTINFO
36
IPV6_RECVTCLASS
@@ -6,9 +9,26 @@ IP_DONTFRAG
69
IP_PKTINFO
710
IP_TOS
811
IP_TTL
12+
LIO_NOP
13+
LIO_NOWAIT
14+
LIO_READ
15+
LIO_WAIT
16+
LIO_WRITE
917
PIPE_BUF
18+
SIGEV_PORT
19+
aio_cancel
20+
aio_error
21+
aio_fsync
22+
aio_read
23+
aio_result_t
24+
aio_return
25+
aio_suspend
26+
aio_waitn
27+
aio_write
28+
aiocb
1029
bind
1130
in6_pktinfo
1231
in_pktinfo
32+
lio_listio
1333
recvmsg
1434
sendmsg

src/unix/aix/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,8 @@ pub const RTLD_LAZY: ::c_int = 0x4;
708708
pub const RTLD_NOW: ::c_int = 0x2;
709709
pub const RTLD_GLOBAL: ::c_int = 0x10000;
710710
pub const RTLD_LOCAL: ::c_int = 0x80000;
711+
pub const RTLD_MEMBER: ::c_int = 0x40000;
712+
pub const RTLD_NOAUTODEFER: ::c_int = 0x20000;
711713
pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void;
712714
pub const RTLD_MYSELF: *mut ::c_void = -2isize as *mut ::c_void;
713715
pub const RTLD_NEXT: *mut ::c_void = -3isize as *mut ::c_void;

src/unix/bsd/freebsdlike/freebsd/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3895,6 +3895,8 @@ pub const TCP_KEEPINIT: ::c_int = 128;
38953895
pub const TCP_FASTOPEN: ::c_int = 1025;
38963896
pub const TCP_PCAP_OUT: ::c_int = 2048;
38973897
pub const TCP_PCAP_IN: ::c_int = 4096;
3898+
pub const TCP_FUNCTION_BLK: ::c_int = 8192;
3899+
pub const TCP_FUNCTION_ALIAS: ::c_int = 8193;
38983900
pub const TCP_FASTOPEN_PSK_LEN: ::c_int = 16;
38993901
pub const TCP_FUNCTION_NAME_LEN_MAX: ::c_int = 32;
39003902

src/unix/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,9 @@ cfg_if! {
14921492
all(target_os = "macos", target_arch = "x86"),
14931493
link_name = "confstr$UNIX2003"
14941494
)]
1495+
#[cfg_attr(target_os = "solaris",
1496+
link_name = "__confstr_xpg7"
1497+
)]
14951498
pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t;
14961499
}
14971500
}

src/unix/solarish/illumos.rs

+13
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ pub type lgrp_rsrc_t = ::c_int;
1010
pub type lgrp_affinity_t = ::c_int;
1111

1212
s! {
13+
pub struct aiocb {
14+
pub aio_fildes: ::c_int,
15+
pub aio_buf: *mut ::c_void,
16+
pub aio_nbytes: ::size_t,
17+
pub aio_offset: ::off_t,
18+
pub aio_reqprio: ::c_int,
19+
pub aio_sigevent: ::sigevent,
20+
pub aio_lio_opcode: ::c_int,
21+
pub aio_resultp: ::aio_result_t,
22+
pub aio_state: ::c_int,
23+
pub aio__pad: [::c_int; 1],
24+
}
25+
1326
pub struct shmid_ds {
1427
pub shm_perm: ::ipc_perm,
1528
pub shm_segsz: ::size_t,

src/unix/solarish/mod.rs

+43
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,11 @@ s! {
420420
pub portnfy_user: *mut ::c_void,
421421
}
422422

423+
pub struct aio_result_t {
424+
pub aio_return: ::ssize_t,
425+
pub aio_errno: ::c_int,
426+
}
427+
423428
pub struct exit_status {
424429
e_termination: ::c_short,
425430
e_exit: ::c_short,
@@ -1133,9 +1138,19 @@ pub const SIG_BLOCK: ::c_int = 1;
11331138
pub const SIG_UNBLOCK: ::c_int = 2;
11341139
pub const SIG_SETMASK: ::c_int = 3;
11351140

1141+
pub const AIO_CANCELED: ::c_int = 0;
1142+
pub const AIO_ALLDONE: ::c_int = 1;
1143+
pub const AIO_NOTCANCELED: ::c_int = 2;
1144+
pub const LIO_NOP: ::c_int = 0;
1145+
pub const LIO_READ: ::c_int = 1;
1146+
pub const LIO_WRITE: ::c_int = 2;
1147+
pub const LIO_NOWAIT: ::c_int = 0;
1148+
pub const LIO_WAIT: ::c_int = 1;
1149+
11361150
pub const SIGEV_NONE: ::c_int = 1;
11371151
pub const SIGEV_SIGNAL: ::c_int = 2;
11381152
pub const SIGEV_THREAD: ::c_int = 3;
1153+
pub const SIGEV_PORT: ::c_int = 4;
11391154

11401155
pub const CLD_EXITED: ::c_int = 1;
11411156
pub const CLD_KILLED: ::c_int = 2;
@@ -3045,9 +3060,37 @@ extern "C" {
30453060

30463061
pub fn sync();
30473062

3063+
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
3064+
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
3065+
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
3066+
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
3067+
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
3068+
pub fn aio_suspend(
3069+
aiocb_list: *const *const aiocb,
3070+
nitems: ::c_int,
3071+
timeout: *const ::timespec,
3072+
) -> ::c_int;
3073+
pub fn aio_waitn(
3074+
aiocb_list: *mut *mut aiocb,
3075+
nent: ::c_uint,
3076+
nwait: *mut ::c_uint,
3077+
timeout: *const ::timespec,
3078+
) -> ::c_int;
3079+
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
3080+
pub fn lio_listio(
3081+
mode: ::c_int,
3082+
aiocb_list: *const *mut aiocb,
3083+
nitems: ::c_int,
3084+
sevp: *mut sigevent,
3085+
) -> ::c_int;
3086+
30483087
pub fn __major(version: ::c_int, devnum: ::dev_t) -> ::major_t;
30493088
pub fn __minor(version: ::c_int, devnum: ::dev_t) -> ::minor_t;
30503089
pub fn __makedev(version: ::c_int, majdev: ::major_t, mindev: ::minor_t) -> ::dev_t;
3090+
3091+
pub fn arc4random() -> u32;
3092+
pub fn arc4random_buf(buf: *mut ::c_void, nbytes: ::size_t);
3093+
pub fn arc4random_uniform(upper_bound: u32) -> u32;
30513094
}
30523095

30533096
#[link(name = "sendfile")]

src/unix/solarish/solaris.rs

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ e! {
2020
}
2121

2222
s! {
23+
pub struct aiocb {
24+
pub aio_fildes: ::c_int,
25+
pub aio_buf: *mut ::c_void,
26+
pub aio_nbytes: ::size_t,
27+
pub aio_offset: ::off_t,
28+
pub aio_reqprio: ::c_int,
29+
pub aio_sigevent: ::sigevent,
30+
pub aio_lio_opcode: ::c_int,
31+
pub aio_resultp: ::aio_result_t,
32+
pub aio_state: ::c_char,
33+
pub aio_returned: ::c_char,
34+
pub aio__pad1: [::c_char; 2],
35+
pub aio_flags: ::c_int,
36+
}
37+
2338
pub struct shmid_ds {
2439
pub shm_perm: ::ipc_perm,
2540
pub shm_segsz: ::size_t,

src/unix/solarish/x86_64.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ s_no_extra_traits! {
9090
#[cfg(target_os = "solaris")]
9191
pub uc_xrs: solaris::xrs_t,
9292
#[cfg(target_os = "solaris")]
93-
pub uc_lwpid: ::c_uint,
94-
#[cfg(target_os = "solaris")]
95-
pub uc_filler: [::c_long; 2],
93+
pub uc_filler: [::c_long; 3],
9694
}
9795
}
9896

0 commit comments

Comments
 (0)