@@ -76,6 +76,8 @@ pub(crate) use libc::{
76
76
#[ cfg( not( target_os = "redox" ) ) ]
77
77
pub ( crate ) use libc:: { MSG_TRUNC , SO_OOBINLINE } ;
78
78
// Used in `Socket`.
79
+ #[ cfg( not( target_os = "nto" ) ) ]
80
+ pub ( crate ) use libc:: ipv6_mreq as Ipv6Mreq ;
79
81
#[ cfg( not( any(
80
82
target_os = "dragonfly" ,
81
83
target_os = "fuchsia" ,
@@ -98,6 +100,7 @@ pub(crate) use libc::IP_HDRINCL;
98
100
target_os = "redox" ,
99
101
target_os = "solaris" ,
100
102
target_os = "haiku" ,
103
+ target_os = "nto" ,
101
104
) ) ) ]
102
105
pub ( crate ) use libc:: IP_RECVTOS ;
103
106
#[ cfg( not( any(
@@ -112,11 +115,11 @@ pub(crate) use libc::SO_LINGER;
112
115
#[ cfg( target_vendor = "apple" ) ]
113
116
pub ( crate ) use libc:: SO_LINGER_SEC as SO_LINGER ;
114
117
pub ( 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 ,
120
123
} ;
121
124
#[ cfg( not( any(
122
125
target_os = "dragonfly" ,
@@ -125,6 +128,7 @@ pub(crate) use libc::{
125
128
target_os = "openbsd" ,
126
129
target_os = "redox" ,
127
130
target_os = "fuchsia" ,
131
+ target_os = "nto" ,
128
132
) ) ) ]
129
133
pub ( crate ) use libc:: {
130
134
ip_mreq_source as IpMreqSource , IP_ADD_SOURCE_MEMBERSHIP , IP_DROP_SOURCE_MEMBERSHIP ,
@@ -137,6 +141,7 @@ pub(crate) use libc::{
137
141
target_os = "netbsd" ,
138
142
target_os = "openbsd" ,
139
143
target_os = "solaris" ,
144
+ target_os = "nto" ,
140
145
target_vendor = "apple"
141
146
) ) ) ]
142
147
pub ( crate ) use libc:: { IPV6_ADD_MEMBERSHIP , IPV6_DROP_MEMBERSHIP } ;
@@ -171,9 +176,14 @@ pub(crate) use libc::{TCP_KEEPCNT, TCP_KEEPINTVL};
171
176
// See this type in the Windows file.
172
177
pub ( crate ) type Bool = c_int ;
173
178
174
- #[ cfg( target_vendor = "apple" ) ]
179
+ #[ cfg( any ( target_vendor = "apple" , target_os = "nto" ) ) ]
175
180
use 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
+ ) ) ) ]
177
187
use libc:: TCP_KEEPIDLE as KEEPALIVE_TIME ;
178
188
179
189
/// Helper macro to execute a system call that returns an `io::Result`.
@@ -236,6 +246,7 @@ type IovLen = usize;
236
246
target_os = "netbsd" ,
237
247
target_os = "openbsd" ,
238
248
target_os = "solaris" ,
249
+ target_os = "nto" ,
239
250
target_vendor = "apple" ,
240
251
) ) ]
241
252
type IovLen = c_int ;
@@ -902,7 +913,7 @@ pub(crate) fn keepalive_time(fd: Socket) -> io::Result<Duration> {
902
913
903
914
#[ allow( unused_variables) ]
904
915
pub ( 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" ) ) ) ]
906
917
if let Some ( time) = keepalive. time {
907
918
let secs = into_secs ( time) ;
908
919
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
929
940
}
930
941
}
931
942
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
+
932
949
Ok ( ( ) )
933
950
}
934
951
935
- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ]
952
+ #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
936
953
fn into_secs ( duration : Duration ) -> c_int {
937
954
min ( duration. as_secs ( ) , c_int:: MAX as u64 ) as c_int
938
955
}
@@ -1032,6 +1049,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr {
1032
1049
target_os = "openbsd" ,
1033
1050
target_os = "redox" ,
1034
1051
target_os = "solaris" ,
1052
+ target_os = "nto" ,
1035
1053
) ) ) ]
1036
1054
pub ( crate ) const fn to_mreqn (
1037
1055
multiaddr : & Ipv4Addr ,
@@ -1071,7 +1089,7 @@ impl crate::Socket {
1071
1089
target_os = "illumos" ,
1072
1090
target_os = "linux" ,
1073
1091
target_os = "netbsd" ,
1074
- target_os = "openbsd"
1092
+ target_os = "openbsd" ,
1075
1093
)
1076
1094
) ) ]
1077
1095
#[ cfg_attr(
@@ -1086,7 +1104,7 @@ impl crate::Socket {
1086
1104
target_os = "illumos" ,
1087
1105
target_os = "linux" ,
1088
1106
target_os = "netbsd" ,
1089
- target_os = "openbsd"
1107
+ target_os = "openbsd" ,
1090
1108
)
1091
1109
) ) )
1092
1110
) ]
@@ -1102,7 +1120,7 @@ impl crate::Socket {
1102
1120
target_os = "illumos" ,
1103
1121
target_os = "linux" ,
1104
1122
target_os = "netbsd" ,
1105
- target_os = "openbsd"
1123
+ target_os = "openbsd" ,
1106
1124
) ) ]
1107
1125
pub ( crate ) fn _accept4 ( & self , flags : c_int ) -> io:: Result < ( crate :: Socket , SockAddr ) > {
1108
1126
// Safety: `accept4` initialises the `SockAddr` for us.
0 commit comments