@@ -233,6 +233,7 @@ fn assert_common_flags(socket: &Socket, expected: bool) {
233
233
#[ cfg( windows) ]
234
234
assert_flag_no_inherit ( socket, expected) ;
235
235
236
+ // Vita does not have process API, so neither SO_NOSIGPIPE nor FD_CLOEXEC are supported on this platform
236
237
#[ cfg( target_os = "vita" ) ]
237
238
{
238
239
let _ = socket;
@@ -293,14 +294,32 @@ fn type_nonblocking() {
293
294
#[ cfg( unix) ]
294
295
#[ track_caller]
295
296
pub fn assert_nonblocking ( socket : & Socket , want : bool ) {
296
- #[ cfg( any ( target_os = "vita" , all( feature = "all" , unix) ) ) ]
297
+ #[ cfg( all( feature = "all" , unix) ) ]
297
298
assert_eq ! ( socket. nonblocking( ) . unwrap( ) , want, "non-blocking option" ) ;
298
299
299
300
#[ cfg( all( not( target_os = "vita" ) , not( all( feature = "all" , unix) ) ) ) ]
300
301
{
301
302
let flags = unsafe { libc:: fcntl ( socket. as_raw_fd ( ) , libc:: F_GETFL ) } ;
302
303
assert_eq ! ( flags & libc:: O_NONBLOCK != 0 , want, "non-blocking option" ) ;
303
304
}
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
+ }
304
323
}
305
324
306
325
#[ cfg( windows) ]
@@ -871,7 +890,7 @@ fn tcp_keepalive() {
871
890
872
891
#[ cfg( all(
873
892
feature = "all" ,
874
- not( any( windows, target_os = "haiku" , target_os = "openbsd" , ) )
893
+ not( any( windows, target_os = "haiku" , target_os = "openbsd" ) )
875
894
) ) ]
876
895
assert_eq ! ( socket. keepalive_time( ) . unwrap( ) , Duration :: from_secs( 200 ) ) ;
877
896
0 commit comments