| ... | ... | @@ -9675,10 +9675,12 @@ fn fileWriteFileStreaming( |
| 9675 | 9675 | file_reader.interface.toss(n -| header.len); |
| 9676 | 9676 | return n; |
| 9677 | 9677 | } |
| 9678 | var len: usize = @intFromEnum(limit); |
| 9678 | 9679 | var off_in: i64 = undefined; |
| 9679 | 9680 | const off_in_ptr: ?*i64 = switch (file_reader.mode) { |
| 9680 | 9681 | .positional_simple, .streaming_simple => return error.Unimplemented, |
| 9681 | 9682 | .positional => p: { |
| 9683 | len = @min(len, std.math.maxInt(usize) - file_reader.pos); |
| 9682 | 9684 | off_in = @intCast(file_reader.pos); |
| 9683 | 9685 | break :p &off_in; |
| 9684 | 9686 | }, |
| ... | ... | @@ -9689,7 +9691,7 @@ fn fileWriteFileStreaming( |
| 9689 | 9691 | .linux => n: { |
| 9690 | 9692 | const syscall: Syscall = try .start(); |
| 9691 | 9693 | while (true) { |
| 9692 | | const rc = linux_copy_file_range_sys.copy_file_range(in_fd, off_in_ptr, out_fd, null, @intFromEnum(limit), 0); |
| 9694 | const rc = linux_copy_file_range_sys.copy_file_range(in_fd, off_in_ptr, out_fd, null, len, 0); |
| 9693 | 9695 | switch (linux_copy_file_range_sys.errno(rc)) { |
| 9694 | 9696 | .SUCCESS => { |
| 9695 | 9697 | syscall.finish(); |
| ... | ... | @@ -9849,10 +9851,12 @@ fn fileWriteFilePositional( |
| 9849 | 9851 | file_reader.interface.toss(n -| header.len); |
| 9850 | 9852 | return n; |
| 9851 | 9853 | } |
| 9854 | var len: usize = @min(@intFromEnum(limit), std.math.maxInt(usize) - offset); |
| 9852 | 9855 | var off_in: i64 = undefined; |
| 9853 | 9856 | const off_in_ptr: ?*i64 = switch (file_reader.mode) { |
| 9854 | 9857 | .positional_simple, .streaming_simple => return error.Unimplemented, |
| 9855 | 9858 | .positional => p: { |
| 9859 | len = @min(len, std.math.maxInt(usize) - file_reader.pos); |
| 9856 | 9860 | off_in = @intCast(file_reader.pos); |
| 9857 | 9861 | break :p &off_in; |
| 9858 | 9862 | }, |
| ... | ... | @@ -9864,7 +9868,7 @@ fn fileWriteFilePositional( |
| 9864 | 9868 | .linux => n: { |
| 9865 | 9869 | const syscall: Syscall = try .start(); |
| 9866 | 9870 | while (true) { |
| 9867 | | const rc = linux_copy_file_range_sys.copy_file_range(in_fd, off_in_ptr, out_fd, &off_out, @intFromEnum(limit), 0); |
| 9871 | const rc = linux_copy_file_range_sys.copy_file_range(in_fd, off_in_ptr, out_fd, &off_out, len, 0); |
| 9868 | 9872 | switch (linux_copy_file_range_sys.errno(rc)) { |
| 9869 | 9873 | .SUCCESS => { |
| 9870 | 9874 | syscall.finish(); |
| ... | ... | @@ -9888,7 +9892,7 @@ fn fileWriteFilePositional( |
| 9888 | 9892 | .IO => return error.InputOutput, |
| 9889 | 9893 | .NOMEM => return error.SystemResources, |
| 9890 | 9894 | .NOSPC => return error.NoSpaceLeft, |
| 9891 | | .OVERFLOW => return error.Unseekable, |
| 9895 | .OVERFLOW => |err| errnoBug(err), // We avoid passing too large a count. |
| 9892 | 9896 | .NXIO => return error.Unseekable, |
| 9893 | 9897 | .SPIPE => return error.Unseekable, |
| 9894 | 9898 | .PERM => return error.PermissionDenied, |