@@ -128,6 +128,7 @@ pub(crate) use libc::ipv6_mreq as Ipv6Mreq;
128
128
target_os = "solaris" ,
129
129
target_os = "haiku" ,
130
130
target_os = "espidf" ,
131
+ target_os = "vita" ,
131
132
) ) ) ]
132
133
pub ( crate ) use libc:: IPV6_RECVTCLASS ;
133
134
#[ cfg( all( feature = "all" , not( any( target_os = "redox" , target_os = "espidf" ) ) ) ) ]
@@ -144,6 +145,7 @@ pub(crate) use libc::IP_HDRINCL;
144
145
target_os = "haiku" ,
145
146
target_os = "nto" ,
146
147
target_os = "espidf" ,
148
+ target_os = "vita" ,
147
149
) ) ) ]
148
150
pub ( crate ) use libc:: IP_RECVTOS ;
149
151
#[ cfg( not( any(
@@ -183,6 +185,7 @@ pub(crate) use libc::{
183
185
target_os = "fuchsia" ,
184
186
target_os = "nto" ,
185
187
target_os = "espidf" ,
188
+ target_os = "vita" ,
186
189
) ) ) ]
187
190
pub ( crate ) use libc:: {
188
191
ip_mreq_source as IpMreqSource , IP_ADD_SOURCE_MEMBERSHIP , IP_DROP_SOURCE_MEMBERSHIP ,
@@ -255,6 +258,7 @@ use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
255
258
target_os = "openbsd" ,
256
259
target_os = "tvos" ,
257
260
target_os = "watchos" ,
261
+ target_os = "vita" ,
258
262
) ) ) ]
259
263
use libc:: TCP_KEEPIDLE as KEEPALIVE_TIME ;
260
264
@@ -335,6 +339,7 @@ type IovLen = usize;
335
339
target_os = "tvos" ,
336
340
target_os = "watchos" ,
337
341
target_os = "espidf" ,
342
+ target_os = "vita" ,
338
343
) ) ]
339
344
type IovLen = c_int ;
340
345
@@ -928,12 +933,20 @@ pub(crate) fn try_clone(fd: Socket) -> io::Result<Socket> {
928
933
syscall ! ( fcntl( fd, libc:: F_DUPFD_CLOEXEC , 0 ) )
929
934
}
930
935
931
- #[ cfg( all( feature = "all" , unix) ) ]
936
+ #[ cfg( all( feature = "all" , unix, not ( target_os = "vita" ) ) ) ]
932
937
pub ( crate ) fn nonblocking ( fd : Socket ) -> io:: Result < bool > {
933
938
let file_status_flags = fcntl_get ( fd, libc:: F_GETFL ) ?;
934
939
Ok ( ( file_status_flags & libc:: O_NONBLOCK ) != 0 )
935
940
}
936
941
942
+ #[ cfg( target_os = "vita" ) ]
943
+ pub ( crate ) fn nonblocking ( fd : Socket ) -> io:: Result < bool > {
944
+ unsafe {
945
+ getsockopt :: < Bool > ( fd, libc:: SOL_SOCKET , libc:: SO_NONBLOCK ) . map ( |non_block| non_block != 0 )
946
+ }
947
+ }
948
+
949
+ #[ cfg( not( target_os = "vita" ) ) ]
937
950
pub ( crate ) fn set_nonblocking ( fd : Socket , nonblocking : bool ) -> io:: Result < ( ) > {
938
951
if nonblocking {
939
952
fcntl_add ( fd, libc:: F_GETFL , libc:: F_SETFL , libc:: O_NONBLOCK )
@@ -942,6 +955,18 @@ pub(crate) fn set_nonblocking(fd: Socket, nonblocking: bool) -> io::Result<()> {
942
955
}
943
956
}
944
957
958
+ #[ cfg( target_os = "vita" ) ]
959
+ pub ( crate ) fn set_nonblocking ( fd : Socket , nonblocking : bool ) -> io:: Result < ( ) > {
960
+ unsafe {
961
+ setsockopt (
962
+ fd,
963
+ libc:: SOL_SOCKET ,
964
+ libc:: SO_NONBLOCK ,
965
+ nonblocking as libc:: c_int ,
966
+ )
967
+ }
968
+ }
969
+
945
970
pub ( crate ) fn shutdown ( fd : Socket , how : Shutdown ) -> io:: Result < ( ) > {
946
971
let how = match how {
947
972
Shutdown :: Write => libc:: SHUT_WR ,
@@ -1118,10 +1143,16 @@ fn into_timeval(duration: Option<Duration>) -> libc::timeval {
1118
1143
}
1119
1144
}
1120
1145
1121
- #[ cfg( all( feature = "all" , not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ) ]
1146
+ #[ cfg( all(
1147
+ feature = "all" ,
1148
+ not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "vita" ) )
1149
+ ) ) ]
1122
1150
#[ cfg_attr(
1123
1151
docsrs,
1124
- doc( cfg( all( feature = "all" , not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ) )
1152
+ doc( cfg( all(
1153
+ feature = "all" ,
1154
+ not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "vita" ) )
1155
+ ) ) )
1125
1156
) ]
1126
1157
pub ( crate ) fn keepalive_time ( fd : Socket ) -> io:: Result < Duration > {
1127
1158
unsafe {
@@ -1132,7 +1163,12 @@ pub(crate) fn keepalive_time(fd: Socket) -> io::Result<Duration> {
1132
1163
1133
1164
#[ allow( unused_variables) ]
1134
1165
pub ( crate ) fn set_tcp_keepalive ( fd : Socket , keepalive : & TcpKeepalive ) -> io:: Result < ( ) > {
1135
- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
1166
+ #[ cfg( not( any(
1167
+ target_os = "haiku" ,
1168
+ target_os = "openbsd" ,
1169
+ target_os = "nto" ,
1170
+ target_os = "vita"
1171
+ ) ) ) ]
1136
1172
if let Some ( time) = keepalive. time {
1137
1173
let secs = into_secs ( time) ;
1138
1174
unsafe { setsockopt ( fd, libc:: IPPROTO_TCP , KEEPALIVE_TIME , secs) ? }
@@ -1172,17 +1208,24 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
1172
1208
Ok ( ( ) )
1173
1209
}
1174
1210
1175
- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
1211
+ #[ cfg( not( any(
1212
+ target_os = "haiku" ,
1213
+ target_os = "openbsd" ,
1214
+ target_os = "nto" ,
1215
+ target_os = "vita"
1216
+ ) ) ) ]
1176
1217
fn into_secs ( duration : Duration ) -> c_int {
1177
1218
min ( duration. as_secs ( ) , c_int:: MAX as u64 ) as c_int
1178
1219
}
1179
1220
1180
1221
/// Get the flags using `cmd`.
1222
+ #[ cfg( not( target_os = "vita" ) ) ]
1181
1223
fn fcntl_get ( fd : Socket , cmd : c_int ) -> io:: Result < c_int > {
1182
1224
syscall ! ( fcntl( fd, cmd) )
1183
1225
}
1184
1226
1185
1227
/// Add `flag` to the current set flags of `F_GETFD`.
1228
+ #[ cfg( not( target_os = "vita" ) ) ]
1186
1229
fn fcntl_add ( fd : Socket , get_cmd : c_int , set_cmd : c_int , flag : c_int ) -> io:: Result < ( ) > {
1187
1230
let previous = fcntl_get ( fd, get_cmd) ?;
1188
1231
let new = previous | flag;
@@ -1195,6 +1238,7 @@ fn fcntl_add(fd: Socket, get_cmd: c_int, set_cmd: c_int, flag: c_int) -> io::Res
1195
1238
}
1196
1239
1197
1240
/// Remove `flag` to the current set flags of `F_GETFD`.
1241
+ #[ cfg( not( target_os = "vita" ) ) ]
1198
1242
fn fcntl_remove ( fd : Socket , get_cmd : c_int , set_cmd : c_int , flag : c_int ) -> io:: Result < ( ) > {
1199
1243
let previous = fcntl_get ( fd, get_cmd) ?;
1200
1244
let new = previous & !flag;
@@ -1275,6 +1319,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr {
1275
1319
target_os = "solaris" ,
1276
1320
target_os = "nto" ,
1277
1321
target_os = "espidf" ,
1322
+ target_os = "vita" ,
1278
1323
) ) ) ]
1279
1324
pub ( crate ) const fn to_mreqn (
1280
1325
multiaddr : & Ipv4Addr ,
@@ -1371,12 +1416,13 @@ impl crate::Socket {
1371
1416
) ,
1372
1417
allow( rustdoc:: broken_intra_doc_links)
1373
1418
) ]
1374
- #[ cfg( feature = "all" ) ]
1419
+ #[ cfg( all ( feature = "all" , not ( target_os = "vita" ) ) ) ]
1375
1420
#[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , unix) ) ) ) ]
1376
1421
pub fn set_cloexec ( & self , close_on_exec : bool ) -> io:: Result < ( ) > {
1377
1422
self . _set_cloexec ( close_on_exec)
1378
1423
}
1379
1424
1425
+ #[ cfg( not( target_os = "vita" ) ) ]
1380
1426
pub ( crate ) fn _set_cloexec ( & self , close_on_exec : bool ) -> io:: Result < ( ) > {
1381
1427
if close_on_exec {
1382
1428
fcntl_add (
0 commit comments