| ... | ... | @@ -615,7 +615,6 @@ pub fn getrandom(buffer: []u8) GetRandomError!void { |
| 615 | 615 | .INVAL => unreachable, |
| 616 | 616 | .FAULT => unreachable, |
| 617 | 617 | .INTR => continue, |
| 618 | | .NOSYS => return getRandomBytesDevURandom(buf), |
| 619 | 618 | else => return unexpectedErrno(err), |
| 620 | 619 | } |
| 621 | 620 | } |
| ... | ... | @@ -4534,7 +4533,6 @@ pub const FanotifyInitError = error{ |
| 4534 | 4533 | ProcessFdQuotaExceeded, |
| 4535 | 4534 | SystemFdQuotaExceeded, |
| 4536 | 4535 | SystemResources, |
| 4537 | | OperationNotSupported, |
| 4538 | 4536 | PermissionDenied, |
| 4539 | 4537 | } || UnexpectedError; |
| 4540 | 4538 | |
| ... | ... | @@ -4546,7 +4544,6 @@ pub fn fanotify_init(flags: std.os.linux.fanotify.InitFlags, event_f_flags: u32) |
| 4546 | 4544 | .MFILE => return error.ProcessFdQuotaExceeded, |
| 4547 | 4545 | .NFILE => return error.SystemFdQuotaExceeded, |
| 4548 | 4546 | .NOMEM => return error.SystemResources, |
| 4549 | | .NOSYS => return error.OperationNotSupported, |
| 4550 | 4547 | .PERM => return error.PermissionDenied, |
| 4551 | 4548 | else => |err| return unexpectedErrno(err), |
| 4552 | 4549 | } |
| ... | ... | @@ -4559,7 +4556,6 @@ pub const FanotifyMarkError = error{ |
| 4559 | 4556 | FileNotFound, |
| 4560 | 4557 | SystemResources, |
| 4561 | 4558 | UserMarkQuotaExceeded, |
| 4562 | | NotImplemented, |
| 4563 | 4559 | NotDir, |
| 4564 | 4560 | OperationNotSupported, |
| 4565 | 4561 | PermissionDenied, |
| ... | ... | @@ -4600,7 +4596,6 @@ pub fn fanotify_markZ( |
| 4600 | 4596 | .NOENT => return error.FileNotFound, |
| 4601 | 4597 | .NOMEM => return error.SystemResources, |
| 4602 | 4598 | .NOSPC => return error.UserMarkQuotaExceeded, |
| 4603 | | .NOSYS => return error.NotImplemented, |
| 4604 | 4599 | .NOTDIR => return error.NotDir, |
| 4605 | 4600 | .OPNOTSUPP => return error.OperationNotSupported, |
| 4606 | 4601 | .PERM => return error.PermissionDenied, |
| ... | ... | @@ -6183,13 +6178,6 @@ pub fn sendfile( |
| 6183 | 6178 | |
| 6184 | 6179 | switch (native_os) { |
| 6185 | 6180 | .linux => sf: { |
| 6186 | | // sendfile() first appeared in Linux 2.2, glibc 2.1. |
| 6187 | | const call_sf = comptime if (builtin.link_libc) |
| 6188 | | std.c.versionCheck(.{ .major = 2, .minor = 1, .patch = 0 }) |
| 6189 | | else |
| 6190 | | builtin.os.version_range.linux.range.max.order(.{ .major = 2, .minor = 2, .patch = 0 }) != .lt; |
| 6191 | | if (!call_sf) break :sf; |
| 6192 | | |
| 6193 | 6181 | if (headers.len != 0) { |
| 6194 | 6182 | const amt = try writev(out_fd, headers); |
| 6195 | 6183 | total_written += amt; |
| ... | ... | @@ -6223,14 +6211,14 @@ pub fn sendfile( |
| 6223 | 6211 | .OVERFLOW => unreachable, // We avoid passing too large of a `count`. |
| 6224 | 6212 | .NOTCONN => return error.BrokenPipe, // `out_fd` is an unconnected socket |
| 6225 | 6213 | |
| 6226 | | .INVAL, .NOSYS => { |
| 6214 | .INVAL => { |
| 6227 | 6215 | // EINVAL could be any of the following situations: |
| 6228 | 6216 | // * Descriptor is not valid or locked |
| 6229 | 6217 | // * an mmap(2)-like operation is not available for in_fd |
| 6230 | 6218 | // * count is negative |
| 6231 | 6219 | // * out_fd has the APPEND flag set |
| 6232 | 6220 | // Because of the "mmap(2)-like operation" possibility, we fall back to doing read/write |
| 6233 | | // manually, the same as ENOSYS. |
| 6221 | // manually. |
| 6234 | 6222 | break :sf; |
| 6235 | 6223 | }, |
| 6236 | 6224 | .AGAIN => return error.WouldBlock, |
| ... | ... | @@ -6456,21 +6444,15 @@ pub const CopyFileRangeError = error{ |
| 6456 | 6444 | /// `flags` has different meanings per operating system; refer to the respective man pages. |
| 6457 | 6445 | /// |
| 6458 | 6446 | /// These systems support in-kernel data copying: |
| 6459 | | /// * Linux 4.5 (cross-filesystem 5.3) |
| 6447 | /// * Linux (cross-filesystem from version 5.3) |
| 6460 | 6448 | /// * FreeBSD 13.0 |
| 6461 | 6449 | /// |
| 6462 | 6450 | /// Other systems fall back to calling `pread` / `pwrite`. |
| 6463 | 6451 | /// |
| 6464 | 6452 | /// Maximum offsets on Linux and FreeBSD are `maxInt(i64)`. |
| 6465 | 6453 | pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len: usize, flags: u32) CopyFileRangeError!usize { |
| 6466 | | const global = struct { |
| 6467 | | var has_copy_file_range = true; |
| 6468 | | }; |
| 6469 | | |
| 6470 | 6454 | if ((comptime builtin.os.isAtLeast(.freebsd, .{ .major = 13, .minor = 0, .patch = 0 }) orelse false) or |
| 6471 | | ((comptime builtin.os.isAtLeast(.linux, .{ .major = 4, .minor = 5, .patch = 0 }) orelse false and |
| 6472 | | std.c.versionCheck(.{ .major = 2, .minor = 27, .patch = 0 })) and |
| 6473 | | @atomicLoad(bool, &global.has_copy_file_range, .monotonic))) |
| 6455 | (comptime builtin.os.tag == .linux and std.c.versionCheck(.{ .major = 2, .minor = 27, .patch = 0 }))) |
| 6474 | 6456 | { |
| 6475 | 6457 | var off_in_copy: i64 = @bitCast(off_in); |
| 6476 | 6458 | var off_out_copy: i64 = @bitCast(off_out); |
| ... | ... | @@ -6504,10 +6486,6 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len |
| 6504 | 6486 | .PERM => return error.PermissionDenied, |
| 6505 | 6487 | .TXTBSY => return error.SwapFile, |
| 6506 | 6488 | .XDEV => break, // support for cross-filesystem copy added in Linux 5.3, use fallback |
| 6507 | | .NOSYS => { |
| 6508 | | @atomicStore(bool, &global.has_copy_file_range, false, .monotonic); |
| 6509 | | break; |
| 6510 | | }, |
| 6511 | 6489 | else => |err| return unexpectedErrno(err), |
| 6512 | 6490 | } |
| 6513 | 6491 | } |
| ... | ... | @@ -6775,10 +6753,6 @@ pub const MemFdCreateError = error{ |
| 6775 | 6753 | OutOfMemory, |
| 6776 | 6754 | /// Either the name provided exceeded `NAME_MAX`, or invalid flags were passed. |
| 6777 | 6755 | NameTooLong, |
| 6778 | | |
| 6779 | | /// memfd_create is available in Linux 3.17 and later. This error is returned |
| 6780 | | /// for older kernel versions. |
| 6781 | | SystemOutdated, |
| 6782 | 6756 | } || UnexpectedError; |
| 6783 | 6757 | |
| 6784 | 6758 | pub fn memfd_createZ(name: [*:0]const u8, flags: u32) MemFdCreateError!fd_t { |
| ... | ... | @@ -6795,7 +6769,6 @@ pub fn memfd_createZ(name: [*:0]const u8, flags: u32) MemFdCreateError!fd_t { |
| 6795 | 6769 | .NFILE => return error.SystemFdQuotaExceeded, |
| 6796 | 6770 | .MFILE => return error.ProcessFdQuotaExceeded, |
| 6797 | 6771 | .NOMEM => return error.OutOfMemory, |
| 6798 | | .NOSYS => return error.SystemOutdated, |
| 6799 | 6772 | else => |err| return unexpectedErrno(err), |
| 6800 | 6773 | } |
| 6801 | 6774 | }, |
| ... | ... | @@ -6915,7 +6888,6 @@ pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) !fd_t { |
| 6915 | 6888 | .NOMEM => return error.SystemResources, |
| 6916 | 6889 | .MFILE => return error.ProcessResources, |
| 6917 | 6890 | .NODEV => return error.InodeMountFail, |
| 6918 | | .NOSYS => return error.SystemOutdated, |
| 6919 | 6891 | else => |err| return unexpectedErrno(err), |
| 6920 | 6892 | } |
| 6921 | 6893 | } |