@@ -23,10 +23,6 @@ use uucore::error::{UResult, strip_errno};
2323use uucore:: translate;
2424use uucore:: { fast_inc:: fast_inc_one, format_usage} ;
2525
26- /// Linux splice support
27- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
28- mod splice;
29-
3026// Allocate 32 digits for the line number.
3127// An estimate is that we can print about 1e8 lines/seconds, so 32 digits
3228// would be enough for billions of universe lifetimes.
@@ -483,14 +479,14 @@ fn print_fast<R: FdReadable>(handle: &mut InputHandle<R>) -> CatResult<()> {
483479 let stdout = io:: stdout ( ) ;
484480 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
485481 let mut stdout = stdout;
482+ // Try to use the splice() system call for faster writing. If it works, we're done.
486483 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
484+ if !uucore:: pipes:: splice_unbounded_auto ( & handle. reader , & mut stdout) ?
485+ && !uucore:: pipes:: might_fuse ( & handle. reader )
487486 {
488- // If we're on Linux or Android, try to use the splice() system call
489- // for faster writing. If it works, we're done.
490- if !splice:: write_fast_using_splice ( handle, & mut stdout) ? {
491- return Ok ( ( ) ) ;
492- }
487+ return Ok ( ( ) ) ;
493488 }
489+
494490 // If we're not on Linux or Android, or the splice() call failed,
495491 // fall back on slower writing.
496492 print_unbuffered ( handle, stdout)
0 commit comments