Skip to content

Commit f64e92d

Browse files
committed
fix, mostly, solaris build.
With few exceptions as newer interfaces like preadv/pwritev unsupported only on solaris.
1 parent b763d73 commit f64e92d

18 files changed

+62
-73
lines changed

changelog/2248.fixed.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed solaris build globally, also removed a subset of `InterfaceFlags` values
2+
which are of i64 type.

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ feature! {
125125

126126
#[cfg(any(linux_android,
127127
bsd,
128-
target_os = "illumos"))]
128+
solarish))]
129129
#[deny(missing_docs)]
130130
pub mod ifaddrs;
131131
#[cfg(not(target_os = "redox"))]

src/net/if_.rs

+2-22
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,6 @@ libc_bitflags!(
213213
/// Interface is offline
214214
#[cfg(solarish)]
215215
IFF_OFFLINE;
216-
#[cfg(target_os = "solaris")]
217-
IFF_COS_ENABLED;
218-
/// Prefer as source addr.
219-
#[cfg(target_os = "solaris")]
220-
IFF_PREFERRED;
221-
/// RFC3041
222-
#[cfg(target_os = "solaris")]
223-
IFF_TEMPORARY;
224-
/// MTU set with SIOCSLIFMTU
225-
#[cfg(target_os = "solaris")]
226-
IFF_FIXEDMTU;
227-
/// Cannot send / receive packets
228-
#[cfg(target_os = "solaris")]
229-
IFF_VIRTUAL;
230-
/// Local address in use
231-
#[cfg(target_os = "solaris")]
232-
IFF_DUPLICATE;
233-
/// IPMP IP interface
234-
#[cfg(target_os = "solaris")]
235-
IFF_IPMP;
236216
}
237217
);
238218

@@ -247,7 +227,7 @@ impl fmt::Display for InterfaceFlags {
247227
bsd,
248228
target_os = "fuchsia",
249229
target_os = "linux",
250-
target_os = "illumos",
230+
solarish,
251231
))]
252232
mod if_nameindex {
253233
use super::*;
@@ -374,6 +354,6 @@ mod if_nameindex {
374354
bsd,
375355
target_os = "fuchsia",
376356
target_os = "linux",
377-
target_os = "illumos",
357+
solarish,
378358
))]
379359
pub use if_nameindex::*;

src/sys/ioctl/bsd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/// The datatype used for the ioctl number
22
#[doc(hidden)]
3-
#[cfg(not(target_os = "illumos"))]
3+
#[cfg(not(solarish))]
44
pub type ioctl_num_type = ::libc::c_ulong;
55

66
#[doc(hidden)]
7-
#[cfg(target_os = "illumos")]
7+
#[cfg(solarish)]
88
pub type ioctl_num_type = ::libc::c_int;
99

1010
/// The datatype used for the 3rd argument

src/sys/ioctl/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ mod linux;
234234
#[cfg(any(linux_android, target_os = "redox"))]
235235
pub use self::linux::*;
236236

237-
#[cfg(any(bsd, target_os = "illumos", target_os = "haiku",))]
237+
#[cfg(any(bsd, solarish, target_os = "haiku",))]
238238
#[macro_use]
239239
mod bsd;
240240

241-
#[cfg(any(bsd, target_os = "illumos", target_os = "haiku",))]
241+
#[cfg(any(bsd, solarish, target_os = "haiku",))]
242242
pub use self::bsd::*;
243243

244244
/// Convert raw ioctl return value to a Nix result

src/sys/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ feature! {
3131
pub mod fanotify;
3232
}
3333

