authorgravatar for motiejus@jakstys.ltMotiejus Jakštys <motiejus@jakstys.lt> 2022-08-19 09:42:42+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-08-26 15:36:40+03:00
log9038528187932babc86558ec343511c635446a28
treed55c4d92ef5e1a81a955a4cb33414237ce8f9daa
parent3fa5415253695001149ad65ae6f2ca8d0fa63565

copy_file_range: fix zigification of TXTBSY

From `copy_file_range(2)` errors: ETXTBSY Either fd_in or fd_out refers to an active swap file. Same error will be used in the upcoming `ioctl_ficlonerange(2)`: ETXTBSY One of the files is a swap file. Swap files cannot share storage.

2 files changed, 3 insertions(+), 3 deletions(-)

lib/std/os.zig+2-2
...@@ -6251,7 +6251,7 @@ pub const CopyFileRangeError = error{...@@ -6251,7 +6251,7 @@ pub const CopyFileRangeError = error{
6251 NoSpaceLeft,6251 NoSpaceLeft,
6252 Unseekable,6252 Unseekable,
6253 PermissionDenied,6253 PermissionDenied,
6254 FileBusy,6254 SwapFile,
6255} || PReadError || PWriteError || UnexpectedError;6255} || PReadError || PWriteError || UnexpectedError;
62566256
6257var has_copy_file_range_syscall = std.atomic.Atomic(bool).init(true);6257var has_copy_file_range_syscall = std.atomic.Atomic(bool).init(true);
...@@ -6305,7 +6305,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len...@@ -6305,7 +6305,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len
6305 .NOSPC => return error.NoSpaceLeft,6305 .NOSPC => return error.NoSpaceLeft,
6306 .OVERFLOW => return error.Unseekable,6306 .OVERFLOW => return error.Unseekable,
6307 .PERM => return error.PermissionDenied,6307 .PERM => return error.PermissionDenied,
6308 .TXTBSY => return error.FileBusy,6308 .TXTBSY => return error.SwapFile,
6309 // these may not be regular files, try fallback6309 // these may not be regular files, try fallback
6310 .INVAL => {},6310 .INVAL => {},
6311 // support for cross-filesystem copy added in Linux 5.3, use fallback6311 // support for cross-filesystem copy added in Linux 5.3, use fallback
src/link.zig+1-1
...@@ -426,7 +426,7 @@ pub const File = struct {...@@ -426,7 +426,7 @@ pub const File = struct {
426 NoSpaceLeft,426 NoSpaceLeft,
427 Unseekable,427 Unseekable,
428 PermissionDenied,428 PermissionDenied,
429 FileBusy,429 SwapFile,
430 SystemResources,430 SystemResources,
431 OperationAborted,431 OperationAborted,
432 BrokenPipe,432 BrokenPipe,