@@ -128,6 +128,7 @@ pub(crate) use libc::ipv6_mreq as Ipv6Mreq;
128128 target_os = "solaris" ,
129129 target_os = "haiku" ,
130130 target_os = "espidf" ,
131+ target_os = "vita" ,
131132) ) ) ]
132133pub ( crate ) use libc:: IPV6_RECVTCLASS ;
133134#[ cfg( all( feature = "all" , not( any( target_os = "redox" , target_os = "espidf" ) ) ) ) ]
@@ -144,6 +145,7 @@ pub(crate) use libc::IP_HDRINCL;
144145 target_os = "haiku" ,
145146 target_os = "nto" ,
146147 target_os = "espidf" ,
148+ target_os = "vita" ,
147149) ) ) ]
148150pub ( crate ) use libc:: IP_RECVTOS ;
149151#[ cfg( not( any(
@@ -183,6 +185,7 @@ pub(crate) use libc::{
183185 target_os = "fuchsia" ,
184186 target_os = "nto" ,
185187 target_os = "espidf" ,
188+ target_os = "vita" ,
186189) ) ) ]
187190pub ( crate ) use libc:: {
188191 ip_mreq_source as IpMreqSource , IP_ADD_SOURCE_MEMBERSHIP , IP_DROP_SOURCE_MEMBERSHIP ,
@@ -255,6 +258,7 @@ use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
255258 target_os = "openbsd" ,
256259 target_os = "tvos" ,
257260 target_os = "watchos" ,
261+ target_os = "vita" ,
258262) ) ) ]
259263use libc:: TCP_KEEPIDLE as KEEPALIVE_TIME ;
260264
@@ -335,6 +339,7 @@ type IovLen = usize;
335339 target_os = "tvos" ,
336340 target_os = "watchos" ,
337341 target_os = "espidf" ,
342+ target_os = "vita" ,
338343) ) ]
339344type IovLen = c_int ;
340345
@@ -928,12 +933,20 @@ pub(crate) fn try_clone(fd: Socket) -> io::Result<Socket> {
928933 syscall ! ( fcntl( fd, libc:: F_DUPFD_CLOEXEC , 0 ) )
929934}
930935
931- #[ cfg( all( feature = "all" , unix) ) ]
936+ #[ cfg( all( feature = "all" , unix, not ( target_os = "vita" ) ) ) ]
932937pub ( crate ) fn nonblocking ( fd : Socket ) -> io:: Result < bool > {
933938 let file_status_flags = fcntl_get ( fd, libc:: F_GETFL ) ?;
934939 Ok ( ( file_status_flags & libc:: O_NONBLOCK ) != 0 )
935940}
936941
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" ) ) ]
937950pub ( crate ) fn set_nonblocking ( fd : Socket , nonblocking : bool ) -> io:: Result < ( ) > {
938951 if nonblocking {
939952 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<()> {
942955 }
943956}
944957
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+
945970pub ( crate ) fn shutdown ( fd : Socket , how : Shutdown ) -> io:: Result < ( ) > {
946971 let how = match how {
947972 Shutdown :: Write => libc:: SHUT_WR ,
@@ -1118,10 +1143,16 @@ fn into_timeval(duration: Option<Duration>) -> libc::timeval {
11181143 }
11191144}
11201145
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+ ) ) ]
11221150#[ cfg_attr(
11231151 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+ ) ) )
11251156) ]
11261157pub ( crate ) fn keepalive_time ( fd : Socket ) -> io:: Result < Duration > {
11271158 unsafe {
@@ -1132,7 +1163,12 @@ pub(crate) fn keepalive_time(fd: Socket) -> io::Result<Duration> {
11321163
11331164#[ allow( unused_variables) ]
11341165pub ( 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+ ) ) ) ]
11361172 if let Some ( time) = keepalive. time {
11371173 let secs = into_secs ( time) ;
11381174 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
11721208 Ok ( ( ) )
11731209}
11741210
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+ ) ) ) ]
11761217fn into_secs ( duration : Duration ) -> c_int {
11771218 min ( duration. as_secs ( ) , c_int:: MAX as u64 ) as c_int
11781219}
11791220
11801221/// Get the flags using `cmd`.
1222+ #[ cfg( not( target_os = "vita" ) ) ]
11811223fn fcntl_get ( fd : Socket , cmd : c_int ) -> io:: Result < c_int > {
11821224 syscall ! ( fcntl( fd, cmd) )
11831225}
11841226
11851227/// Add `flag` to the current set flags of `F_GETFD`.
1228+ #[ cfg( not( target_os = "vita" ) ) ]
11861229fn fcntl_add ( fd : Socket , get_cmd : c_int , set_cmd : c_int , flag : c_int ) -> io:: Result < ( ) > {
11871230 let previous = fcntl_get ( fd, get_cmd) ?;
11881231 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
11951238}
11961239
11971240/// Remove `flag` to the current set flags of `F_GETFD`.
1241+ #[ cfg( not( target_os = "vita" ) ) ]
11981242fn fcntl_remove ( fd : Socket , get_cmd : c_int , set_cmd : c_int , flag : c_int ) -> io:: Result < ( ) > {
11991243 let previous = fcntl_get ( fd, get_cmd) ?;
12001244 let new = previous & !flag;
@@ -1275,6 +1319,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr {
12751319 target_os = "solaris" ,
12761320 target_os = "nto" ,
12771321 target_os = "espidf" ,
1322+ target_os = "vita" ,
12781323) ) ) ]
12791324pub ( crate ) const fn to_mreqn (
12801325 multiaddr : & Ipv4Addr ,
@@ -1371,12 +1416,13 @@ impl crate::Socket {
13711416 ) ,
13721417 allow( rustdoc:: broken_intra_doc_links)
13731418 ) ]
1374- #[ cfg( feature = "all" ) ]
1419+ #[ cfg( all ( feature = "all" , not ( target_os = "vita" ) ) ) ]
13751420 #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , unix) ) ) ) ]
13761421 pub fn set_cloexec ( & self , close_on_exec : bool ) -> io:: Result < ( ) > {
13771422 self . _set_cloexec ( close_on_exec)
13781423 }
13791424
1425+ #[ cfg( not( target_os = "vita" ) ) ]
13801426 pub ( crate ) fn _set_cloexec ( & self , close_on_exec : bool ) -> io:: Result < ( ) > {
13811427 if close_on_exec {
13821428 fcntl_add (
0 commit comments