@@ -75,6 +75,8 @@ pub(crate) use libc::{
75
75
#[ cfg( not( target_os = "redox" ) ) ]
76
76
pub ( crate ) use libc:: { MSG_TRUNC , SO_OOBINLINE } ;
77
77
// Used in `Socket`.
78
+ #[ cfg( not( target_os = "nto" ) ) ]
79
+ pub ( crate ) use libc:: ipv6_mreq as Ipv6Mreq ;
78
80
#[ cfg( all( feature = "all" , not( target_os = "redox" ) ) ) ]
79
81
pub ( crate ) use libc:: IP_HDRINCL ;
80
82
#[ cfg( not( any(
@@ -85,6 +87,8 @@ pub(crate) use libc::IP_HDRINCL;
85
87
target_os = "openbsd" ,
86
88
target_os = "redox" ,
87
89
target_os = "solaris" ,
90
+ target_os = "haiku" ,
91
+ target_os = "nto" ,
88
92
) ) ) ]
89
93
pub ( crate ) use libc:: IP_RECVTOS ;
90
94
#[ cfg( not( any(
@@ -99,11 +103,11 @@ pub(crate) use libc::SO_LINGER;
99
103
#[ cfg( target_vendor = "apple" ) ]
100
104
pub ( crate ) use libc:: SO_LINGER_SEC as SO_LINGER ;
101
105
pub ( crate ) use libc:: {
102
- ip_mreq as IpMreq , ipv6_mreq as Ipv6Mreq , linger, IPPROTO_IP , IPPROTO_IPV6 ,
103
- IPV6_MULTICAST_HOPS , IPV6_MULTICAST_IF , IPV6_MULTICAST_LOOP , IPV6_UNICAST_HOPS , IPV6_V6ONLY ,
104
- IP_ADD_MEMBERSHIP , IP_DROP_MEMBERSHIP , IP_MULTICAST_IF , IP_MULTICAST_LOOP , IP_MULTICAST_TTL ,
105
- IP_TTL , MSG_OOB , MSG_PEEK , SOL_SOCKET , SO_BROADCAST , SO_ERROR , SO_KEEPALIVE , SO_RCVBUF ,
106
- SO_RCVTIMEO , SO_REUSEADDR , SO_SNDBUF , SO_SNDTIMEO , SO_TYPE , TCP_NODELAY ,
106
+ ip_mreq as IpMreq , linger, IPPROTO_IP , IPPROTO_IPV6 , IPV6_MULTICAST_HOPS , IPV6_MULTICAST_IF ,
107
+ IPV6_MULTICAST_LOOP , IPV6_UNICAST_HOPS , IPV6_V6ONLY , IP_ADD_MEMBERSHIP , IP_DROP_MEMBERSHIP ,
108
+ IP_MULTICAST_IF , IP_MULTICAST_LOOP , IP_MULTICAST_TTL , IP_TTL , MSG_OOB , MSG_PEEK , SOL_SOCKET ,
109
+ SO_BROADCAST , SO_ERROR , SO_KEEPALIVE , SO_RCVBUF , SO_RCVTIMEO , SO_REUSEADDR , SO_SNDBUF ,
110
+ SO_SNDTIMEO , SO_TYPE , TCP_NODELAY ,
107
111
} ;
108
112
#[ cfg( not( any(
109
113
target_os = "dragonfly" ,
@@ -112,6 +116,7 @@ pub(crate) use libc::{
112
116
target_os = "openbsd" ,
113
117
target_os = "redox" ,
114
118
target_os = "fuchsia" ,
119
+ target_os = "nto" ,
115
120
) ) ) ]
116
121
pub ( crate ) use libc:: {
117
122
ip_mreq_source as IpMreqSource , IP_ADD_SOURCE_MEMBERSHIP , IP_DROP_SOURCE_MEMBERSHIP ,
@@ -124,6 +129,7 @@ pub(crate) use libc::{
124
129
target_os = "netbsd" ,
125
130
target_os = "openbsd" ,
126
131
target_os = "solaris" ,
132
+ target_os = "nto" ,
127
133
target_vendor = "apple"
128
134
) ) ) ]
129
135
pub ( crate ) use libc:: { IPV6_ADD_MEMBERSHIP , IPV6_DROP_MEMBERSHIP } ;
@@ -158,9 +164,14 @@ pub(crate) use libc::{TCP_KEEPCNT, TCP_KEEPINTVL};
158
164
// See this type in the Windows file.
159
165
pub ( crate ) type Bool = c_int ;
160
166
161
- #[ cfg( target_vendor = "apple" ) ]
167
+ #[ cfg( any ( target_vendor = "apple" , target_os = "nto" ) ) ]
162
168
use libc:: TCP_KEEPALIVE as KEEPALIVE_TIME ;
163
- #[ cfg( not( any( target_vendor = "apple" , target_os = "haiku" , target_os = "openbsd" ) ) ) ]
169
+ #[ cfg( not( any(
170
+ target_vendor = "apple" ,
171
+ target_os = "haiku" ,
172
+ target_os = "openbsd" ,
173
+ target_os = "nto" ,
174
+ ) ) ) ]
164
175
use libc:: TCP_KEEPIDLE as KEEPALIVE_TIME ;
165
176
166
177
/// Helper macro to execute a system call that returns an `io::Result`.
@@ -219,6 +230,7 @@ type IovLen = usize;
219
230
target_os = "netbsd" ,
220
231
target_os = "openbsd" ,
221
232
target_os = "solaris" ,
233
+ target_os = "nto" ,
222
234
target_vendor = "apple" ,
223
235
) ) ]
224
236
type IovLen = c_int ;
@@ -903,7 +915,7 @@ pub(crate) fn keepalive_time(fd: Socket) -> io::Result<Duration> {
903
915
904
916
#[ allow( unused_variables) ]
905
917
pub ( crate ) fn set_tcp_keepalive ( fd : Socket , keepalive : & TcpKeepalive ) -> io:: Result < ( ) > {
906
- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ]
918
+ #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
907
919
if let Some ( time) = keepalive. time {
908
920
let secs = into_secs ( time) ;
909
921
unsafe { setsockopt ( fd, libc:: IPPROTO_TCP , KEEPALIVE_TIME , secs) ? }
@@ -930,10 +942,16 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
930
942
}
931
943
}
932
944
945
+ #[ cfg( target_os = "nto" ) ]
946
+ if let Some ( time) = keepalive. time {
947
+ let secs = into_timeval ( Some ( time) ) ;
948
+ unsafe { setsockopt ( fd, libc:: IPPROTO_TCP , KEEPALIVE_TIME , secs) ? }
949
+ }
950
+
933
951
Ok ( ( ) )
934
952
}
935
953
936
- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ]
954
+ #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
937
955
fn into_secs ( duration : Duration ) -> c_int {
938
956
min ( duration. as_secs ( ) , c_int:: max_value ( ) as u64 ) as c_int
939
957
}
@@ -1028,6 +1046,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr {
1028
1046
target_os = "openbsd" ,
1029
1047
target_os = "redox" ,
1030
1048
target_os = "solaris" ,
1049
+ target_os = "nto" ,
1031
1050
) ) ) ]
1032
1051
pub ( crate ) fn to_mreqn (
1033
1052
multiaddr : & Ipv4Addr ,
0 commit comments