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{
62516251 NoSpaceLeft,
62526252 Unseekable,
62536253 PermissionDenied,
6254 FileBusy,
6254 SwapFile,
62556255} || PReadError || PWriteError || UnexpectedError;
62566256
62576257var 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
63056305 .NOSPC => return error.NoSpaceLeft,
63066306 .OVERFLOW => return error.Unseekable,
63076307 .PERM => return error.PermissionDenied,
6308 .TXTBSY => return error.FileBusy,
6308 .TXTBSY => return error.SwapFile,
63096309 // these may not be regular files, try fallback
63106310 .INVAL => {},
63116311 // 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 {
426426 NoSpaceLeft,
427427 Unseekable,
428428 PermissionDenied,
429 FileBusy,
429 SwapFile,
430430 SystemResources,
431431 OperationAborted,
432432 BrokenPipe,