@@ -92,6 +92,7 @@ pub(crate) use libc::IP_HDRINCL;
92
92
target_os = "haiku" ,
93
93
target_os = "nto" ,
94
94
target_os = "espidf" ,
95
+ target_os = "vita" ,
95
96
) ) ) ]
96
97
pub ( crate ) use libc:: IP_RECVTOS ;
97
98
#[ cfg( not( any(
@@ -121,6 +122,7 @@ pub(crate) use libc::{
121
122
target_os = "fuchsia" ,
122
123
target_os = "nto" ,
123
124
target_os = "espidf" ,
125
+ target_os = "vita" ,
124
126
) ) ) ]
125
127
pub ( crate ) use libc:: {
126
128
ip_mreq_source as IpMreqSource , IP_ADD_SOURCE_MEMBERSHIP , IP_DROP_SOURCE_MEMBERSHIP ,
@@ -175,6 +177,7 @@ use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
175
177
target_os = "haiku" ,
176
178
target_os = "openbsd" ,
177
179
target_os = "nto" ,
180
+ target_os = "vita" ,
178
181
) ) ) ]
179
182
use libc:: TCP_KEEPIDLE as KEEPALIVE_TIME ;
180
183
@@ -237,6 +240,7 @@ type IovLen = usize;
237
240
target_os = "nto" ,
238
241
target_vendor = "apple" ,
239
242
target_os = "espidf" ,
243
+ target_os = "vita" ,
240
244
) ) ]
241
245
type IovLen = c_int ;
242
246
@@ -713,6 +717,7 @@ pub(crate) fn try_clone(fd: Socket) -> io::Result<Socket> {
713
717
syscall ! ( fcntl( fd, libc:: F_DUPFD_CLOEXEC , 0 ) )
714
718
}
715
719
720
+ #[ cfg( not( target_os = "vita" ) ) ]
716
721
pub ( crate ) fn set_nonblocking ( fd : Socket , nonblocking : bool ) -> io:: Result < ( ) > {
717
722
if nonblocking {
718
723
fcntl_add ( fd, libc:: F_GETFL , libc:: F_SETFL , libc:: O_NONBLOCK )
@@ -721,6 +726,18 @@ pub(crate) fn set_nonblocking(fd: Socket, nonblocking: bool) -> io::Result<()> {
721
726
}
722
727
}
723
728
729
+ #[ cfg( target_os = "vita" ) ]
730
+ pub ( crate ) fn set_nonblocking ( fd : Socket , nonblocking : bool ) -> io:: Result < ( ) > {
731
+ unsafe {
732
+ setsockopt (
733
+ fd,
734
+ libc:: SOL_SOCKET ,
735
+ libc:: SO_NONBLOCK ,
736
+ nonblocking as libc:: c_int ,
737
+ )
738
+ }
739
+ }
740
+
724
741
pub ( crate ) fn shutdown ( fd : Socket , how : Shutdown ) -> io:: Result < ( ) > {
725
742
let how = match how {
726
743
Shutdown :: Write => libc:: SHUT_WR ,
@@ -923,7 +940,7 @@ fn into_timeval(duration: Option<Duration>) -> libc::timeval {
923
940
}
924
941
925
942
#[ cfg( feature = "all" ) ]
926
- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ]
943
+ #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "vita" ) ) ) ]
927
944
pub ( crate ) fn keepalive_time ( fd : Socket ) -> io:: Result < Duration > {
928
945
unsafe {
929
946
getsockopt :: < c_int > ( fd, IPPROTO_TCP , KEEPALIVE_TIME )
@@ -933,7 +950,12 @@ pub(crate) fn keepalive_time(fd: Socket) -> io::Result<Duration> {
933
950
934
951
#[ allow( unused_variables) ]
935
952
pub ( crate ) fn set_tcp_keepalive ( fd : Socket , keepalive : & TcpKeepalive ) -> io:: Result < ( ) > {
936
- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
953
+ #[ cfg( not( any(
954
+ target_os = "haiku" ,
955
+ target_os = "openbsd" ,
956
+ target_os = "nto" ,
957
+ target_os = "vita"
958
+ ) ) ) ]
937
959
if let Some ( time) = keepalive. time {
938
960
let secs = into_secs ( time) ;
939
961
unsafe { setsockopt ( fd, libc:: IPPROTO_TCP , KEEPALIVE_TIME , secs) ? }
@@ -969,12 +991,18 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
969
991
Ok ( ( ) )
970
992
}
971
993
972
- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
994
+ #[ cfg( not( any(
995
+ target_os = "haiku" ,
996
+ target_os = "openbsd" ,
997
+ target_os = "nto" ,
998
+ target_os = "vita"
999
+ ) ) ) ]
973
1000
fn into_secs ( duration : Duration ) -> c_int {
974
1001
min ( duration. as_secs ( ) , c_int:: max_value ( ) as u64 ) as c_int
975
1002
}
976
1003
977
1004
/// Add `flag` to the current set flags of `F_GETFD`.
1005
+ #[ cfg( not( target_os = "vita" ) ) ]
978
1006
fn fcntl_add ( fd : Socket , get_cmd : c_int , set_cmd : c_int , flag : c_int ) -> io:: Result < ( ) > {
979
1007
let previous = syscall ! ( fcntl( fd, get_cmd) ) ?;
980
1008
let new = previous | flag;
@@ -987,6 +1015,7 @@ fn fcntl_add(fd: Socket, get_cmd: c_int, set_cmd: c_int, flag: c_int) -> io::Res
987
1015
}
988
1016
989
1017
/// Remove `flag` to the current set flags of `F_GETFD`.
1018
+ #[ cfg( not( target_os = "vita" ) ) ]
990
1019
fn fcntl_remove ( fd : Socket , get_cmd : c_int , set_cmd : c_int , flag : c_int ) -> io:: Result < ( ) > {
991
1020
let previous = syscall ! ( fcntl( fd, get_cmd) ) ?;
992
1021
let new = previous & !flag;
@@ -1066,6 +1095,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr {
1066
1095
target_os = "solaris" ,
1067
1096
target_os = "nto" ,
1068
1097
target_os = "espidf" ,
1098
+ target_os = "vita" ,
1069
1099
) ) ) ]
1070
1100
pub ( crate ) fn to_mreqn (
1071
1101
multiaddr : & Ipv4Addr ,
@@ -1152,12 +1182,13 @@ impl crate::Socket {
1152
1182
/// # Notes
1153
1183
///
1154
1184
/// On supported platforms you can use [`Type::cloexec`].
1155
- #[ cfg( feature = "all" ) ]
1156
- #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , unix) ) ) ) ]
1185
+ #[ cfg( all ( feature = "all" , not ( target_os = "vita" ) ) ) ]
1186
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , unix, not ( target_os = "vita" ) ) ) ) ) ]
1157
1187
pub fn set_cloexec ( & self , close_on_exec : bool ) -> io:: Result < ( ) > {
1158
1188
self . _set_cloexec ( close_on_exec)
1159
1189
}
1160
1190
1191
+ #[ cfg( not( target_os = "vita" ) ) ]
1161
1192
pub ( crate ) fn _set_cloexec ( & self , close_on_exec : bool ) -> io:: Result < ( ) > {
1162
1193
if close_on_exec {
1163
1194
fcntl_add (
0 commit comments