@@ -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.
@@ -363,10 +359,11 @@ fn cat_handle<R: FdReadable>(
363359 state : & mut OutputState ,
364360) -> CatResult < ( ) > {
365361 if options. can_print_fast ( ) {
366- print_fast ( handle)
362+ io :: copy ( & mut handle. reader , & mut * uucore :: stdio :: stdout_raw ( ) ) ? ;
367363 } else {
368- print_lines ( handle, options, state)
364+ print_lines ( handle, options, state) ? ;
369365 }
366+ Ok ( ( ) )
370367}
371368
372369fn cat_path ( path : & OsString , options : & OutputOptions , state : & mut OutputState ) -> CatResult < ( ) > {
@@ -477,38 +474,6 @@ fn get_input_type(path: &OsString) -> CatResult<InputType> {
477474 }
478475}
479476
480- /// Writes handle to stdout with no configuration. This allows a
481- /// simple memory copy.
482- fn print_fast < R : FdReadable > ( handle : & mut InputHandle < R > ) -> CatResult < ( ) > {
483- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
484- {
485- // If we're on Linux or Android, try to use the splice() system call
486- // for faster writing. If it works, we're done.
487- if !splice:: write_fast_using_splice ( handle, & mut io:: stdout ( ) ) ? {
488- return Ok ( ( ) ) ;
489- }
490- }
491- // If we're not on Linux or Android, or the splice() call failed,
492- // fall back on slower writing.
493- print_unbuffered ( handle)
494- }
495-
496- #[ cfg_attr( any( target_os = "linux" , target_os = "android" ) , inline( never) ) ] // splice fast-path does not require this allocation
497- fn print_unbuffered < R : FdReadable > ( handle : & mut InputHandle < R > ) -> CatResult < ( ) > {
498- let mut stdout = uucore:: stdio:: stdout_raw ( ) ;
499- let mut buf = [ 0 ; 1024 * 64 ] ;
500- loop {
501- match handle. reader . read ( & mut buf) {
502- Ok ( 0 ) => return Ok ( ( ) ) ,
503- Ok ( n) => stdout
504- . write_all ( & buf[ ..n] )
505- . inspect_err ( handle_broken_pipe) ?,
506- Err ( e) if e. kind ( ) != ErrorKind :: Interrupted => return Err ( e. into ( ) ) ,
507- _ => { }
508- }
509- }
510- }
511-
512477/// Outputs file contents to stdout in a line-by-line fashion,
513478/// propagating any errors that might occur.
514479fn print_lines < R : FdReadable > (
0 commit comments