-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add support for QNX Neutrino to master branch #2
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QNX support ipv6. Did we not implement it in std::net?
I think libc is missing symbols (multicast?) that I did not find in the c header files |
Interesting. I'll try building and see what I find. |
Ah, OK, I thought you had yanked out all ipv6 support but I see now that the v6 mreq was only for membership which isn't supported. Makes sense. QNX does support a TCP_KEEPALIVE, it's just implemented via a timespec. Perhaps something like this: index 706a463..0b08a0f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -388,7 +388,7 @@ impl<'a> DerefMut for MaybeUninitSlice<'a> {
/// See [`Socket::set_tcp_keepalive`].
#[derive(Debug, Clone)]
pub struct TcpKeepalive {
- #[cfg_attr(any(target_os = "openbsd", target_os = "nto"), allow(dead_code))]
+ #[cfg_attr(target_os = "openbsd", allow(dead_code))]
time: Option<Duration>,
#[cfg(not(any(
target_os = "openbsd",
diff --git a/src/sys/unix.rs b/src/sys/unix.rs
index bb33ea4..47b3674 100644
--- a/src/sys/unix.rs
+++ b/src/sys/unix.rs
@@ -176,7 +176,7 @@ pub(crate) use libc::{TCP_KEEPCNT, TCP_KEEPINTVL};
// See this type in the Windows file.
pub(crate) type Bool = c_int;
-#[cfg(target_vendor = "apple")]
+#[cfg(any(target_vendor = "apple", target_os = "nto"))]
use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
#[cfg(not(any(
target_vendor = "apple",
@@ -919,6 +919,12 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
unsafe { setsockopt(fd, libc::IPPROTO_TCP, KEEPALIVE_TIME, secs)? }
}
+ #[cfg(target_os = "nto")]
+ if let Some(time) = keepalive.time {
+ let secs = into_timeval(Some(time));
+ unsafe { setsockopt(fd, libc::IPPROTO_TCP, KEEPALIVE_TIME, secs)? }
+ }
+
#[cfg(any(
target_os = "android",
target_os = "dragonfly", |
c3f20e5
to
62da168
Compare
Great, thank you so much! Your proposal is now included and I will check for the same change in the |
62da168
to
2579c7b
Compare
|
I can't seem to create a review for this one. Yep, there is no accept4 on QNX. Change accepted. |
e0cbb76
to
2579c7b
Compare
@gh-tr This is your patch plus fixes for compiler warnings.
⚠️ There have been some merge conflicts ⚠️