@@ -233,6 +233,7 @@ fn assert_common_flags(socket: &Socket, expected: bool) {
233233 #[ cfg( windows) ]
234234 assert_flag_no_inherit ( socket, expected) ;
235235
236+ // Vita does not have process API, so neither SO_NOSIGPIPE nor FD_CLOEXEC are supported on this platform
236237 #[ cfg( target_os = "vita" ) ]
237238 {
238239 let _ = socket;
@@ -293,14 +294,32 @@ fn type_nonblocking() {
293294#[ cfg( unix) ]
294295#[ track_caller]
295296pub fn assert_nonblocking ( socket : & Socket , want : bool ) {
296- #[ cfg( any ( target_os = "vita" , all( feature = "all" , unix) ) ) ]
297+ #[ cfg( all( feature = "all" , unix) ) ]
297298 assert_eq ! ( socket. nonblocking( ) . unwrap( ) , want, "non-blocking option" ) ;
298299
299300 #[ cfg( all( not( target_os = "vita" ) , not( all( feature = "all" , unix) ) ) ) ]
300301 {
301302 let flags = unsafe { libc:: fcntl ( socket. as_raw_fd ( ) , libc:: F_GETFL ) } ;
302303 assert_eq ! ( flags & libc:: O_NONBLOCK != 0 , want, "non-blocking option" ) ;
303304 }
305+
306+ #[ cfg( all( target_os = "vita" , not( feature = "all" ) ) ) ]
307+ {
308+ let mut optval: libc:: c_int = 0 ;
309+ let mut optlen = std:: mem:: size_of :: < libc:: c_int > ( ) as libc:: socklen_t ;
310+
311+ let res = unsafe {
312+ libc:: getsockopt (
313+ socket. as_raw_fd ( ) ,
314+ libc:: SOL_SOCKET ,
315+ libc:: SO_NONBLOCK ,
316+ & mut optval as * mut libc:: c_int as _ ,
317+ & mut optlen,
318+ )
319+ } ;
320+ assert_eq ! ( res, 0 , "unable to get non-blocing option" ) ;
321+ assert_eq ! ( optval > 0 , want, "non-blocking option" ) ;
322+ }
304323}
305324
306325#[ cfg( windows) ]
@@ -871,7 +890,7 @@ fn tcp_keepalive() {
871890
872891 #[ cfg( all(
873892 feature = "all" ,
874- not( any( windows, target_os = "haiku" , target_os = "openbsd" , ) )
893+ not( any( windows, target_os = "haiku" , target_os = "openbsd" ) )
875894 ) ) ]
876895 assert_eq ! ( socket. keepalive_time( ) . unwrap( ) , Duration :: from_secs( 200 ) ) ;
877896
0 commit comments