34-
#[cfg(any(bsd, linux_android, target_os = "redox", target_os = "illumos"))]
34+
#[cfg(any(bsd, linux_android, target_os = "redox", solarish))]
3535
#[cfg(feature = "ioctl")]
3636
#[cfg_attr(docsrs, doc(cfg(feature = "ioctl")))]
3737
#[macro_use]
@@ -88,7 +88,7 @@ feature! {
8888
#[cfg(not(any(
8989
target_os = "redox",
9090
target_os = "fuchsia",
91-
target_os = "illumos",
91+
solarish,
9292
target_os = "haiku"
9393
)))]
9494
feature! {
@@ -182,7 +182,7 @@ feature! {
182182
#[cfg(all(
183183
any(
184184
target_os = "freebsd",
185-
target_os = "illumos",
185+
solarish,
186186
target_os = "linux",
187187
target_os = "netbsd"
188188
),

src/sys/socket/addr.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(any(
22
bsd,
33
linux_android,
4-
target_os = "illumos",
4+
solarish,
55
target_os = "haiku",
66
target_os = "fuchsia",
77
target_os = "aix",
@@ -230,7 +230,7 @@ pub enum AddressFamily {
230230
#[cfg(bsd)]
231231
Hylink = libc::AF_HYLINK,
232232
/// Link layer interface
233-
#[cfg(any(bsd, target_os = "illumos"))]
233+
#[cfg(any(bsd, solarish))]
234234
Link = libc::AF_LINK,
235235
/// connection-oriented IP, aka ST II
236236
#[cfg(bsd)]
@@ -265,7 +265,7 @@ impl AddressFamily {
265265
libc::PF_ROUTE => Some(AddressFamily::Route),
266266
#[cfg(linux_android)]
267267
libc::AF_PACKET => Some(AddressFamily::Packet),
268-
#[cfg(any(bsd, target_os = "illumos"))]
268+
#[cfg(any(bsd, solarish))]
269269
libc::AF_LINK => Some(AddressFamily::Link),
270270
#[cfg(any(linux_android, apple_targets))]
271271
libc::AF_VSOCK => Some(AddressFamily::Vsock),
@@ -506,7 +506,7 @@ impl UnixAddr {
506506
cfg_if! {
507507
if #[cfg(any(linux_android,
508508
target_os = "fuchsia",
509-
target_os = "illumos",
509+
solarish,
510510
target_os = "redox",
511511
))]
512512
{
@@ -547,7 +547,7 @@ impl SockaddrLike for UnixAddr {
547547
cfg_if! {
548548
if #[cfg(any(linux_android,
549549
target_os = "fuchsia",
550-
target_os = "illumos",
550+
solarish,
551551
target_os = "redox",
552552
))] {
553553
let su_len = len.unwrap_or(
@@ -577,7 +577,7 @@ impl SockaddrLike for UnixAddr {
577577
cfg_if! {
578578
if #[cfg(any(linux_android,
579579
target_os = "fuchsia",
580-
target_os = "illumos",
580+
solarish,
581581
target_os = "redox",
582582
))] {
583583
self.sun_len = new_length as u8;
@@ -1101,7 +1101,7 @@ impl SockaddrLike for SockaddrStorage {
11011101
#[cfg(any(
11021102
linux_android,
11031103
target_os = "fuchsia",
1104-
target_os = "illumos",
1104+
solarish,
11051105
))]
11061106
if i32::from(ss.ss_family) == libc::AF_UNIX {
11071107
// Safe because we UnixAddr is strictly smaller than
@@ -1131,7 +1131,7 @@ impl SockaddrLike for SockaddrStorage {
11311131
libc::AF_INET6 => unsafe {
11321132
SockaddrIn6::from_raw(addr, l).map(|sin6| Self { sin6 })
11331133
},
1134-
#[cfg(any(bsd, target_os = "illumos", target_os = "haiku"))]
1134+
#[cfg(any(bsd, solarish, target_os = "haiku"))]
11351135
#[cfg(feature = "net")]
11361136
libc::AF_LINK => unsafe {
11371137
LinkAddr::from_raw(addr, l).map(|dl| Self { dl })
@@ -1158,7 +1158,7 @@ impl SockaddrLike for SockaddrStorage {
11581158
}
11591159
}
11601160

1161-
#[cfg(any(linux_android, target_os = "fuchsia", target_os = "illumos"))]
1161+
#[cfg(any(linux_android, target_os = "fuchsia", solarish))]
11621162
fn len(&self) -> libc::socklen_t {
11631163
match self.as_unix_addr() {
11641164
// The UnixAddr type knows its own length
@@ -1219,7 +1219,7 @@ impl SockaddrStorage {
12191219
cfg_if! {
12201220
if #[cfg(any(linux_android,
12211221
target_os = "fuchsia",
1222-
target_os = "illumos",
1222+
solarish,
12231223
))]
12241224
{
12251225
let p = unsafe{ &self.ss as *const libc::sockaddr_storage };
@@ -1248,7 +1248,7 @@ impl SockaddrStorage {
12481248
cfg_if! {
12491249
if #[cfg(any(linux_android,
12501250
target_os = "fuchsia",
1251-
target_os = "illumos",
1251+
solarish,
12521252
))]
12531253
{
12541254
let p = unsafe{ &self.ss as *const libc::sockaddr_storage };
@@ -1282,7 +1282,7 @@ impl SockaddrStorage {
12821282
as_link_addr, as_link_addr_mut, LinkAddr,
12831283
AddressFamily::Packet, libc::sockaddr_ll, dl}
12841284

1285-
#[cfg(any(bsd, target_os = "illumos"))]
1285+
#[cfg(any(bsd, solarish))]
12861286
#[cfg(feature = "net")]
12871287
accessors! {
12881288
as_link_addr, as_link_addr_mut, LinkAddr,
@@ -1332,7 +1332,7 @@ impl fmt::Display for SockaddrStorage {
13321332
libc::AF_INET => self.sin.fmt(f),
13331333
#[cfg(feature = "net")]
13341334
libc::AF_INET6 => self.sin6.fmt(f),
1335-
#[cfg(any(bsd, target_os = "illumos"))]
1335+
#[cfg(any(bsd, solarish))]
13361336
#[cfg(feature = "net")]
13371337
libc::AF_LINK => self.dl.fmt(f),
13381338
#[cfg(linux_android)]
@@ -1394,7 +1394,7 @@ impl Hash for SockaddrStorage {
13941394
libc::AF_INET => self.sin.hash(s),
13951395
#[cfg(feature = "net")]
13961396
libc::AF_INET6 => self.sin6.hash(s),
1397-
#[cfg(any(bsd, target_os = "illumos"))]
1397+
#[cfg(any(bsd, solarish))]
13981398
#[cfg(feature = "net")]
13991399
libc::AF_LINK => self.dl.hash(s),
14001400
#[cfg(linux_android)]
@@ -1424,7 +1424,7 @@ impl PartialEq for SockaddrStorage {
14241424
(libc::AF_INET, libc::AF_INET) => self.sin == other.sin,
14251425
#[cfg(feature = "net")]
14261426
(libc::AF_INET6, libc::AF_INET6) => self.sin6 == other.sin6,
1427-
#[cfg(any(bsd, target_os = "illumos"))]
1427+
#[cfg(any(bsd, solarish))]
14281428
#[cfg(feature = "net")]
14291429
(libc::AF_LINK, libc::AF_LINK) => self.dl == other.dl,
14301430
#[cfg(linux_android)]
@@ -1854,7 +1854,7 @@ mod datalink {
18541854
}
18551855
}
18561856

1857-
#[cfg(any(bsd, target_os = "illumos", target_os = "haiku", target_os = "aix"))]
1857+
#[cfg(any(bsd, solarish, target_os = "haiku", target_os = "aix"))]
18581858
mod datalink {
18591859
feature! {
18601860
#![feature = "net"]
@@ -2128,7 +2128,7 @@ mod tests {
21282128
mod link {
21292129
#![allow(clippy::cast_ptr_alignment)]
21302130

2131-
#[cfg(any(apple_targets, target_os = "illumos"))]
2131+
#[cfg(any(apple_targets, solarish))]
21322132
use super::super::super::socklen_t;
21332133
use super::*;
21342134

@@ -2215,9 +2215,9 @@ mod tests {
22152215
}
22162216
}
22172217

2218-
#[cfg(target_os = "illumos")]
2218+
#[cfg(solarish)]
22192219
#[test]
2220-
fn illumos_tap() {
2220+
fn solarish_tap() {
22212221
let bytes = [25u8, 0, 0, 0, 6, 0, 6, 0, 24, 101, 144, 221, 76, 176];
22222222
let ptr = bytes.as_ptr();
22232223
let sa = ptr as *const libc::sockaddr;

src/sys/socket/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,13 @@ libc_bitflags! {
256256
#[cfg(any(linux_android,
257257
freebsdlike,
258258
netbsdlike,
259-
target_os = "illumos"))]
259+
solarish))]
260260
SOCK_NONBLOCK;
261261
/// Set close-on-exec on the new descriptor
262262
#[cfg(any(linux_android,
263263
freebsdlike,
264264
netbsdlike,
265-
target_os = "illumos"))]
265+
solarish))]
266266
SOCK_CLOEXEC;
267267
/// Return `EPIPE` instead of raising `SIGPIPE`
268268
#[cfg(target_os = "netbsd")]
@@ -343,8 +343,7 @@ libc_bitflags! {
343343
#[cfg(any(linux_android,
344344
netbsdlike,
345345
target_os = "fuchsia",
346-
target_os = "freebsd",
347-
target_os = "solaris"))]
346+
target_os = "freebsd"))]
348347
MSG_WAITFORONE;
349348
}
350349
}
@@ -2156,7 +2155,7 @@ pub fn accept(sockfd: RawFd) -> Result<RawFd> {
21562155
netbsdlike,
21572156
target_os = "emscripten",
21582157
target_os = "fuchsia",
2159-
target_os = "illumos",
2158+
solarish,
21602159
target_os = "linux",
21612160
))]
21622161
pub fn accept4(sockfd: RawFd, flags: SockFlag) -> Result<RawFd> {

src/sys/time.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const fn zero_init_timespec() -> timespec {
1818
all(
1919
any(
2020
target_os = "freebsd",
21-
target_os = "illumos",
21+
solarish,
2222
target_os = "linux",
2323
target_os = "netbsd"
2424
),
@@ -97,7 +97,7 @@ pub(crate) mod timer {
9797
const TFD_TIMER_CANCEL_ON_SET = libc::TFD_TIMER_CANCEL_ON_SET;
9898
}
9999
}
100-
#[cfg(any(freebsdlike, target_os = "netbsd", target_os = "illumos"))]
100+
#[cfg(any(freebsdlike, target_os = "netbsd", solarish))]
101101
bitflags! {
102102
/// Flags that are used for arming the timer.
103103
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]

src/sys/uio.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn readv<Fd: AsFd>(fd: Fd, iov: &mut [IoSliceMut<'_>]) -> Result<usize> {
5353
/// or an error occurs. The file offset is not changed.
5454
///
5555
/// See also: [`writev`](fn.writev.html) and [`pwrite`](fn.pwrite.html)
56-
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
56+
#[cfg(not(any(target_os = "redox", target_os = "haiku", target_os = "solaris")))]
5757
pub fn pwritev<Fd: AsFd>(
5858
fd: Fd,
5959
iov: &[IoSlice<'_>],
@@ -82,7 +82,7 @@ pub fn pwritev<Fd: AsFd>(
8282
/// changed.
8383
///
8484
/// See also: [`readv`](fn.readv.html) and [`pread`](fn.pread.html)
85-
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
85+
#[cfg(not(any(target_os = "redox", target_os = "haiku", target_os = "solaris")))]
8686
// Clippy doesn't know that we need to pass iov mutably only because the
8787
// mutation happens after converting iov to a pointer
8888
#[allow(clippy::needless_pass_by_ref_mut)]

src/unistd.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ pub fn setgroups(groups: &[Gid]) -> Result<()> {
16471647
/// will only ever return the complete list or else an error.
16481648
#[cfg(not(any(
16491649
target_os = "aix",
1650-
target_os = "illumos",
1650+
solarish,
16511651
apple_targets,
16521652
target_os = "redox"
16531653
)))]
@@ -3200,9 +3200,9 @@ impl From<User> for libc::passwd {
32003200
target_os = "haiku",
32013201
)))]
32023202
pw_expire: u.expire,
3203-
#[cfg(target_os = "illumos")]
3203+
#[cfg(solarish)]
32043204
pw_age: CString::new("").unwrap().into_raw(),
3205-
#[cfg(target_os = "illumos")]
3205+
#[cfg(solarish)]
32063206
pw_comment: CString::new("").unwrap().into_raw(),
32073207
#[cfg(freebsdlike)]
32083208
pw_fields: 0,

test/sys/test_uio.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ fn test_pread() {
140140
}
141141

142142
#[test]
143-
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
143+
#[cfg(not(any(
144+
target_os = "redox",
145+
target_os = "haiku",
146+
target_os = "solaris"
147+
)))]
144148
fn test_pwritev() {
145149
use std::io::Read;
146150

@@ -175,7 +179,11 @@ fn test_pwritev() {
175179
}
176180

177181
#[test]
178-
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
182+
#[cfg(not(any(
183+
target_os = "redox",
184+
target_os = "haiku",
185+
target_os = "solaris"
186+
)))]
179187
fn test_preadv() {
180188
use std::io::Write;
181189

0 commit comments

Comments
 (0)