@@ -427,19 +427,15 @@ impl Socket {
427427 self . 0 . set_nonblocking ( nonblocking)
428428 }
429429
430- #[ cfg( target_os = "linux" ) ]
430+ #[ cfg( any ( target_os = "linux" , target_os = "freebsd" , target_os = "openbsd" ) ) ]
431431 pub fn set_mark ( & self , mark : u32 ) -> io:: Result < ( ) > {
432- setsockopt ( self , libc:: SOL_SOCKET , libc:: SO_MARK , mark as libc:: c_int )
433- }
434-
435- #[ cfg( target_os = "freebsd" ) ]
436- pub fn set_mark ( & self , mark : u32 ) -> io:: Result < ( ) > {
437- setsockopt ( self , libc:: SOL_SOCKET , libc:: SO_USER_COOKIE , mark)
438- }
439-
440- #[ cfg( target_os = "openbsd" ) ]
441- pub fn set_mark ( & self , mark : u32 ) -> io:: Result < ( ) > {
442- setsockopt ( self , libc:: SOL_SOCKET , libc:: SO_RTABLE , mark as libc:: c_int )
432+ #[ cfg( target_os = "linux" ) ]
433+ let option = libc:: SO_MARK ;
434+ #[ cfg( target_os = "freebsd" ) ]
435+ let option = libc:: SO_USER_COOKIE ;
436+ #[ cfg( target_os = "openbsd" ) ]
437+ let option = libc:: SO_RTABLE ;
438+ setsockopt ( self , libc:: SOL_SOCKET , option, mark as libc:: c_int )
443439 }
444440
445441 pub fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
0 commit comments