@@ -76,6 +76,8 @@ pub(crate) use libc::{
7676#[ cfg( not( target_os = "redox" ) ) ]
7777pub ( crate ) use libc:: { MSG_TRUNC , SO_OOBINLINE } ;
7878// Used in `Socket`.
79+ #[ cfg( not( target_os = "nto" ) ) ]
80+ pub ( crate ) use libc:: ipv6_mreq as Ipv6Mreq ;
7981#[ cfg( not( any(
8082 target_os = "dragonfly" ,
8183 target_os = "fuchsia" ,
@@ -98,6 +100,7 @@ pub(crate) use libc::IP_HDRINCL;
98100 target_os = "redox" ,
99101 target_os = "solaris" ,
100102 target_os = "haiku" ,
103+ target_os = "nto" ,
101104) ) ) ]
102105pub ( crate ) use libc:: IP_RECVTOS ;
103106#[ cfg( not( any(
@@ -112,11 +115,11 @@ pub(crate) use libc::SO_LINGER;
112115#[ cfg( target_vendor = "apple" ) ]
113116pub ( crate ) use libc:: SO_LINGER_SEC as SO_LINGER ;
114117pub ( crate ) use libc:: {
115- ip_mreq as IpMreq , ipv6_mreq as Ipv6Mreq , linger, IPPROTO_IP , IPPROTO_IPV6 ,
116- IPV6_MULTICAST_HOPS , IPV6_MULTICAST_IF , IPV6_MULTICAST_LOOP , IPV6_UNICAST_HOPS , IPV6_V6ONLY ,
117- IP_ADD_MEMBERSHIP , IP_DROP_MEMBERSHIP , IP_MULTICAST_IF , IP_MULTICAST_LOOP , IP_MULTICAST_TTL ,
118- IP_TTL , MSG_OOB , MSG_PEEK , SOL_SOCKET , SO_BROADCAST , SO_ERROR , SO_KEEPALIVE , SO_RCVBUF ,
119- SO_RCVTIMEO , SO_REUSEADDR , SO_SNDBUF , SO_SNDTIMEO , SO_TYPE , TCP_NODELAY ,
118+ ip_mreq as IpMreq , linger, IPPROTO_IP , IPPROTO_IPV6 , IPV6_MULTICAST_HOPS , IPV6_MULTICAST_IF ,
119+ IPV6_MULTICAST_LOOP , IPV6_UNICAST_HOPS , IPV6_V6ONLY , IP_ADD_MEMBERSHIP , IP_DROP_MEMBERSHIP ,
120+ IP_MULTICAST_IF , IP_MULTICAST_LOOP , IP_MULTICAST_TTL , IP_TTL , MSG_OOB , MSG_PEEK , SOL_SOCKET ,
121+ SO_BROADCAST , SO_ERROR , SO_KEEPALIVE , SO_RCVBUF , SO_RCVTIMEO , SO_REUSEADDR , SO_SNDBUF ,
122+ SO_SNDTIMEO , SO_TYPE , TCP_NODELAY ,
120123} ;
121124#[ cfg( not( any(
122125 target_os = "dragonfly" ,
@@ -125,6 +128,7 @@ pub(crate) use libc::{
125128 target_os = "openbsd" ,
126129 target_os = "redox" ,
127130 target_os = "fuchsia" ,
131+ target_os = "nto" ,
128132) ) ) ]
129133pub ( crate ) use libc:: {
130134 ip_mreq_source as IpMreqSource , IP_ADD_SOURCE_MEMBERSHIP , IP_DROP_SOURCE_MEMBERSHIP ,
@@ -137,6 +141,7 @@ pub(crate) use libc::{
137141 target_os = "netbsd" ,
138142 target_os = "openbsd" ,
139143 target_os = "solaris" ,
144+ target_os = "nto" ,
140145 target_vendor = "apple"
141146) ) ) ]
142147pub ( crate ) use libc:: { IPV6_ADD_MEMBERSHIP , IPV6_DROP_MEMBERSHIP } ;
@@ -171,9 +176,14 @@ pub(crate) use libc::{TCP_KEEPCNT, TCP_KEEPINTVL};
171176// See this type in the Windows file.
172177pub ( crate ) type Bool = c_int ;
173178
174- #[ cfg( target_vendor = "apple" ) ]
179+ #[ cfg( any ( target_vendor = "apple" , target_os = "nto" ) ) ]
175180use libc:: TCP_KEEPALIVE as KEEPALIVE_TIME ;
176- #[ cfg( not( any( target_vendor = "apple" , target_os = "haiku" , target_os = "openbsd" ) ) ) ]
181+ #[ cfg( not( any(
182+ target_vendor = "apple" ,
183+ target_os = "haiku" ,
184+ target_os = "openbsd" ,
185+ target_os = "nto" ,
186+ ) ) ) ]
177187use libc:: TCP_KEEPIDLE as KEEPALIVE_TIME ;
178188
179189/// Helper macro to execute a system call that returns an `io::Result`.
@@ -236,6 +246,7 @@ type IovLen = usize;
236246 target_os = "netbsd" ,
237247 target_os = "openbsd" ,
238248 target_os = "solaris" ,
249+ target_os = "nto" ,
239250 target_vendor = "apple" ,
240251) ) ]
241252type IovLen = c_int ;
@@ -902,7 +913,7 @@ pub(crate) fn keepalive_time(fd: Socket) -> io::Result<Duration> {
902913
903914#[ allow( unused_variables) ]
904915pub ( crate ) fn set_tcp_keepalive ( fd : Socket , keepalive : & TcpKeepalive ) -> io:: Result < ( ) > {
905- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ]
916+ #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
906917 if let Some ( time) = keepalive. time {
907918 let secs = into_secs ( time) ;
908919 unsafe { setsockopt ( fd, libc:: IPPROTO_TCP , KEEPALIVE_TIME , secs) ? }
@@ -929,10 +940,16 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
929940 }
930941 }
931942
943+ #[ cfg( target_os = "nto" ) ]
944+ if let Some ( time) = keepalive. time {
945+ let secs = into_timeval ( Some ( time) ) ;
946+ unsafe { setsockopt ( fd, libc:: IPPROTO_TCP , KEEPALIVE_TIME , secs) ? }
947+ }
948+
932949 Ok ( ( ) )
933950}
934951
935- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ]
952+ #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
936953fn into_secs ( duration : Duration ) -> c_int {
937954 min ( duration. as_secs ( ) , c_int:: MAX as u64 ) as c_int
938955}
@@ -1032,6 +1049,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr {
10321049 target_os = "openbsd" ,
10331050 target_os = "redox" ,
10341051 target_os = "solaris" ,
1052+ target_os = "nto" ,
10351053) ) ) ]
10361054pub ( crate ) const fn to_mreqn (
10371055 multiaddr : & Ipv4Addr ,
@@ -1071,7 +1089,7 @@ impl crate::Socket {
10711089 target_os = "illumos" ,
10721090 target_os = "linux" ,
10731091 target_os = "netbsd" ,
1074- target_os = "openbsd"
1092+ target_os = "openbsd" ,
10751093 )
10761094 ) ) ]
10771095 #[ cfg_attr(
@@ -1086,7 +1104,7 @@ impl crate::Socket {
10861104 target_os = "illumos" ,
10871105 target_os = "linux" ,
10881106 target_os = "netbsd" ,
1089- target_os = "openbsd"
1107+ target_os = "openbsd" ,
10901108 )
10911109 ) ) )
10921110 ) ]
@@ -1102,7 +1120,7 @@ impl crate::Socket {
11021120 target_os = "illumos" ,
11031121 target_os = "linux" ,
11041122 target_os = "netbsd" ,
1105- target_os = "openbsd"
1123+ target_os = "openbsd" ,
11061124 ) ) ]
11071125 pub ( crate ) fn _accept4 ( & self , flags : c_int ) -> io:: Result < ( crate :: Socket , SockAddr ) > {
11081126 // Safety: `accept4` initialises the `SockAddr` for us.
0 commit comments