@@ -255,65 +255,3 @@ pub fn test_syscontrol() {
255255 // requires root privileges
256256 // connect(fd, &sockaddr).expect("connect failed");
257257}
258-
259- /// Test non-blocking mode on new sockets via SockFlag::O_NONBLOCK
260- #[ cfg( any( target_os = "android" ,
261- target_os = "dragonfly" ,
262- target_os = "freebsd" ,
263- target_os = "linux" ,
264- target_os = "netbsd" ,
265- target_os = "openbsd" ) ) ]
266- #[ test]
267- pub fn test_sockflag_nonblock ( ) {
268- use libc;
269- use nix:: fcntl:: { fcntl} ;
270- use nix:: fcntl:: FcntlArg :: { F_GETFL } ;
271- use nix:: sys:: socket:: { socket, AddressFamily , SockType , SockFlag } ;
272-
273- /* first, try without SockFlag::SOCK_NONBLOCK */
274- let sock = socket ( AddressFamily :: Unix , SockType :: Stream , SockFlag :: empty ( ) , None )
275- . expect ( "socket failed" ) ;
276-
277- let fcntl_res = fcntl ( sock, F_GETFL ) . expect ( "fcntl failed" ) ;
278-
279- assert ! ( fcntl_res & libc:: O_NONBLOCK == 0 ) ;
280-
281- /* next, try with SockFlag::SOCK_NONBLOCK */
282- let sock = socket ( AddressFamily :: Unix , SockType :: Stream , SockFlag :: SOCK_NONBLOCK , None )
283- . expect ( "socket failed" ) ;
284-
285- let fcntl_res = fcntl ( sock, F_GETFL ) . expect ( "fcntl failed" ) ;
286-
287- assert ! ( fcntl_res & libc:: O_NONBLOCK == libc:: O_NONBLOCK ) ;
288- }
289-
290- /// Test close-on-exec on new sockets via SockFlag::SOCK_CLOEXEC
291- #[ cfg( any( target_os = "android" ,
292- target_os = "dragonfly" ,
293- target_os = "freebsd" ,
294- target_os = "linux" ,
295- target_os = "netbsd" ,
296- target_os = "openbsd" ) ) ]
297- #[ test]
298- pub fn test_sockflag_cloexec ( ) {
299- use libc;
300- use nix:: fcntl:: { fcntl} ;
301- use nix:: fcntl:: FcntlArg :: { F_GETFD } ;
302- use nix:: sys:: socket:: { socket, AddressFamily , SockType , SockFlag } ;
303-
304- /* first, test without SockFlag::SOCK_CLOEXEC */
305- let sock = socket ( AddressFamily :: Unix , SockType :: Stream , SockFlag :: empty ( ) , None )
306- . expect ( "socket failed" ) ;
307-
308- let fcntl_res = fcntl ( sock, F_GETFD ) . expect ( "fcntl failed" ) ;
309-
310- assert ! ( fcntl_res & libc:: FD_CLOEXEC == 0 ) ;
311-
312- /* next, test without SockFlag::SOCK_CLOEXEC */
313- let sock = socket ( AddressFamily :: Unix , SockType :: Stream , SockFlag :: SOCK_CLOEXEC , None )
314- . expect ( "socket failed" ) ;
315-
316- let fcntl_res = fcntl ( sock, F_GETFD ) . expect ( "fcntl failed" ) ;
317-
318- assert ! ( fcntl_res & libc:: FD_CLOEXEC == libc:: FD_CLOEXEC ) ;
319- }
0 commit comments