Skip to content

Commit b30ec40

Browse files
committed
Auto merge of #2560 - jclulow:illumos-2021-11-22, r=Amanieu
several illumos fixes, and some additional termios constants I wanted to add some of the new baud rate constants that [we added recently](https://www.illumos.org/issues/13975). On the way there, I had to make a variety of fixes to get the tests to pass on illumos systems.
2 parents 9c7a326 + 60213e1 commit b30ec40

File tree

10 files changed

+101
-20
lines changed

10 files changed

+101
-20
lines changed

libc-test/build.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,9 @@ fn test_solarish(target: &str) {
780780
"sys/mount.h",
781781
"sys/priv.h",
782782
"sys/pset.h",
783+
"sys/random.h",
783784
"sys/resource.h",
785+
"sys/sendfile.h",
784786
"sys/socket.h",
785787
"sys/stat.h",
786788
"sys/statvfs.h",
@@ -798,6 +800,7 @@ fn test_solarish(target: &str) {
798800
"termios.h",
799801
"thread.h",
800802
"time.h",
803+
"priv.h",
801804
"ucontext.h",
802805
"unistd.h",
803806
"utime.h",
@@ -898,6 +901,15 @@ fn test_solarish(target: &str) {
898901
"door_arg_t" if field.ends_with("_ptr") => true,
899902
"door_arg_t" if field.ends_with("rbuf") => true,
900903

904+
// anonymous union challenges
905+
"fpregset_t" if field == "fp_reg_set" => true,
906+
907+
// The LX brand (integrated into some illumos distros) commandeered several of the
908+
// `uc_filler` fields to use for brand-specific state.
909+
"ucontext_t" if is_illumos && (field == "uc_filler" || field == "uc_brand_data") => {
910+
true
911+
}
912+
901913
_ => false,
902914
}
903915
});
@@ -930,6 +942,9 @@ fn test_solarish(target: &str) {
930942
"madvise" | "mprotect" if is_illumos => true,
931943
"door_call" | "door_return" | "door_create" if is_illumos => true,
932944

945+
// Not visible when build with _XOPEN_SOURCE=700
946+
"mmapobj" | "mmap64" | "meminfo" | "getpagesizes" | "getpagesizes2" => true,
947+
933948
// These functions may return int or void depending on the exact
934949
// configuration of the compilation environment, but the return
935950
// value is not useful (always 0) so we can ignore it:

libc-test/semver/apple.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ SO_NREAD
12001200
SO_NWRITE
12011201
SO_PEERLABEL
12021202
SO_RANDOMPORT
1203+
SO_REUSEPORT
12031204
SO_REUSESHAREUID
12041205
SO_TIMESTAMP
12051206
SO_TIMESTAMP_MONOTONIC

libc-test/semver/freebsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,7 @@ SO_NO_OFFLOAD
10921092
SO_PEERLABEL
10931093
SO_PROTOCOL
10941094
SO_PROTOTYPE
1095+
SO_REUSEPORT
10951096
SO_REUSEPORT_LB
10961097
SO_SETFIB
10971098
SO_TIMESTAMP

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,6 +2080,7 @@ SO_PEEK_OFF
20802080
SO_PEERCRED
20812081
SO_PEERSEC
20822082
SO_RCVBUFFORCE
2083+
SO_REUSEPORT
20832084
SO_RXQ_OVFL
20842085
SO_SNDBUFFORCE
20852086
SO_TIMESTAMP

libc-test/semver/netbsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,7 @@ SOMAXCONN
894894
SO_ACCEPTFILTER
895895
SO_NOHEADER
896896
SO_OVERFLOWED
897+
SO_REUSEPORT
897898
SO_TIMESTAMP
898899
SO_USELOOPBACK
899900
SS_DISABLE

libc-test/semver/redox.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ SO_PEERCRED
129129
SO_PEERSEC
130130
SO_PRIORITY
131131
SO_PROTOCOL
132+
SO_REUSEPORT
132133
SO_RCVBUFFORCE
133134
SO_SNDBUFFORCE
134135
TCFLSH

libc-test/semver/unix.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ SO_RCVBUF
352352
SO_RCVLOWAT
353353
SO_RCVTIMEO
354354
SO_REUSEADDR
355-
SO_REUSEPORT
356355
SO_SNDBUF
357356
SO_SNDLOWAT
358357
SO_SNDTIMEO

src/unix/solarish/illumos.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ pub const TCP_KEEPCNT: ::c_int = 35;
3333
pub const TCP_KEEPINTVL: ::c_int = 36;
3434
pub const TCP_CONGESTION: ::c_int = 37;
3535

36-
pub const F_OFD_GETLK: ::c_int = 50;
37-
pub const F_OFD_SETLKL: ::c_int = 51;
38-
pub const F_OFD_SETLKW: ::c_int = 52;
39-
pub const F_FLOCK: ::c_int = 55;
40-
pub const F_FLOCKW: ::c_int = 56;
36+
// These constants are correct for 64-bit programs or 32-bit programs that are
37+
// not using large-file mode. If Rust ever supports anything other than 64-bit
38+
// compilation on illumos, this may require adjustment:
39+
pub const F_OFD_GETLK: ::c_int = 47;
40+
pub const F_OFD_SETLK: ::c_int = 48;
41+
pub const F_OFD_SETLKW: ::c_int = 49;
42+
pub const F_FLOCK: ::c_int = 53;
43+
pub const F_FLOCKW: ::c_int = 54;
4144

4245
pub const FIL_ATTACH: ::c_int = 0x1;
4346
pub const FIL_DETACH: ::c_int = 0x2;
@@ -50,6 +53,15 @@ pub const SOL_FILTER: ::c_int = 0xfffc;
5053

5154
pub const MR_HDR_AOUT: ::c_uint = 0x3;
5255

56+
pub const B1000000: ::speed_t = 24;
57+
pub const B1152000: ::speed_t = 25;
58+
pub const B1500000: ::speed_t = 26;
59+
pub const B2000000: ::speed_t = 27;
60+
pub const B2500000: ::speed_t = 28;
61+
pub const B3000000: ::speed_t = 29;
62+
pub const B3500000: ::speed_t = 30;
63+
pub const B4000000: ::speed_t = 31;
64+
5365
extern "C" {
5466
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
5567

src/unix/solarish/mod.rs

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ s! {
429429
pub struct mmapobj_result_t {
430430
pub mr_addr: ::caddr_t,
431431
pub mr_msize: ::size_t,
432-
pub mr_fize: ::size_t,
432+
pub mr_fsize: ::size_t,
433433
pub mr_offset: ::size_t,
434434
pub mr_prot: ::c_uint,
435435
pub mr_flags: ::c_uint,
@@ -520,14 +520,16 @@ s_no_extra_traits! {
520520
}
521521

522522
#[cfg(libc_union)]
523+
#[cfg_attr(libc_align, repr(align(16)))]
523524
pub union pad128_t {
524-
pub _q: ::c_double,
525+
// pub _q in this structure would be a "long double", of 16 bytes
525526
pub _l: [i32; 4],
526527
}
527528

528529
#[cfg(libc_union)]
530+
#[cfg_attr(libc_align, repr(align(16)))]
529531
pub union upad128_t {
530-
pub _q: ::c_double,
532+
// pub _q in this structure would be a "long double", of 16 bytes
531533
pub _l: [u32; 4],
532534
}
533535
}
@@ -859,7 +861,7 @@ cfg_if! {
859861
impl PartialEq for pad128_t {
860862
fn eq(&self, other: &pad128_t) -> bool {
861863
unsafe {
862-
self._q == other._q ||
864+
// FIXME: self._q == other._q ||
863865
self._l == other._l
864866
}
865867
}
@@ -871,7 +873,7 @@ cfg_if! {
871873
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
872874
unsafe {
873875
f.debug_struct("pad128_t")
874-
.field("_q", &{self._q})
876+
// FIXME: .field("_q", &{self._q})
875877
.field("_l", &{self._l})
876878
.finish()
877879
}
@@ -881,7 +883,7 @@ cfg_if! {
881883
impl ::hash::Hash for pad128_t {
882884
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
883885
unsafe {
884-
state.write_i64(self._q as i64);
886+
// FIXME: state.write_i64(self._q as i64);
885887
self._l.hash(state);
886888
}
887889
}
@@ -890,7 +892,7 @@ cfg_if! {
890892
impl PartialEq for upad128_t {
891893
fn eq(&self, other: &upad128_t) -> bool {
892894
unsafe {
893-
self._q == other._q ||
895+
// FIXME: self._q == other._q ||
894896
self._l == other._l
895897
}
896898
}
@@ -902,7 +904,7 @@ cfg_if! {
902904
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
903905
unsafe {
904906
f.debug_struct("upad128_t")
905-
.field("_q", &{self._q})
907+
// FIXME: .field("_q", &{self._q})
906908
.field("_l", &{self._l})
907909
.finish()
908910
}
@@ -912,7 +914,7 @@ cfg_if! {
912914
impl ::hash::Hash for upad128_t {
913915
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
914916
unsafe {
915-
state.write_i64(self._q as i64);
917+
// FIXME: state.write_i64(self._q as i64);
916918
self._l.hash(state);
917919
}
918920
}
@@ -1217,7 +1219,7 @@ pub const PS_QUERY: ::c_int = -2;
12171219
pub const PS_MYID: ::c_int = -3;
12181220
pub const PS_SOFT: ::c_int = -4;
12191221
pub const PS_HARD: ::c_int = -5;
1220-
pub const PS_QUERY_TIME: ::c_int = -6;
1222+
pub const PS_QUERY_TYPE: ::c_int = -6;
12211223
pub const PS_SYSTEM: ::c_int = 1;
12221224
pub const PS_PRIVATE: ::c_int = 2;
12231225

@@ -1511,6 +1513,42 @@ pub const AF_INET_OFFLOAD: ::c_int = 30;
15111513
pub const AF_TRILL: ::c_int = 31;
15121514
pub const AF_PACKET: ::c_int = 32;
15131515

1516+
pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
1517+
pub const PF_UNIX: ::c_int = AF_UNIX;
1518+
pub const PF_LOCAL: ::c_int = PF_UNIX;
1519+
pub const PF_FILE: ::c_int = PF_UNIX;
1520+
pub const PF_INET: ::c_int = AF_INET;
1521+
pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
1522+
pub const PF_PUP: ::c_int = AF_PUP;
1523+
pub const PF_CHAOS: ::c_int = AF_CHAOS;
1524+
pub const PF_NS: ::c_int = AF_NS;
1525+
pub const PF_NBS: ::c_int = AF_NBS;
1526+
pub const PF_ECMA: ::c_int = AF_ECMA;
1527+
pub const PF_DATAKIT: ::c_int = AF_DATAKIT;
1528+
pub const PF_CCITT: ::c_int = AF_CCITT;
1529+
pub const PF_SNA: ::c_int = AF_SNA;
1530+
pub const PF_DECnet: ::c_int = AF_DECnet;
1531+
pub const PF_DLI: ::c_int = AF_DLI;
1532+
pub const PF_LAT: ::c_int = AF_LAT;
1533+
pub const PF_HYLINK: ::c_int = AF_HYLINK;
1534+
pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
1535+
pub const PF_NIT: ::c_int = AF_NIT;
1536+
pub const PF_802: ::c_int = AF_802;
1537+
pub const PF_OSI: ::c_int = AF_OSI;
1538+
pub const PF_X25: ::c_int = AF_X25;
1539+
pub const PF_OSINET: ::c_int = AF_OSINET;
1540+
pub const PF_GOSIP: ::c_int = AF_GOSIP;
1541+
pub const PF_IPX: ::c_int = AF_IPX;
1542+
pub const PF_ROUTE: ::c_int = AF_ROUTE;
1543+
pub const PF_LINK: ::c_int = AF_LINK;
1544+
pub const PF_INET6: ::c_int = AF_INET6;
1545+
pub const PF_KEY: ::c_int = AF_KEY;
1546+
pub const PF_NCA: ::c_int = AF_NCA;
1547+
pub const PF_POLICY: ::c_int = AF_POLICY;
1548+
pub const PF_INET_OFFLOAD: ::c_int = AF_INET_OFFLOAD;
1549+
pub const PF_TRILL: ::c_int = AF_TRILL;
1550+
pub const PF_PACKET: ::c_int = AF_PACKET;
1551+
15141552
pub const SOCK_DGRAM: ::c_int = 1;
15151553
pub const SOCK_STREAM: ::c_int = 2;
15161554
pub const SOCK_RAW: ::c_int = 4;
@@ -2055,6 +2093,10 @@ pub const B921600: speed_t = 23;
20552093
pub const CSTART: ::tcflag_t = 0o21;
20562094
pub const CSTOP: ::tcflag_t = 0o23;
20572095
pub const CSWTCH: ::tcflag_t = 0o32;
2096+
pub const CBAUD: ::tcflag_t = 0o17;
2097+
pub const CIBAUD: ::tcflag_t = 0o3600000;
2098+
pub const CBAUDEXT: ::tcflag_t = 0o10000000;
2099+
pub const CIBAUDEXT: ::tcflag_t = 0o20000000;
20582100
pub const CSIZE: ::tcflag_t = 0o000060;
20592101
pub const CS5: ::tcflag_t = 0;
20602102
pub const CS6: ::tcflag_t = 0o000020;
@@ -2078,20 +2120,26 @@ pub const ISTRIP: ::tcflag_t = 0o000040;
20782120
pub const INLCR: ::tcflag_t = 0o000100;
20792121
pub const IGNCR: ::tcflag_t = 0o000200;
20802122
pub const ICRNL: ::tcflag_t = 0o000400;
2123+
pub const IUCLC: ::tcflag_t = 0o001000;
20812124
pub const IXON: ::tcflag_t = 0o002000;
20822125
pub const IXOFF: ::tcflag_t = 0o010000;
20832126
pub const IXANY: ::tcflag_t = 0o004000;
20842127
pub const IMAXBEL: ::tcflag_t = 0o020000;
2128+
pub const DOSMODE: ::tcflag_t = 0o100000;
20852129
pub const OPOST: ::tcflag_t = 0o000001;
2130+
pub const OLCUC: ::tcflag_t = 0o000002;
20862131
pub const ONLCR: ::tcflag_t = 0o000004;
20872132
pub const OCRNL: ::tcflag_t = 0o000010;
20882133
pub const ONOCR: ::tcflag_t = 0o000020;
20892134
pub const ONLRET: ::tcflag_t = 0o000040;
2135+
pub const OFILL: ::tcflag_t = 0o0000100;
2136+
pub const OFDEL: ::tcflag_t = 0o0000200;
20902137
pub const CREAD: ::tcflag_t = 0o000200;
20912138
pub const PARENB: ::tcflag_t = 0o000400;
20922139
pub const PARODD: ::tcflag_t = 0o001000;
20932140
pub const HUPCL: ::tcflag_t = 0o002000;
20942141
pub const CLOCAL: ::tcflag_t = 0o004000;
2142+
pub const CRTSXOFF: ::tcflag_t = 0o10000000000;
20952143
pub const CRTSCTS: ::tcflag_t = 0o20000000000;
20962144
pub const ISIG: ::tcflag_t = 0o000001;
20972145
pub const ICANON: ::tcflag_t = 0o000002;
@@ -2813,11 +2861,13 @@ extern "C" {
28132861
pub fn getexecname() -> *const ::c_char;
28142862

28152863
pub fn gethostid() -> ::c_long;
2816-
pub fn sethostid(hostid: ::c_long) -> ::c_int;
28172864

28182865
pub fn getpflags(flags: ::c_uint) -> ::c_uint;
28192866
pub fn setpflags(flags: ::c_uint, value: ::c_uint) -> ::c_int;
2867+
}
28202868

2869+
#[link(name = "sendfile")]
2870+
extern "C" {
28212871
pub fn sendfile(out_fd: ::c_int, in_fd: ::c_int, off: *mut ::off_t, len: ::size_t)
28222872
-> ::ssize_t;
28232873
pub fn sendfilev(

src/unix/solarish/x86_64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ s_no_extra_traits! {
3232

3333
pub struct mcontext_t {
3434
pub gregs: [::greg_t; 28],
35-
pub fpgregs: fpregset_t,
35+
pub fpregs: fpregset_t,
3636
}
3737

3838
pub struct ucontext_t {
@@ -89,15 +89,15 @@ cfg_if! {
8989
impl PartialEq for mcontext_t {
9090
fn eq(&self, other: &mcontext_t) -> bool {
9191
self.gregs == other.gregs &&
92-
self.fpgregs == other.fpgregs
92+
self.fpregs == other.fpregs
9393
}
9494
}
9595
impl Eq for mcontext_t {}
9696
impl ::fmt::Debug for mcontext_t {
9797
fn fmt(&self, f:&mut ::fmt::Formatter) -> ::fmt::Result {
9898
f.debug_struct("mcontext_t")
9999
.field("gregs", &self.gregs)
100-
.field("fpgregs", &self.fpgregs)
100+
.field("fpregs", &self.fpregs)
101101
.finish()
102102
}
103103
}

0 commit comments

Comments
 (0)