Skip to content

Commit 8c50519

Browse files
committed
Disable epoll support on Solaris. (#1208)
* Disable epoll support on Solaris. It appears Solaris doesn't support epoll; only Illumos does. And as of rust-lang/libc#3864, the libc crate won't declare the epoll libc interface on Solaris. So disable epoll support on Solaris in rustix too. * Add epoll documentation links for illumos. * Add a documentation reference for ptsname for illumos. * Enable the epoll tests on illumos and redox. * Enable the openpty tests on illumos.
1 parent 827830f commit 8c50519

File tree

8 files changed

+30
-12
lines changed

8 files changed

+30
-12
lines changed

Diff for: src/backend/libc/conv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub(super) fn ret_c_int(raw: c::c_int) -> io::Result<c::c_int> {
7272

7373
#[cfg(any(
7474
linux_kernel,
75-
all(solarish, feature = "event"),
75+
all(target_os = "illumos", feature = "event"),
7676
all(target_os = "redox", feature = "event")
7777
))]
7878
#[inline]

Diff for: src/backend/libc/event/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ pub(crate) mod types;
55
#[cfg_attr(windows, path = "windows_syscalls.rs")]
66
pub(crate) mod syscalls;
77

8-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
8+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
99
pub mod epoll;

Diff for: src/backend/libc/event/syscalls.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::backend::c;
55
use crate::backend::conv::ret;
66
use crate::backend::conv::ret_c_int;
77
#[cfg(feature = "alloc")]
8-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
8+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
99
use crate::backend::conv::ret_u32;
1010
#[cfg(solarish)]
1111
use crate::event::port::Event;
@@ -22,7 +22,7 @@ use crate::event::PollFd;
2222
use crate::io;
2323
#[cfg(solarish)]
2424
use crate::utils::as_mut_ptr;
25-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
25+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
2626
use crate::utils::as_ptr;
2727
#[cfg(any(
2828
all(feature = "alloc", bsd),
@@ -351,13 +351,13 @@ pub(crate) fn pause() {
351351
}
352352

353353
#[inline]
354-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
354+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
355355
pub(crate) fn epoll_create(flags: super::epoll::CreateFlags) -> io::Result<OwnedFd> {
356356
unsafe { ret_owned_fd(c::epoll_create1(bitflags_bits!(flags))) }
357357
}
358358

359359
#[inline]
360-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
360+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
361361
pub(crate) fn epoll_add(
362362
epoll: BorrowedFd<'_>,
363363
source: BorrowedFd<'_>,
@@ -378,7 +378,7 @@ pub(crate) fn epoll_add(
378378
}
379379

380380
#[inline]
381-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
381+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
382382
pub(crate) fn epoll_mod(
383383
epoll: BorrowedFd<'_>,
384384
source: BorrowedFd<'_>,
@@ -396,7 +396,7 @@ pub(crate) fn epoll_mod(
396396
}
397397

398398
#[inline]
399-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
399+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
400400
pub(crate) fn epoll_del(epoll: BorrowedFd<'_>, source: BorrowedFd<'_>) -> io::Result<()> {
401401
unsafe {
402402
ret(c::epoll_ctl(
@@ -410,7 +410,7 @@ pub(crate) fn epoll_del(epoll: BorrowedFd<'_>, source: BorrowedFd<'_>) -> io::Re
410410

411411
#[inline]
412412
#[cfg(feature = "alloc")]
413-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
413+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
414414
pub(crate) fn epoll_wait(
415415
epoll: BorrowedFd<'_>,
416416
events: &mut [MaybeUninit<crate::event::epoll::Event>],

Diff for: src/event/epoll.rs

+10
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ use core::slice;
9292
///
9393
/// # References
9494
/// - [Linux]
95+
/// - [illumos]
9596
///
9697
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_create.2.html
98+
/// [illumos]: https://www.illumos.org/man/3C/epoll_create
9799
#[inline]
98100
#[doc(alias = "epoll_create1")]
99101
pub fn create(flags: epoll::CreateFlags) -> io::Result<OwnedFd> {
@@ -114,8 +116,10 @@ pub fn create(flags: epoll::CreateFlags) -> io::Result<OwnedFd> {
114116
///
115117
/// # References
116118
/// - [Linux]
119+
/// - [illumos]
117120
///
118121
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html
122+
/// [illumos]: https://www.illumos.org/man/3C/epoll_ctl
119123
/// [faq]: https://man7.org/linux/man-pages/man7/epoll.7.html#:~:text=Will%20closing%20a%20file%20descriptor%20cause%20it%20to%20be%20removed%20from%20all%0A%20%20%20%20%20%20%20%20%20%20epoll%20interest%20lists%3F
120124
#[doc(alias = "epoll_ctl")]
121125
#[inline]
@@ -144,8 +148,10 @@ pub fn add(
144148
///
145149
/// # References
146150
/// - [Linux]
151+
/// - [illumos]
147152
///
148153
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html
154+
/// [illumos]: https://www.illumos.org/man/3C/epoll_ctl
149155
#[doc(alias = "epoll_ctl")]
150156
#[inline]
151157
pub fn modify(
@@ -171,8 +177,10 @@ pub fn modify(
171177
///
172178
/// # References
173179
/// - [Linux]
180+
/// - [illumos]
174181
///
175182
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html
183+
/// [illumos]: https://www.illumos.org/man/3C/epoll_ctl
176184
#[doc(alias = "epoll_ctl")]
177185
#[inline]
178186
pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
@@ -187,8 +195,10 @@ pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
187195
///
188196
/// # References
189197
/// - [Linux]
198+
/// - [illumos]
190199
///
191200
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_wait.2.html
201+
/// [illumos]: https://www.illumos.org/man/3C/epoll_wait
192202
#[cfg(feature = "alloc")]
193203
#[cfg_attr(docsrs, doc(cfg(feature = "alloc"), alias = "epoll_wait"))]
194204
#[inline]

Diff for: src/event/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Event operations.
22
3-
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
3+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
44
pub mod epoll;
55
#[cfg(any(
66
linux_kernel,

Diff for: src/pty.rs

+2
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ pub fn openpt(flags: OpenptFlags) -> io::Result<OwnedFd> {
114114
/// # References
115115
/// - [POSIX]
116116
/// - [Linux]
117+
/// - [illumos]
117118
/// - [glibc]
118119
///
119120
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/ptsname.html
120121
/// [Linux]: https://man7.org/linux/man-pages/man3/ptsname.3.html
122+
/// [illumos]: https://www.illumos.org/man/3C/ptsname
121123
/// [glibc]: https://sourceware.org/glibc/manual/latest/html_node/Allocation.html#index-ptsname
122124
#[cfg(all(
123125
feature = "alloc",

Diff for: tests/event/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#[cfg(not(feature = "rustc-dep-of-std"))] // TODO
66
#[cfg(feature = "net")]
7-
#[cfg(linux_kernel)]
7+
#[cfg(any(linux_kernel, target_os = "illumos", target_os = "redox"))]
88
mod epoll;
99
#[cfg(not(windows))]
1010
#[cfg(not(target_os = "wasi"))]

Diff for: tests/pty/main.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,11 @@
22
33
#![cfg(feature = "pty")]
44

5-
#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))]
5+
#[cfg(any(
6+
apple,
7+
linux_like,
8+
target_os = "freebsd",
9+
target_os = "fuchsia",
10+
target_os = "illumos"
11+
))]
612
mod openpty;

0 commit comments

Comments
 (0)