| ... | ... | @@ -5214,7 +5214,7 @@ pub const CopyFileRangeError = error{ |
| 5214 | 5214 | |
| 5215 | 5215 | var has_copy_file_range_syscall = init: { |
| 5216 | 5216 | const kernel_has_syscall = std.Target.current.os.isAtLeast(.linux, .{ .major = 4, .minor = 5 }) orelse true; |
| 5217 | | break :init std.atomic.Int(bool).init(kernel_has_syscall); |
| 5217 | break :init std.atomic.Bool.init(kernel_has_syscall); |
| 5218 | 5218 | }; |
| 5219 | 5219 | |
| 5220 | 5220 | /// Transfer data between file descriptors at specified offsets. |
| ... | ... | @@ -5246,7 +5246,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len |
| 5246 | 5246 | const use_c = std.c.versionCheck(.{ .major = 2, .minor = 27, .patch = 0 }).ok; |
| 5247 | 5247 | |
| 5248 | 5248 | if (std.Target.current.os.tag == .linux and |
| 5249 | | (use_c or has_copy_file_range_syscall.get())) |
| 5249 | (use_c or has_copy_file_range_syscall.load(.Monotonic))) |
| 5250 | 5250 | { |
| 5251 | 5251 | const sys = if (use_c) std.c else linux; |
| 5252 | 5252 | |
| ... | ... | @@ -5271,7 +5271,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len |
| 5271 | 5271 | EXDEV => {}, |
| 5272 | 5272 | // syscall added in Linux 4.5, use fallback |
| 5273 | 5273 | ENOSYS => { |
| 5274 | | has_copy_file_range_syscall.set(false); |
| 5274 | has_copy_file_range_syscall.store(true, .Monotonic); |
| 5275 | 5275 | }, |
| 5276 | 5276 | else => |err| return unexpectedErrno(err), |
| 5277 | 5277 | } |