| ... | @@ -281,6 +281,7 @@ pub fn close(fd: fd_t) void { | ... | @@ -281,6 +281,7 @@ pub fn close(fd: fd_t) void { |
| 281 | | 281 | |
| 282 | pub const FChmodError = error{ | 282 | pub const FChmodError = error{ |
| 283 | AccessDenied, | 283 | AccessDenied, |
| | 284 | PermissionDenied, |
| 284 | InputOutput, | 285 | InputOutput, |
| 285 | SymLinkLoop, | 286 | SymLinkLoop, |
| 286 | FileNotFound, | 287 | FileNotFound, |
| ... | @@ -310,7 +311,7 @@ pub fn fchmod(fd: fd_t, mode: mode_t) FChmodError!void { | ... | @@ -310,7 +311,7 @@ pub fn fchmod(fd: fd_t, mode: mode_t) FChmodError!void { |
| 310 | .NOENT => return error.FileNotFound, | 311 | .NOENT => return error.FileNotFound, |
| 311 | .NOMEM => return error.SystemResources, | 312 | .NOMEM => return error.SystemResources, |
| 312 | .NOTDIR => return error.FileNotFound, | 313 | .NOTDIR => return error.FileNotFound, |
| 313 | .PERM => return error.AccessDenied, | 314 | .PERM => return error.PermissionDenied, |
| 314 | .ROFS => return error.ReadOnlyFileSystem, | 315 | .ROFS => return error.ReadOnlyFileSystem, |
| 315 | else => |err| return unexpectedErrno(err), | 316 | else => |err| return unexpectedErrno(err), |
| 316 | } | 317 | } |
| ... | @@ -387,7 +388,7 @@ fn fchmodat1(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr | ... | @@ -387,7 +388,7 @@ fn fchmodat1(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr |
| 387 | .NOTDIR => return error.FileNotFound, | 388 | .NOTDIR => return error.FileNotFound, |
| 388 | .NOMEM => return error.SystemResources, | 389 | .NOMEM => return error.SystemResources, |
| 389 | .OPNOTSUPP => return error.OperationNotSupported, | 390 | .OPNOTSUPP => return error.OperationNotSupported, |
| 390 | .PERM => return error.AccessDenied, | 391 | .PERM => return error.PermissionDenied, |
| 391 | .ROFS => return error.ReadOnlyFileSystem, | 392 | .ROFS => return error.ReadOnlyFileSystem, |
| 392 | else => |err| return unexpectedErrno(err), | 393 | else => |err| return unexpectedErrno(err), |
| 393 | } | 394 | } |
| ... | @@ -418,7 +419,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr | ... | @@ -418,7 +419,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr |
| 418 | .NOMEM => return error.SystemResources, | 419 | .NOMEM => return error.SystemResources, |
| 419 | .NOTDIR => return error.FileNotFound, | 420 | .NOTDIR => return error.FileNotFound, |
| 420 | .OPNOTSUPP => return error.OperationNotSupported, | 421 | .OPNOTSUPP => return error.OperationNotSupported, |
| 421 | .PERM => return error.AccessDenied, | 422 | .PERM => return error.PermissionDenied, |
| 422 | .ROFS => return error.ReadOnlyFileSystem, | 423 | .ROFS => return error.ReadOnlyFileSystem, |
| 423 | | 424 | |
| 424 | .NOSYS => { | 425 | .NOSYS => { |
| ... | @@ -447,7 +448,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr | ... | @@ -447,7 +448,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr |
| 447 | .FAULT => unreachable, | 448 | .FAULT => unreachable, |
| 448 | .INVAL => unreachable, | 449 | .INVAL => unreachable, |
| 449 | .ACCES => return error.AccessDenied, | 450 | .ACCES => return error.AccessDenied, |
| 450 | .PERM => return error.AccessDenied, | 451 | .PERM => return error.PermissionDenied, |
| 451 | .LOOP => return error.SymLinkLoop, | 452 | .LOOP => return error.SymLinkLoop, |
| 452 | .MFILE => return error.ProcessFdQuotaExceeded, | 453 | .MFILE => return error.ProcessFdQuotaExceeded, |
| 453 | .NAMETOOLONG => return error.NameTooLong, | 454 | .NAMETOOLONG => return error.NameTooLong, |
| ... | @@ -486,7 +487,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr | ... | @@ -486,7 +487,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr |
| 486 | .LOOP => return error.SymLinkLoop, | 487 | .LOOP => return error.SymLinkLoop, |
| 487 | .NOMEM => return error.SystemResources, | 488 | .NOMEM => return error.SystemResources, |
| 488 | .NOTDIR => return error.FileNotFound, | 489 | .NOTDIR => return error.FileNotFound, |
| 489 | .PERM => return error.AccessDenied, | 490 | .PERM => return error.PermissionDenied, |
| 490 | .ROFS => return error.ReadOnlyFileSystem, | 491 | .ROFS => return error.ReadOnlyFileSystem, |
| 491 | else => |err| return unexpectedErrno(err), | 492 | else => |err| return unexpectedErrno(err), |
| 492 | } | 493 | } |
| ... | @@ -495,6 +496,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr | ... | @@ -495,6 +496,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr |
| 495 | | 496 | |
| 496 | pub const FChownError = error{ | 497 | pub const FChownError = error{ |
| 497 | AccessDenied, | 498 | AccessDenied, |
| | 499 | PermissionDenied, |
| 498 | InputOutput, | 500 | InputOutput, |
| 499 | SymLinkLoop, | 501 | SymLinkLoop, |
| 500 | FileNotFound, | 502 | FileNotFound, |
| ... | @@ -529,7 +531,7 @@ pub fn fchown(fd: fd_t, owner: ?uid_t, group: ?gid_t) FChownError!void { | ... | @@ -529,7 +531,7 @@ pub fn fchown(fd: fd_t, owner: ?uid_t, group: ?gid_t) FChownError!void { |
| 529 | .NOENT => return error.FileNotFound, | 531 | .NOENT => return error.FileNotFound, |
| 530 | .NOMEM => return error.SystemResources, | 532 | .NOMEM => return error.SystemResources, |
| 531 | .NOTDIR => return error.FileNotFound, | 533 | .NOTDIR => return error.FileNotFound, |
| 532 | .PERM => return error.AccessDenied, | 534 | .PERM => return error.PermissionDenied, |
| 533 | .ROFS => return error.ReadOnlyFileSystem, | 535 | .ROFS => return error.ReadOnlyFileSystem, |
| 534 | else => |err| return unexpectedErrno(err), | 536 | else => |err| return unexpectedErrno(err), |
| 535 | } | 537 | } |
| ... | @@ -1031,10 +1033,8 @@ pub const TruncateError = error{ | ... | @@ -1031,10 +1033,8 @@ pub const TruncateError = error{ |
| 1031 | FileTooBig, | 1033 | FileTooBig, |
| 1032 | InputOutput, | 1034 | InputOutput, |
| 1033 | FileBusy, | 1035 | FileBusy, |
| 1034 | | | |
| 1035 | /// In WASI, this error occurs when the file descriptor does | | |
| 1036 | /// not hold the required rights to call `ftruncate` on it. | | |
| 1037 | AccessDenied, | 1036 | AccessDenied, |
| | 1037 | PermissionDenied, |
| 1038 | } || UnexpectedError; | 1038 | } || UnexpectedError; |
| 1039 | | 1039 | |
| 1040 | pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { | 1040 | pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { |
| ... | @@ -1066,7 +1066,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { | ... | @@ -1066,7 +1066,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { |
| 1066 | .INTR => unreachable, | 1066 | .INTR => unreachable, |
| 1067 | .FBIG => return error.FileTooBig, | 1067 | .FBIG => return error.FileTooBig, |
| 1068 | .IO => return error.InputOutput, | 1068 | .IO => return error.InputOutput, |
| 1069 | .PERM => return error.AccessDenied, | 1069 | .PERM => return error.PermissionDenied, |
| 1070 | .TXTBSY => return error.FileBusy, | 1070 | .TXTBSY => return error.FileBusy, |
| 1071 | .BADF => unreachable, // Handle not open for writing | 1071 | .BADF => unreachable, // Handle not open for writing |
| 1072 | .INVAL => unreachable, // Handle not open for writing | 1072 | .INVAL => unreachable, // Handle not open for writing |
| ... | @@ -1082,7 +1082,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { | ... | @@ -1082,7 +1082,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { |
| 1082 | .INTR => continue, | 1082 | .INTR => continue, |
| 1083 | .FBIG => return error.FileTooBig, | 1083 | .FBIG => return error.FileTooBig, |
| 1084 | .IO => return error.InputOutput, | 1084 | .IO => return error.InputOutput, |
| 1085 | .PERM => return error.AccessDenied, | 1085 | .PERM => return error.PermissionDenied, |
| 1086 | .TXTBSY => return error.FileBusy, | 1086 | .TXTBSY => return error.FileBusy, |
| 1087 | .BADF => unreachable, // Handle not open for writing | 1087 | .BADF => unreachable, // Handle not open for writing |
| 1088 | .INVAL => unreachable, // Handle not open for writing | 1088 | .INVAL => unreachable, // Handle not open for writing |
| ... | @@ -1176,6 +1176,7 @@ pub const WriteError = error{ | ... | @@ -1176,6 +1176,7 @@ pub const WriteError = error{ |
| 1176 | | 1176 | |
| 1177 | /// File descriptor does not hold the required rights to write to it. | 1177 | /// File descriptor does not hold the required rights to write to it. |
| 1178 | AccessDenied, | 1178 | AccessDenied, |
| | 1179 | PermissionDenied, |
| 1179 | BrokenPipe, | 1180 | BrokenPipe, |
| 1180 | SystemResources, | 1181 | SystemResources, |
| 1181 | OperationAborted, | 1182 | OperationAborted, |
| ... | @@ -1250,7 +1251,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { | ... | @@ -1250,7 +1251,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { |
| 1250 | .FBIG => return error.FileTooBig, | 1251 | .FBIG => return error.FileTooBig, |
| 1251 | .IO => return error.InputOutput, | 1252 | .IO => return error.InputOutput, |
| 1252 | .NOSPC => return error.NoSpaceLeft, | 1253 | .NOSPC => return error.NoSpaceLeft, |
| 1253 | .PERM => return error.AccessDenied, | 1254 | .PERM => return error.PermissionDenied, |
| 1254 | .PIPE => return error.BrokenPipe, | 1255 | .PIPE => return error.BrokenPipe, |
| 1255 | .NOTCAPABLE => return error.AccessDenied, | 1256 | .NOTCAPABLE => return error.AccessDenied, |
| 1256 | else => |err| return unexpectedErrno(err), | 1257 | else => |err| return unexpectedErrno(err), |
| ... | @@ -1278,7 +1279,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { | ... | @@ -1278,7 +1279,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { |
| 1278 | .IO => return error.InputOutput, | 1279 | .IO => return error.InputOutput, |
| 1279 | .NOSPC => return error.NoSpaceLeft, | 1280 | .NOSPC => return error.NoSpaceLeft, |
| 1280 | .ACCES => return error.AccessDenied, | 1281 | .ACCES => return error.AccessDenied, |
| 1281 | .PERM => return error.AccessDenied, | 1282 | .PERM => return error.PermissionDenied, |
| 1282 | .PIPE => return error.BrokenPipe, | 1283 | .PIPE => return error.BrokenPipe, |
| 1283 | .CONNRESET => return error.ConnectionResetByPeer, | 1284 | .CONNRESET => return error.ConnectionResetByPeer, |
| 1284 | .BUSY => return error.DeviceBusy, | 1285 | .BUSY => return error.DeviceBusy, |
| ... | @@ -1331,7 +1332,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { | ... | @@ -1331,7 +1332,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { |
| 1331 | .FBIG => return error.FileTooBig, | 1332 | .FBIG => return error.FileTooBig, |
| 1332 | .IO => return error.InputOutput, | 1333 | .IO => return error.InputOutput, |
| 1333 | .NOSPC => return error.NoSpaceLeft, | 1334 | .NOSPC => return error.NoSpaceLeft, |
| 1334 | .PERM => return error.AccessDenied, | 1335 | .PERM => return error.PermissionDenied, |
| 1335 | .PIPE => return error.BrokenPipe, | 1336 | .PIPE => return error.BrokenPipe, |
| 1336 | .NOTCAPABLE => return error.AccessDenied, | 1337 | .NOTCAPABLE => return error.AccessDenied, |
| 1337 | else => |err| return unexpectedErrno(err), | 1338 | else => |err| return unexpectedErrno(err), |
| ... | @@ -1353,7 +1354,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { | ... | @@ -1353,7 +1354,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { |
| 1353 | .FBIG => return error.FileTooBig, | 1354 | .FBIG => return error.FileTooBig, |
| 1354 | .IO => return error.InputOutput, | 1355 | .IO => return error.InputOutput, |
| 1355 | .NOSPC => return error.NoSpaceLeft, | 1356 | .NOSPC => return error.NoSpaceLeft, |
| 1356 | .PERM => return error.AccessDenied, | 1357 | .PERM => return error.PermissionDenied, |
| 1357 | .PIPE => return error.BrokenPipe, | 1358 | .PIPE => return error.BrokenPipe, |
| 1358 | .CONNRESET => return error.ConnectionResetByPeer, | 1359 | .CONNRESET => return error.ConnectionResetByPeer, |
| 1359 | .BUSY => return error.DeviceBusy, | 1360 | .BUSY => return error.DeviceBusy, |
| ... | @@ -1410,7 +1411,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { | ... | @@ -1410,7 +1411,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { |
| 1410 | .FBIG => return error.FileTooBig, | 1411 | .FBIG => return error.FileTooBig, |
| 1411 | .IO => return error.InputOutput, | 1412 | .IO => return error.InputOutput, |
| 1412 | .NOSPC => return error.NoSpaceLeft, | 1413 | .NOSPC => return error.NoSpaceLeft, |
| 1413 | .PERM => return error.AccessDenied, | 1414 | .PERM => return error.PermissionDenied, |
| 1414 | .PIPE => return error.BrokenPipe, | 1415 | .PIPE => return error.BrokenPipe, |
| 1415 | .NXIO => return error.Unseekable, | 1416 | .NXIO => return error.Unseekable, |
| 1416 | .SPIPE => return error.Unseekable, | 1417 | .SPIPE => return error.Unseekable, |
| ... | @@ -1443,7 +1444,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { | ... | @@ -1443,7 +1444,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { |
| 1443 | .FBIG => return error.FileTooBig, | 1444 | .FBIG => return error.FileTooBig, |
| 1444 | .IO => return error.InputOutput, | 1445 | .IO => return error.InputOutput, |
| 1445 | .NOSPC => return error.NoSpaceLeft, | 1446 | .NOSPC => return error.NoSpaceLeft, |
| 1446 | .PERM => return error.AccessDenied, | 1447 | .PERM => return error.PermissionDenied, |
| 1447 | .PIPE => return error.BrokenPipe, | 1448 | .PIPE => return error.BrokenPipe, |
| 1448 | .NXIO => return error.Unseekable, | 1449 | .NXIO => return error.Unseekable, |
| 1449 | .SPIPE => return error.Unseekable, | 1450 | .SPIPE => return error.Unseekable, |
| ... | @@ -1502,7 +1503,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz | ... | @@ -1502,7 +1503,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz |
| 1502 | .FBIG => return error.FileTooBig, | 1503 | .FBIG => return error.FileTooBig, |
| 1503 | .IO => return error.InputOutput, | 1504 | .IO => return error.InputOutput, |
| 1504 | .NOSPC => return error.NoSpaceLeft, | 1505 | .NOSPC => return error.NoSpaceLeft, |
| 1505 | .PERM => return error.AccessDenied, | 1506 | .PERM => return error.PermissionDenied, |
| 1506 | .PIPE => return error.BrokenPipe, | 1507 | .PIPE => return error.BrokenPipe, |
| 1507 | .NXIO => return error.Unseekable, | 1508 | .NXIO => return error.Unseekable, |
| 1508 | .SPIPE => return error.Unseekable, | 1509 | .SPIPE => return error.Unseekable, |
| ... | @@ -1528,7 +1529,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz | ... | @@ -1528,7 +1529,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz |
| 1528 | .FBIG => return error.FileTooBig, | 1529 | .FBIG => return error.FileTooBig, |
| 1529 | .IO => return error.InputOutput, | 1530 | .IO => return error.InputOutput, |
| 1530 | .NOSPC => return error.NoSpaceLeft, | 1531 | .NOSPC => return error.NoSpaceLeft, |
| 1531 | .PERM => return error.AccessDenied, | 1532 | .PERM => return error.PermissionDenied, |
| 1532 | .PIPE => return error.BrokenPipe, | 1533 | .PIPE => return error.BrokenPipe, |
| 1533 | .NXIO => return error.Unseekable, | 1534 | .NXIO => return error.Unseekable, |
| 1534 | .SPIPE => return error.Unseekable, | 1535 | .SPIPE => return error.Unseekable, |
| ... | @@ -1543,6 +1544,7 @@ pub const OpenError = error{ | ... | @@ -1543,6 +1544,7 @@ pub const OpenError = error{ |
| 1543 | /// In WASI, this error may occur when the file descriptor does | 1544 | /// In WASI, this error may occur when the file descriptor does |
| 1544 | /// not hold the required rights to open a new resource relative to it. | 1545 | /// not hold the required rights to open a new resource relative to it. |
| 1545 | AccessDenied, | 1546 | AccessDenied, |
| | 1547 | PermissionDenied, |
| 1546 | SymLinkLoop, | 1548 | SymLinkLoop, |
| 1547 | ProcessFdQuotaExceeded, | 1549 | ProcessFdQuotaExceeded, |
| 1548 | SystemFdQuotaExceeded, | 1550 | SystemFdQuotaExceeded, |
| ... | @@ -1660,7 +1662,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: O, perm: mode_t) OpenError!fd_t { | ... | @@ -1660,7 +1662,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: O, perm: mode_t) OpenError!fd_t { |
| 1660 | .NOMEM => return error.SystemResources, | 1662 | .NOMEM => return error.SystemResources, |
| 1661 | .NOSPC => return error.NoSpaceLeft, | 1663 | .NOSPC => return error.NoSpaceLeft, |
| 1662 | .NOTDIR => return error.NotDir, | 1664 | .NOTDIR => return error.NotDir, |
| 1663 | .PERM => return error.AccessDenied, | 1665 | .PERM => return error.PermissionDenied, |
| 1664 | .EXIST => return error.PathAlreadyExists, | 1666 | .EXIST => return error.PathAlreadyExists, |
| 1665 | .BUSY => return error.DeviceBusy, | 1667 | .BUSY => return error.DeviceBusy, |
| 1666 | .ILSEQ => |err| if (native_os == .wasi) | 1668 | .ILSEQ => |err| if (native_os == .wasi) |
| ... | @@ -1740,7 +1742,7 @@ pub fn openatWasi( | ... | @@ -1740,7 +1742,7 @@ pub fn openatWasi( |
| 1740 | .NOMEM => return error.SystemResources, | 1742 | .NOMEM => return error.SystemResources, |
| 1741 | .NOSPC => return error.NoSpaceLeft, | 1743 | .NOSPC => return error.NoSpaceLeft, |
| 1742 | .NOTDIR => return error.NotDir, | 1744 | .NOTDIR => return error.NotDir, |
| 1743 | .PERM => return error.AccessDenied, | 1745 | .PERM => return error.PermissionDenied, |
| 1744 | .EXIST => return error.PathAlreadyExists, | 1746 | .EXIST => return error.PathAlreadyExists, |
| 1745 | .BUSY => return error.DeviceBusy, | 1747 | .BUSY => return error.DeviceBusy, |
| 1746 | .NOTCAPABLE => return error.AccessDenied, | 1748 | .NOTCAPABLE => return error.AccessDenied, |
| ... | @@ -1831,7 +1833,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: O, mode: mode_t) O | ... | @@ -1831,7 +1833,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: O, mode: mode_t) O |
| 1831 | .NOMEM => return error.SystemResources, | 1833 | .NOMEM => return error.SystemResources, |
| 1832 | .NOSPC => return error.NoSpaceLeft, | 1834 | .NOSPC => return error.NoSpaceLeft, |
| 1833 | .NOTDIR => return error.NotDir, | 1835 | .NOTDIR => return error.NotDir, |
| 1834 | .PERM => return error.AccessDenied, | 1836 | .PERM => return error.PermissionDenied, |
| 1835 | .EXIST => return error.PathAlreadyExists, | 1837 | .EXIST => return error.PathAlreadyExists, |
| 1836 | .BUSY => return error.DeviceBusy, | 1838 | .BUSY => return error.DeviceBusy, |
| 1837 | .OPNOTSUPP => return error.FileLocksNotSupported, | 1839 | .OPNOTSUPP => return error.FileLocksNotSupported, |
| ... | @@ -1873,6 +1875,7 @@ pub fn dup2(old_fd: fd_t, new_fd: fd_t) !void { | ... | @@ -1873,6 +1875,7 @@ pub fn dup2(old_fd: fd_t, new_fd: fd_t) !void { |
| 1873 | pub const ExecveError = error{ | 1875 | pub const ExecveError = error{ |
| 1874 | SystemResources, | 1876 | SystemResources, |
| 1875 | AccessDenied, | 1877 | AccessDenied, |
| | 1878 | PermissionDenied, |
| 1876 | InvalidExe, | 1879 | InvalidExe, |
| 1877 | FileSystem, | 1880 | FileSystem, |
| 1878 | IsDir, | 1881 | IsDir, |
| ... | @@ -1899,7 +1902,7 @@ pub fn execveZ( | ... | @@ -1899,7 +1902,7 @@ pub fn execveZ( |
| 1899 | .NFILE => return error.SystemFdQuotaExceeded, | 1902 | .NFILE => return error.SystemFdQuotaExceeded, |
| 1900 | .NOMEM => return error.SystemResources, | 1903 | .NOMEM => return error.SystemResources, |
| 1901 | .ACCES => return error.AccessDenied, | 1904 | .ACCES => return error.AccessDenied, |
| 1902 | .PERM => return error.AccessDenied, | 1905 | .PERM => return error.PermissionDenied, |
| 1903 | .INVAL => return error.InvalidExe, | 1906 | .INVAL => return error.InvalidExe, |
| 1904 | .NOEXEC => return error.InvalidExe, | 1907 | .NOEXEC => return error.InvalidExe, |
| 1905 | .IO => return error.FileSystem, | 1908 | .IO => return error.FileSystem, |
| ... | @@ -2077,6 +2080,7 @@ pub const SymLinkError = error{ | ... | @@ -2077,6 +2080,7 @@ pub const SymLinkError = error{ |
| 2077 | /// In WASI, this error may occur when the file descriptor does | 2080 | /// In WASI, this error may occur when the file descriptor does |
| 2078 | /// not hold the required rights to create a new symbolic link relative to it. | 2081 | /// not hold the required rights to create a new symbolic link relative to it. |
| 2079 | AccessDenied, | 2082 | AccessDenied, |
| | 2083 | PermissionDenied, |
| 2080 | DiskQuota, | 2084 | DiskQuota, |
| 2081 | PathAlreadyExists, | 2085 | PathAlreadyExists, |
| 2082 | FileSystem, | 2086 | FileSystem, |
| ... | @@ -2130,7 +2134,7 @@ pub fn symlinkZ(target_path: [*:0]const u8, sym_link_path: [*:0]const u8) SymLin | ... | @@ -2130,7 +2134,7 @@ pub fn symlinkZ(target_path: [*:0]const u8, sym_link_path: [*:0]const u8) SymLin |
| 2130 | .FAULT => unreachable, | 2134 | .FAULT => unreachable, |
| 2131 | .INVAL => unreachable, | 2135 | .INVAL => unreachable, |
| 2132 | .ACCES => return error.AccessDenied, | 2136 | .ACCES => return error.AccessDenied, |
| 2133 | .PERM => return error.AccessDenied, | 2137 | .PERM => return error.PermissionDenied, |
| 2134 | .DQUOT => return error.DiskQuota, | 2138 | .DQUOT => return error.DiskQuota, |
| 2135 | .EXIST => return error.PathAlreadyExists, | 2139 | .EXIST => return error.PathAlreadyExists, |
| 2136 | .IO => return error.FileSystem, | 2140 | .IO => return error.FileSystem, |
| ... | @@ -2178,7 +2182,7 @@ pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []c | ... | @@ -2178,7 +2182,7 @@ pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []c |
| 2178 | .INVAL => unreachable, | 2182 | .INVAL => unreachable, |
| 2179 | .BADF => unreachable, | 2183 | .BADF => unreachable, |
| 2180 | .ACCES => return error.AccessDenied, | 2184 | .ACCES => return error.AccessDenied, |
| 2181 | .PERM => return error.AccessDenied, | 2185 | .PERM => return error.PermissionDenied, |
| 2182 | .DQUOT => return error.DiskQuota, | 2186 | .DQUOT => return error.DiskQuota, |
| 2183 | .EXIST => return error.PathAlreadyExists, | 2187 | .EXIST => return error.PathAlreadyExists, |
| 2184 | .IO => return error.FileSystem, | 2188 | .IO => return error.FileSystem, |
| ... | @@ -2208,7 +2212,7 @@ pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*: | ... | @@ -2208,7 +2212,7 @@ pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*: |
| 2208 | .FAULT => unreachable, | 2212 | .FAULT => unreachable, |
| 2209 | .INVAL => unreachable, | 2213 | .INVAL => unreachable, |
| 2210 | .ACCES => return error.AccessDenied, | 2214 | .ACCES => return error.AccessDenied, |
| 2211 | .PERM => return error.AccessDenied, | 2215 | .PERM => return error.PermissionDenied, |
| 2212 | .DQUOT => return error.DiskQuota, | 2216 | .DQUOT => return error.DiskQuota, |
| 2213 | .EXIST => return error.PathAlreadyExists, | 2217 | .EXIST => return error.PathAlreadyExists, |
| 2214 | .IO => return error.FileSystem, | 2218 | .IO => return error.FileSystem, |
| ... | @@ -2229,6 +2233,7 @@ pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*: | ... | @@ -2229,6 +2233,7 @@ pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*: |
| 2229 | | 2233 | |
| 2230 | pub const LinkError = UnexpectedError || error{ | 2234 | pub const LinkError = UnexpectedError || error{ |
| 2231 | AccessDenied, | 2235 | AccessDenied, |
| | 2236 | PermissionDenied, |
| 2232 | DiskQuota, | 2237 | DiskQuota, |
| 2233 | PathAlreadyExists, | 2238 | PathAlreadyExists, |
| 2234 | FileSystem, | 2239 | FileSystem, |
| ... | @@ -2264,7 +2269,7 @@ pub fn linkZ(oldpath: [*:0]const u8, newpath: [*:0]const u8) LinkError!void { | ... | @@ -2264,7 +2269,7 @@ pub fn linkZ(oldpath: [*:0]const u8, newpath: [*:0]const u8) LinkError!void { |
| 2264 | .NOENT => return error.FileNotFound, | 2269 | .NOENT => return error.FileNotFound, |
| 2265 | .NOMEM => return error.SystemResources, | 2270 | .NOMEM => return error.SystemResources, |
| 2266 | .NOSPC => return error.NoSpaceLeft, | 2271 | .NOSPC => return error.NoSpaceLeft, |
| 2267 | .PERM => return error.AccessDenied, | 2272 | .PERM => return error.PermissionDenied, |
| 2268 | .ROFS => return error.ReadOnlyFileSystem, | 2273 | .ROFS => return error.ReadOnlyFileSystem, |
| 2269 | .XDEV => return error.NotSameFileSystem, | 2274 | .XDEV => return error.NotSameFileSystem, |
| 2270 | .INVAL => unreachable, | 2275 | .INVAL => unreachable, |
| ... | @@ -2318,7 +2323,7 @@ pub fn linkatZ( | ... | @@ -2318,7 +2323,7 @@ pub fn linkatZ( |
| 2318 | .NOMEM => return error.SystemResources, | 2323 | .NOMEM => return error.SystemResources, |
| 2319 | .NOSPC => return error.NoSpaceLeft, | 2324 | .NOSPC => return error.NoSpaceLeft, |
| 2320 | .NOTDIR => return error.NotDir, | 2325 | .NOTDIR => return error.NotDir, |
| 2321 | .PERM => return error.AccessDenied, | 2326 | .PERM => return error.PermissionDenied, |
| 2322 | .ROFS => return error.ReadOnlyFileSystem, | 2327 | .ROFS => return error.ReadOnlyFileSystem, |
| 2323 | .XDEV => return error.NotSameFileSystem, | 2328 | .XDEV => return error.NotSameFileSystem, |
| 2324 | .INVAL => unreachable, | 2329 | .INVAL => unreachable, |
| ... | @@ -2367,7 +2372,7 @@ pub fn linkat( | ... | @@ -2367,7 +2372,7 @@ pub fn linkat( |
| 2367 | .NOMEM => return error.SystemResources, | 2372 | .NOMEM => return error.SystemResources, |
| 2368 | .NOSPC => return error.NoSpaceLeft, | 2373 | .NOSPC => return error.NoSpaceLeft, |
| 2369 | .NOTDIR => return error.NotDir, | 2374 | .NOTDIR => return error.NotDir, |
| 2370 | .PERM => return error.AccessDenied, | 2375 | .PERM => return error.PermissionDenied, |
| 2371 | .ROFS => return error.ReadOnlyFileSystem, | 2376 | .ROFS => return error.ReadOnlyFileSystem, |
| 2372 | .XDEV => return error.NotSameFileSystem, | 2377 | .XDEV => return error.NotSameFileSystem, |
| 2373 | .INVAL => unreachable, | 2378 | .INVAL => unreachable, |
| ... | @@ -2386,6 +2391,7 @@ pub const UnlinkError = error{ | ... | @@ -2386,6 +2391,7 @@ pub const UnlinkError = error{ |
| 2386 | /// In WASI, this error may occur when the file descriptor does | 2391 | /// In WASI, this error may occur when the file descriptor does |
| 2387 | /// not hold the required rights to unlink a resource by path relative to it. | 2392 | /// not hold the required rights to unlink a resource by path relative to it. |
| 2388 | AccessDenied, | 2393 | AccessDenied, |
| | 2394 | PermissionDenied, |
| 2389 | FileBusy, | 2395 | FileBusy, |
| 2390 | FileSystem, | 2396 | FileSystem, |
| 2391 | IsDir, | 2397 | IsDir, |
| ... | @@ -2441,7 +2447,7 @@ pub fn unlinkZ(file_path: [*:0]const u8) UnlinkError!void { | ... | @@ -2441,7 +2447,7 @@ pub fn unlinkZ(file_path: [*:0]const u8) UnlinkError!void { |
| 2441 | switch (errno(system.unlink(file_path))) { | 2447 | switch (errno(system.unlink(file_path))) { |
| 2442 | .SUCCESS => return, | 2448 | .SUCCESS => return, |
| 2443 | .ACCES => return error.AccessDenied, | 2449 | .ACCES => return error.AccessDenied, |
| 2444 | .PERM => return error.AccessDenied, | 2450 | .PERM => return error.PermissionDenied, |
| 2445 | .BUSY => return error.FileBusy, | 2451 | .BUSY => return error.FileBusy, |
| 2446 | .FAULT => unreachable, | 2452 | .FAULT => unreachable, |
| 2447 | .INVAL => unreachable, | 2453 | .INVAL => unreachable, |
| ... | @@ -2502,7 +2508,7 @@ pub fn unlinkatWasi(dirfd: fd_t, file_path: []const u8, flags: u32) UnlinkatErro | ... | @@ -2502,7 +2508,7 @@ pub fn unlinkatWasi(dirfd: fd_t, file_path: []const u8, flags: u32) UnlinkatErro |
| 2502 | switch (res) { | 2508 | switch (res) { |
| 2503 | .SUCCESS => return, | 2509 | .SUCCESS => return, |
| 2504 | .ACCES => return error.AccessDenied, | 2510 | .ACCES => return error.AccessDenied, |
| 2505 | .PERM => return error.AccessDenied, | 2511 | .PERM => return error.PermissionDenied, |
| 2506 | .BUSY => return error.FileBusy, | 2512 | .BUSY => return error.FileBusy, |
| 2507 | .FAULT => unreachable, | 2513 | .FAULT => unreachable, |
| 2508 | .IO => return error.FileSystem, | 2514 | .IO => return error.FileSystem, |
| ... | @@ -2535,7 +2541,7 @@ pub fn unlinkatZ(dirfd: fd_t, file_path_c: [*:0]const u8, flags: u32) UnlinkatEr | ... | @@ -2535,7 +2541,7 @@ pub fn unlinkatZ(dirfd: fd_t, file_path_c: [*:0]const u8, flags: u32) UnlinkatEr |
| 2535 | switch (errno(system.unlinkat(dirfd, file_path_c, flags))) { | 2541 | switch (errno(system.unlinkat(dirfd, file_path_c, flags))) { |
| 2536 | .SUCCESS => return, | 2542 | .SUCCESS => return, |
| 2537 | .ACCES => return error.AccessDenied, | 2543 | .ACCES => return error.AccessDenied, |
| 2538 | .PERM => return error.AccessDenied, | 2544 | .PERM => return error.PermissionDenied, |
| 2539 | .BUSY => return error.FileBusy, | 2545 | .BUSY => return error.FileBusy, |
| 2540 | .FAULT => unreachable, | 2546 | .FAULT => unreachable, |
| 2541 | .IO => return error.FileSystem, | 2547 | .IO => return error.FileSystem, |
| ... | @@ -2573,6 +2579,7 @@ pub const RenameError = error{ | ... | @@ -2573,6 +2579,7 @@ pub const RenameError = error{ |
| 2573 | /// On Windows, this error may be returned instead of PathAlreadyExists when | 2579 | /// On Windows, this error may be returned instead of PathAlreadyExists when |
| 2574 | /// renaming a directory over an existing directory. | 2580 | /// renaming a directory over an existing directory. |
| 2575 | AccessDenied, | 2581 | AccessDenied, |
| | 2582 | PermissionDenied, |
| 2576 | FileBusy, | 2583 | FileBusy, |
| 2577 | DiskQuota, | 2584 | DiskQuota, |
| 2578 | IsDir, | 2585 | IsDir, |
| ... | @@ -2635,7 +2642,7 @@ pub fn renameZ(old_path: [*:0]const u8, new_path: [*:0]const u8) RenameError!voi | ... | @@ -2635,7 +2642,7 @@ pub fn renameZ(old_path: [*:0]const u8, new_path: [*:0]const u8) RenameError!voi |
| 2635 | switch (errno(system.rename(old_path, new_path))) { | 2642 | switch (errno(system.rename(old_path, new_path))) { |
| 2636 | .SUCCESS => return, | 2643 | .SUCCESS => return, |
| 2637 | .ACCES => return error.AccessDenied, | 2644 | .ACCES => return error.AccessDenied, |
| 2638 | .PERM => return error.AccessDenied, | 2645 | .PERM => return error.PermissionDenied, |
| 2639 | .BUSY => return error.FileBusy, | 2646 | .BUSY => return error.FileBusy, |
| 2640 | .DQUOT => return error.DiskQuota, | 2647 | .DQUOT => return error.DiskQuota, |
| 2641 | .FAULT => unreachable, | 2648 | .FAULT => unreachable, |
| ... | @@ -2698,7 +2705,7 @@ fn renameatWasi(old: RelativePathWasi, new: RelativePathWasi) RenameError!void { | ... | @@ -2698,7 +2705,7 @@ fn renameatWasi(old: RelativePathWasi, new: RelativePathWasi) RenameError!void { |
| 2698 | switch (wasi.path_rename(old.dir_fd, old.relative_path.ptr, old.relative_path.len, new.dir_fd, new.relative_path.ptr, new.relative_path.len)) { | 2705 | switch (wasi.path_rename(old.dir_fd, old.relative_path.ptr, old.relative_path.len, new.dir_fd, new.relative_path.ptr, new.relative_path.len)) { |
| 2699 | .SUCCESS => return, | 2706 | .SUCCESS => return, |
| 2700 | .ACCES => return error.AccessDenied, | 2707 | .ACCES => return error.AccessDenied, |
| 2701 | .PERM => return error.AccessDenied, | 2708 | .PERM => return error.PermissionDenied, |
| 2702 | .BUSY => return error.FileBusy, | 2709 | .BUSY => return error.FileBusy, |
| 2703 | .DQUOT => return error.DiskQuota, | 2710 | .DQUOT => return error.DiskQuota, |
| 2704 | .FAULT => unreachable, | 2711 | .FAULT => unreachable, |
| ... | @@ -2750,7 +2757,7 @@ pub fn renameatZ( | ... | @@ -2750,7 +2757,7 @@ pub fn renameatZ( |
| 2750 | switch (errno(system.renameat(old_dir_fd, old_path, new_dir_fd, new_path))) { | 2757 | switch (errno(system.renameat(old_dir_fd, old_path, new_dir_fd, new_path))) { |
| 2751 | .SUCCESS => return, | 2758 | .SUCCESS => return, |
| 2752 | .ACCES => return error.AccessDenied, | 2759 | .ACCES => return error.AccessDenied, |
| 2753 | .PERM => return error.AccessDenied, | 2760 | .PERM => return error.PermissionDenied, |
| 2754 | .BUSY => return error.FileBusy, | 2761 | .BUSY => return error.FileBusy, |
| 2755 | .DQUOT => return error.DiskQuota, | 2762 | .DQUOT => return error.DiskQuota, |
| 2756 | .FAULT => unreachable, | 2763 | .FAULT => unreachable, |
| ... | @@ -2903,7 +2910,7 @@ pub fn mkdiratWasi(dir_fd: fd_t, sub_dir_path: []const u8, mode: mode_t) MakeDir | ... | @@ -2903,7 +2910,7 @@ pub fn mkdiratWasi(dir_fd: fd_t, sub_dir_path: []const u8, mode: mode_t) MakeDir |
| 2903 | .SUCCESS => return, | 2910 | .SUCCESS => return, |
| 2904 | .ACCES => return error.AccessDenied, | 2911 | .ACCES => return error.AccessDenied, |
| 2905 | .BADF => unreachable, | 2912 | .BADF => unreachable, |
| 2906 | .PERM => return error.AccessDenied, | 2913 | .PERM => return error.PermissionDenied, |
| 2907 | .DQUOT => return error.DiskQuota, | 2914 | .DQUOT => return error.DiskQuota, |
| 2908 | .EXIST => return error.PathAlreadyExists, | 2915 | .EXIST => return error.PathAlreadyExists, |
| 2909 | .FAULT => unreachable, | 2916 | .FAULT => unreachable, |
| ... | @@ -2933,7 +2940,7 @@ pub fn mkdiratZ(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: mode_t) MakeDir | ... | @@ -2933,7 +2940,7 @@ pub fn mkdiratZ(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: mode_t) MakeDir |
| 2933 | .SUCCESS => return, | 2940 | .SUCCESS => return, |
| 2934 | .ACCES => return error.AccessDenied, | 2941 | .ACCES => return error.AccessDenied, |
| 2935 | .BADF => unreachable, | 2942 | .BADF => unreachable, |
| 2936 | .PERM => return error.AccessDenied, | 2943 | .PERM => return error.PermissionDenied, |
| 2937 | .DQUOT => return error.DiskQuota, | 2944 | .DQUOT => return error.DiskQuota, |
| 2938 | .EXIST => return error.PathAlreadyExists, | 2945 | .EXIST => return error.PathAlreadyExists, |
| 2939 | .FAULT => unreachable, | 2946 | .FAULT => unreachable, |
| ... | @@ -2978,6 +2985,7 @@ pub const MakeDirError = error{ | ... | @@ -2978,6 +2985,7 @@ pub const MakeDirError = error{ |
| 2978 | /// In WASI, this error may occur when the file descriptor does | 2985 | /// In WASI, this error may occur when the file descriptor does |
| 2979 | /// not hold the required rights to create a new directory relative to it. | 2986 | /// not hold the required rights to create a new directory relative to it. |
| 2980 | AccessDenied, | 2987 | AccessDenied, |
| | 2988 | PermissionDenied, |
| 2981 | DiskQuota, | 2989 | DiskQuota, |
| 2982 | PathAlreadyExists, | 2990 | PathAlreadyExists, |
| 2983 | SymLinkLoop, | 2991 | SymLinkLoop, |
| ... | @@ -3030,7 +3038,7 @@ pub fn mkdirZ(dir_path: [*:0]const u8, mode: mode_t) MakeDirError!void { | ... | @@ -3030,7 +3038,7 @@ pub fn mkdirZ(dir_path: [*:0]const u8, mode: mode_t) MakeDirError!void { |
| 3030 | switch (errno(system.mkdir(dir_path, mode))) { | 3038 | switch (errno(system.mkdir(dir_path, mode))) { |
| 3031 | .SUCCESS => return, | 3039 | .SUCCESS => return, |
| 3032 | .ACCES => return error.AccessDenied, | 3040 | .ACCES => return error.AccessDenied, |
| 3033 | .PERM => return error.AccessDenied, | 3041 | .PERM => return error.PermissionDenied, |
| 3034 | .DQUOT => return error.DiskQuota, | 3042 | .DQUOT => return error.DiskQuota, |
| 3035 | .EXIST => return error.PathAlreadyExists, | 3043 | .EXIST => return error.PathAlreadyExists, |
| 3036 | .FAULT => unreachable, | 3044 | .FAULT => unreachable, |
| ... | @@ -3071,6 +3079,7 @@ pub fn mkdirW(dir_path_w: []const u16, mode: mode_t) MakeDirError!void { | ... | @@ -3071,6 +3079,7 @@ pub fn mkdirW(dir_path_w: []const u16, mode: mode_t) MakeDirError!void { |
| 3071 | | 3079 | |
| 3072 | pub const DeleteDirError = error{ | 3080 | pub const DeleteDirError = error{ |
| 3073 | AccessDenied, | 3081 | AccessDenied, |
| | 3082 | PermissionDenied, |
| 3074 | FileBusy, | 3083 | FileBusy, |
| 3075 | SymLinkLoop, | 3084 | SymLinkLoop, |
| 3076 | NameTooLong, | 3085 | NameTooLong, |
| ... | @@ -3123,7 +3132,7 @@ pub fn rmdirZ(dir_path: [*:0]const u8) DeleteDirError!void { | ... | @@ -3123,7 +3132,7 @@ pub fn rmdirZ(dir_path: [*:0]const u8) DeleteDirError!void { |
| 3123 | switch (errno(system.rmdir(dir_path))) { | 3132 | switch (errno(system.rmdir(dir_path))) { |
| 3124 | .SUCCESS => return, | 3133 | .SUCCESS => return, |
| 3125 | .ACCES => return error.AccessDenied, | 3134 | .ACCES => return error.AccessDenied, |
| 3126 | .PERM => return error.AccessDenied, | 3135 | .PERM => return error.PermissionDenied, |
| 3127 | .BUSY => return error.FileBusy, | 3136 | .BUSY => return error.FileBusy, |
| 3128 | .FAULT => unreachable, | 3137 | .FAULT => unreachable, |
| 3129 | .INVAL => return error.BadPathName, | 3138 | .INVAL => return error.BadPathName, |
| ... | @@ -3254,6 +3263,7 @@ pub const ReadLinkError = error{ | ... | @@ -3254,6 +3263,7 @@ pub const ReadLinkError = error{ |
| 3254 | /// In WASI, this error may occur when the file descriptor does | 3263 | /// In WASI, this error may occur when the file descriptor does |
| 3255 | /// not hold the required rights to read value of a symbolic link relative to it. | 3264 | /// not hold the required rights to read value of a symbolic link relative to it. |
| 3256 | AccessDenied, | 3265 | AccessDenied, |
| | 3266 | PermissionDenied, |
| 3257 | FileSystem, | 3267 | FileSystem, |
| 3258 | SymLinkLoop, | 3268 | SymLinkLoop, |
| 3259 | NameTooLong, | 3269 | NameTooLong, |
| ... | @@ -3534,7 +3544,7 @@ pub fn isatty(handle: fd_t) bool { | ... | @@ -3534,7 +3544,7 @@ pub fn isatty(handle: fd_t) bool { |
| 3534 | pub const SocketError = error{ | 3544 | pub const SocketError = error{ |
| 3535 | /// Permission to create a socket of the specified type and/or | 3545 | /// Permission to create a socket of the specified type and/or |
| 3536 | /// pro‐tocol is denied. | 3546 | /// pro‐tocol is denied. |
| 3537 | PermissionDenied, | 3547 | AccessDenied, |
| 3538 | | 3548 | |
| 3539 | /// The implementation does not support the specified address family. | 3549 | /// The implementation does not support the specified address family. |
| 3540 | AddressFamilyNotSupported, | 3550 | AddressFamilyNotSupported, |
| ... | @@ -3604,7 +3614,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!socket_t | ... | @@ -3604,7 +3614,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!socket_t |
| 3604 | } | 3614 | } |
| 3605 | return fd; | 3615 | return fd; |
| 3606 | }, | 3616 | }, |
| 3607 | .ACCES => return error.PermissionDenied, | 3617 | .ACCES => return error.AccessDenied, |
| 3608 | .AFNOSUPPORT => return error.AddressFamilyNotSupported, | 3618 | .AFNOSUPPORT => return error.AddressFamilyNotSupported, |
| 3609 | .INVAL => return error.ProtocolFamilyNotAvailable, | 3619 | .INVAL => return error.ProtocolFamilyNotAvailable, |
| 3610 | .MFILE => return error.ProcessFdQuotaExceeded, | 3620 | .MFILE => return error.ProcessFdQuotaExceeded, |
| ... | @@ -4188,6 +4198,9 @@ pub const ConnectError = error{ | ... | @@ -4188,6 +4198,9 @@ pub const ConnectError = error{ |
| 4188 | /// or | 4198 | /// or |
| 4189 | /// The user tried to connect to a broadcast address without having the socket broadcast flag enabled or | 4199 | /// The user tried to connect to a broadcast address without having the socket broadcast flag enabled or |
| 4190 | /// the connection request failed because of a local firewall rule. | 4200 | /// the connection request failed because of a local firewall rule. |
| | 4201 | AccessDenied, |
| | 4202 | |
| | 4203 | /// See AccessDenied |
| 4191 | PermissionDenied, | 4204 | PermissionDenied, |
| 4192 | | 4205 | |
| 4193 | /// Local address is already in use. | 4206 | /// Local address is already in use. |
| ... | @@ -4261,7 +4274,7 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne | ... | @@ -4261,7 +4274,7 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne |
| 4261 | while (true) { | 4274 | while (true) { |
| 4262 | switch (errno(system.connect(sock, sock_addr, len))) { | 4275 | switch (errno(system.connect(sock, sock_addr, len))) { |
| 4263 | .SUCCESS => return, | 4276 | .SUCCESS => return, |
| 4264 | .ACCES => return error.PermissionDenied, | 4277 | .ACCES => return error.AccessDenied, |
| 4265 | .PERM => return error.PermissionDenied, | 4278 | .PERM => return error.PermissionDenied, |
| 4266 | .ADDRINUSE => return error.AddressInUse, | 4279 | .ADDRINUSE => return error.AddressInUse, |
| 4267 | .ADDRNOTAVAIL => return error.AddressNotAvailable, | 4280 | .ADDRNOTAVAIL => return error.AddressNotAvailable, |
| ... | @@ -4323,7 +4336,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void { | ... | @@ -4323,7 +4336,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void { |
| 4323 | switch (errno(rc)) { | 4336 | switch (errno(rc)) { |
| 4324 | .SUCCESS => switch (@as(E, @enumFromInt(err_code))) { | 4337 | .SUCCESS => switch (@as(E, @enumFromInt(err_code))) { |
| 4325 | .SUCCESS => return, | 4338 | .SUCCESS => return, |
| 4326 | .ACCES => return error.PermissionDenied, | 4339 | .ACCES => return error.AccessDenied, |
| 4327 | .PERM => return error.PermissionDenied, | 4340 | .PERM => return error.PermissionDenied, |
| 4328 | .ADDRINUSE => return error.AddressInUse, | 4341 | .ADDRINUSE => return error.AddressInUse, |
| 4329 | .ADDRNOTAVAIL => return error.AddressNotAvailable, | 4342 | .ADDRNOTAVAIL => return error.AddressNotAvailable, |
| ... | @@ -4398,6 +4411,7 @@ pub const FStatError = error{ | ... | @@ -4398,6 +4411,7 @@ pub const FStatError = error{ |
| 4398 | /// In WASI, this error may occur when the file descriptor does | 4411 | /// In WASI, this error may occur when the file descriptor does |
| 4399 | /// not hold the required rights to get its filestat information. | 4412 | /// not hold the required rights to get its filestat information. |
| 4400 | AccessDenied, | 4413 | AccessDenied, |
| | 4414 | PermissionDenied, |
| 4401 | } || UnexpectedError; | 4415 | } || UnexpectedError; |
| 4402 | | 4416 | |
| 4403 | /// Return information about a file descriptor. | 4417 | /// Return information about a file descriptor. |
| ... | @@ -4466,7 +4480,7 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S | ... | @@ -4466,7 +4480,7 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S |
| 4466 | .BADF => unreachable, // Always a race condition. | 4480 | .BADF => unreachable, // Always a race condition. |
| 4467 | .NOMEM => return error.SystemResources, | 4481 | .NOMEM => return error.SystemResources, |
| 4468 | .ACCES => return error.AccessDenied, | 4482 | .ACCES => return error.AccessDenied, |
| 4469 | .PERM => return error.AccessDenied, | 4483 | .PERM => return error.PermissionDenied, |
| 4470 | .FAULT => unreachable, | 4484 | .FAULT => unreachable, |
| 4471 | .NAMETOOLONG => return error.NameTooLong, | 4485 | .NAMETOOLONG => return error.NameTooLong, |
| 4472 | .LOOP => return error.SymLinkLoop, | 4486 | .LOOP => return error.SymLinkLoop, |
| ... | @@ -4870,6 +4884,7 @@ pub fn msync(memory: []align(page_size_min) u8, flags: i32) MSyncError!void { | ... | @@ -4870,6 +4884,7 @@ pub fn msync(memory: []align(page_size_min) u8, flags: i32) MSyncError!void { |
| 4870 | } | 4884 | } |
| 4871 | | 4885 | |
| 4872 | pub const AccessError = error{ | 4886 | pub const AccessError = error{ |
| | 4887 | AccessDenied, |
| 4873 | PermissionDenied, | 4888 | PermissionDenied, |
| 4874 | FileNotFound, | 4889 | FileNotFound, |
| 4875 | NameTooLong, | 4890 | NameTooLong, |
| ... | @@ -4896,10 +4911,7 @@ pub const AccessError = error{ | ... | @@ -4896,10 +4911,7 @@ pub const AccessError = error{ |
| 4896 | /// Windows. See `fs` for the cross-platform file system API. | 4911 | /// Windows. See `fs` for the cross-platform file system API. |
| 4897 | pub fn access(path: []const u8, mode: u32) AccessError!void { | 4912 | pub fn access(path: []const u8, mode: u32) AccessError!void { |
| 4898 | if (native_os == .windows) { | 4913 | if (native_os == .windows) { |
| 4899 | const path_w = windows.sliceToPrefixedFileW(null, path) catch |err| switch (err) { | 4914 | const path_w = try windows.sliceToPrefixedFileW(null, path); |
| 4900 | error.AccessDenied => return error.PermissionDenied, | | |
| 4901 | else => |e| return e, | | |
| 4902 | }; | | |
| 4903 | _ = try windows.GetFileAttributesW(path_w.span().ptr); | 4915 | _ = try windows.GetFileAttributesW(path_w.span().ptr); |
| 4904 | return; | 4916 | return; |
| 4905 | } else if (native_os == .wasi and !builtin.link_libc) { | 4917 | } else if (native_os == .wasi and !builtin.link_libc) { |
| ... | @@ -4912,10 +4924,7 @@ pub fn access(path: []const u8, mode: u32) AccessError!void { | ... | @@ -4912,10 +4924,7 @@ pub fn access(path: []const u8, mode: u32) AccessError!void { |
| 4912 | /// Same as `access` except `path` is null-terminated. | 4924 | /// Same as `access` except `path` is null-terminated. |
| 4913 | pub fn accessZ(path: [*:0]const u8, mode: u32) AccessError!void { | 4925 | pub fn accessZ(path: [*:0]const u8, mode: u32) AccessError!void { |
| 4914 | if (native_os == .windows) { | 4926 | if (native_os == .windows) { |
| 4915 | const path_w = windows.cStrToPrefixedFileW(null, path) catch |err| switch (err) { | 4927 | const path_w = try windows.cStrToPrefixedFileW(null, path); |
| 4916 | error.AccessDenied => return error.PermissionDenied, | | |
| 4917 | else => |e| return e, | | |
| 4918 | }; | | |
| 4919 | _ = try windows.GetFileAttributesW(path_w.span().ptr); | 4928 | _ = try windows.GetFileAttributesW(path_w.span().ptr); |
| 4920 | return; | 4929 | return; |
| 4921 | } else if (native_os == .wasi and !builtin.link_libc) { | 4930 | } else if (native_os == .wasi and !builtin.link_libc) { |
| ... | @@ -4923,7 +4932,7 @@ pub fn accessZ(path: [*:0]const u8, mode: u32) AccessError!void { | ... | @@ -4923,7 +4932,7 @@ pub fn accessZ(path: [*:0]const u8, mode: u32) AccessError!void { |
| 4923 | } | 4932 | } |
| 4924 | switch (errno(system.access(path, mode))) { | 4933 | switch (errno(system.access(path, mode))) { |
| 4925 | .SUCCESS => return, | 4934 | .SUCCESS => return, |
| 4926 | .ACCES => return error.PermissionDenied, | 4935 | .ACCES => return error.AccessDenied, |
| 4927 | .PERM => return error.PermissionDenied, | 4936 | .PERM => return error.PermissionDenied, |
| 4928 | .ROFS => return error.ReadOnlyFileSystem, | 4937 | .ROFS => return error.ReadOnlyFileSystem, |
| 4929 | .LOOP => return error.SymLinkLoop, | 4938 | .LOOP => return error.SymLinkLoop, |
| ... | @@ -4958,19 +4967,14 @@ pub fn faccessat(dirfd: fd_t, path: []const u8, mode: u32, flags: u32) AccessErr | ... | @@ -4958,19 +4967,14 @@ pub fn faccessat(dirfd: fd_t, path: []const u8, mode: u32, flags: u32) AccessErr |
| 4958 | } else if (native_os == .wasi and !builtin.link_libc) { | 4967 | } else if (native_os == .wasi and !builtin.link_libc) { |
| 4959 | const resolved: RelativePathWasi = .{ .dir_fd = dirfd, .relative_path = path }; | 4968 | const resolved: RelativePathWasi = .{ .dir_fd = dirfd, .relative_path = path }; |
| 4960 | | 4969 | |
| 4961 | const st = blk: { | 4970 | const st = try std.os.fstatat_wasi(dirfd, path, .{ |
| 4962 | break :blk std.os.fstatat_wasi(dirfd, path, .{ | 4971 | .SYMLINK_FOLLOW = (flags & AT.SYMLINK_NOFOLLOW) == 0, |
| 4963 | .SYMLINK_FOLLOW = (flags & AT.SYMLINK_NOFOLLOW) == 0, | 4972 | }); |
| 4964 | }); | | |
| 4965 | } catch |err| switch (err) { | | |
| 4966 | error.AccessDenied => return error.PermissionDenied, | | |
| 4967 | else => |e| return e, | | |
| 4968 | }; | | |
| 4969 | | 4973 | |
| 4970 | if (mode != F_OK) { | 4974 | if (mode != F_OK) { |
| 4971 | var directory: wasi.fdstat_t = undefined; | 4975 | var directory: wasi.fdstat_t = undefined; |
| 4972 | if (wasi.fd_fdstat_get(resolved.dir_fd, &directory) != .SUCCESS) { | 4976 | if (wasi.fd_fdstat_get(resolved.dir_fd, &directory) != .SUCCESS) { |
| 4973 | return error.PermissionDenied; | 4977 | return error.AccessDenied; |
| 4974 | } | 4978 | } |
| 4975 | | 4979 | |
| 4976 | var rights: wasi.rights_t = .{}; | 4980 | var rights: wasi.rights_t = .{}; |
| ... | @@ -4990,7 +4994,7 @@ pub fn faccessat(dirfd: fd_t, path: []const u8, mode: u32, flags: u32) AccessErr | ... | @@ -4990,7 +4994,7 @@ pub fn faccessat(dirfd: fd_t, path: []const u8, mode: u32, flags: u32) AccessErr |
| 4990 | const rights_int: u64 = @bitCast(rights); | 4994 | const rights_int: u64 = @bitCast(rights); |
| 4991 | const inheriting_int: u64 = @bitCast(directory.fs_rights_inheriting); | 4995 | const inheriting_int: u64 = @bitCast(directory.fs_rights_inheriting); |
| 4992 | if ((rights_int & inheriting_int) != rights_int) { | 4996 | if ((rights_int & inheriting_int) != rights_int) { |
| 4993 | return error.PermissionDenied; | 4997 | return error.AccessDenied; |
| 4994 | } | 4998 | } |
| 4995 | } | 4999 | } |
| 4996 | return; | 5000 | return; |
| ... | @@ -5009,7 +5013,7 @@ pub fn faccessatZ(dirfd: fd_t, path: [*:0]const u8, mode: u32, flags: u32) Acces | ... | @@ -5009,7 +5013,7 @@ pub fn faccessatZ(dirfd: fd_t, path: [*:0]const u8, mode: u32, flags: u32) Acces |
| 5009 | } | 5013 | } |
| 5010 | switch (errno(system.faccessat(dirfd, path, mode, flags))) { | 5014 | switch (errno(system.faccessat(dirfd, path, mode, flags))) { |
| 5011 | .SUCCESS => return, | 5015 | .SUCCESS => return, |
| 5012 | .ACCES => return error.PermissionDenied, | 5016 | .ACCES => return error.AccessDenied, |
| 5013 | .PERM => return error.PermissionDenied, | 5017 | .PERM => return error.PermissionDenied, |
| 5014 | .ROFS => return error.ReadOnlyFileSystem, | 5018 | .ROFS => return error.ReadOnlyFileSystem, |
| 5015 | .LOOP => return error.SymLinkLoop, | 5019 | .LOOP => return error.SymLinkLoop, |
| ... | @@ -5060,7 +5064,7 @@ pub fn faccessatW(dirfd: fd_t, sub_path_w: [*:0]const u16) AccessError!void { | ... | @@ -5060,7 +5064,7 @@ pub fn faccessatW(dirfd: fd_t, sub_path_w: [*:0]const u16) AccessError!void { |
| 5060 | .OBJECT_PATH_NOT_FOUND => return error.FileNotFound, | 5064 | .OBJECT_PATH_NOT_FOUND => return error.FileNotFound, |
| 5061 | .OBJECT_NAME_INVALID => unreachable, | 5065 | .OBJECT_NAME_INVALID => unreachable, |
| 5062 | .INVALID_PARAMETER => unreachable, | 5066 | .INVALID_PARAMETER => unreachable, |
| 5063 | .ACCESS_DENIED => return error.PermissionDenied, | 5067 | .ACCESS_DENIED => return error.AccessDenied, |
| 5064 | .OBJECT_PATH_SYNTAX_BAD => unreachable, | 5068 | .OBJECT_PATH_SYNTAX_BAD => unreachable, |
| 5065 | else => |rc| return windows.unexpectedStatus(rc), | 5069 | else => |rc| return windows.unexpectedStatus(rc), |
| 5066 | } | 5070 | } |
| ... | @@ -5442,6 +5446,7 @@ pub fn flock(fd: fd_t, operation: i32) FlockError!void { | ... | @@ -5442,6 +5446,7 @@ pub fn flock(fd: fd_t, operation: i32) FlockError!void { |
| 5442 | pub const RealPathError = error{ | 5446 | pub const RealPathError = error{ |
| 5443 | FileNotFound, | 5447 | FileNotFound, |
| 5444 | AccessDenied, | 5448 | AccessDenied, |
| | 5449 | PermissionDenied, |
| 5445 | NameTooLong, | 5450 | NameTooLong, |
| 5446 | NotSupported, | 5451 | NotSupported, |
| 5447 | NotDir, | 5452 | NotDir, |
| ... | @@ -6823,7 +6828,7 @@ pub const SetSockOptError = error{ | ... | @@ -6823,7 +6828,7 @@ pub const SetSockOptError = error{ |
| 6823 | /// Insufficient resources are available in the system to complete the call. | 6828 | /// Insufficient resources are available in the system to complete the call. |
| 6824 | SystemResources, | 6829 | SystemResources, |
| 6825 | | 6830 | |
| 6826 | // Setting the socket option requires more elevated permissions. | 6831 | /// Setting the socket option requires more elevated permissions. |
| 6827 | PermissionDenied, | 6832 | PermissionDenied, |
| 6828 | | 6833 | |
| 6829 | OperationNotSupported, | 6834 | OperationNotSupported, |
| ... | @@ -7318,7 +7323,7 @@ pub fn perf_event_open( | ... | @@ -7318,7 +7323,7 @@ pub fn perf_event_open( |
| 7318 | } | 7323 | } |
| 7319 | | 7324 | |
| 7320 | pub const TimerFdCreateError = error{ | 7325 | pub const TimerFdCreateError = error{ |
| 7321 | AccessDenied, | 7326 | PermissionDenied, |
| 7322 | ProcessFdQuotaExceeded, | 7327 | ProcessFdQuotaExceeded, |
| 7323 | SystemFdQuotaExceeded, | 7328 | SystemFdQuotaExceeded, |
| 7324 | NoDevice, | 7329 | NoDevice, |
| ... | @@ -7337,7 +7342,7 @@ pub fn timerfd_create(clock_id: system.timerfd_clockid_t, flags: system.TFD) Tim | ... | @@ -7337,7 +7342,7 @@ pub fn timerfd_create(clock_id: system.timerfd_clockid_t, flags: system.TFD) Tim |
| 7337 | .NFILE => return error.SystemFdQuotaExceeded, | 7342 | .NFILE => return error.SystemFdQuotaExceeded, |
| 7338 | .NODEV => return error.NoDevice, | 7343 | .NODEV => return error.NoDevice, |
| 7339 | .NOMEM => return error.SystemResources, | 7344 | .NOMEM => return error.SystemResources, |
| 7340 | .PERM => return error.AccessDenied, | 7345 | .PERM => return error.PermissionDenied, |
| 7341 | else => |err| return unexpectedErrno(err), | 7346 | else => |err| return unexpectedErrno(err), |
| 7342 | }; | 7347 | }; |
| 7343 | } | 7348 | } |