| ... | ... | @@ -281,6 +281,7 @@ pub fn close(fd: fd_t) void { |
| 281 | 281 | |
| 282 | 282 | pub const FChmodError = error{ |
| 283 | 283 | AccessDenied, |
| 284 | PermissionDenied, |
| 284 | 285 | InputOutput, |
| 285 | 286 | SymLinkLoop, |
| 286 | 287 | FileNotFound, |
| ... | ... | @@ -310,7 +311,7 @@ pub fn fchmod(fd: fd_t, mode: mode_t) FChmodError!void { |
| 310 | 311 | .NOENT => return error.FileNotFound, |
| 311 | 312 | .NOMEM => return error.SystemResources, |
| 312 | 313 | .NOTDIR => return error.FileNotFound, |
| 313 | | .PERM => return error.AccessDenied, |
| 314 | .PERM => return error.PermissionDenied, |
| 314 | 315 | .ROFS => return error.ReadOnlyFileSystem, |
| 315 | 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 | 388 | .NOTDIR => return error.FileNotFound, |
| 388 | 389 | .NOMEM => return error.SystemResources, |
| 389 | 390 | .OPNOTSUPP => return error.OperationNotSupported, |
| 390 | | .PERM => return error.AccessDenied, |
| 391 | .PERM => return error.PermissionDenied, |
| 391 | 392 | .ROFS => return error.ReadOnlyFileSystem, |
| 392 | 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 | 419 | .NOMEM => return error.SystemResources, |
| 419 | 420 | .NOTDIR => return error.FileNotFound, |
| 420 | 421 | .OPNOTSUPP => return error.OperationNotSupported, |
| 421 | | .PERM => return error.AccessDenied, |
| 422 | .PERM => return error.PermissionDenied, |
| 422 | 423 | .ROFS => return error.ReadOnlyFileSystem, |
| 423 | 424 | |
| 424 | 425 | .NOSYS => { |
| ... | ... | @@ -447,7 +448,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr |
| 447 | 448 | .FAULT => unreachable, |
| 448 | 449 | .INVAL => unreachable, |
| 449 | 450 | .ACCES => return error.AccessDenied, |
| 450 | | .PERM => return error.AccessDenied, |
| 451 | .PERM => return error.PermissionDenied, |
| 451 | 452 | .LOOP => return error.SymLinkLoop, |
| 452 | 453 | .MFILE => return error.ProcessFdQuotaExceeded, |
| 453 | 454 | .NAMETOOLONG => return error.NameTooLong, |
| ... | ... | @@ -486,7 +487,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr |
| 486 | 487 | .LOOP => return error.SymLinkLoop, |
| 487 | 488 | .NOMEM => return error.SystemResources, |
| 488 | 489 | .NOTDIR => return error.FileNotFound, |
| 489 | | .PERM => return error.AccessDenied, |
| 490 | .PERM => return error.PermissionDenied, |
| 490 | 491 | .ROFS => return error.ReadOnlyFileSystem, |
| 491 | 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 | 496 | |
| 496 | 497 | pub const FChownError = error{ |
| 497 | 498 | AccessDenied, |
| 499 | PermissionDenied, |
| 498 | 500 | InputOutput, |
| 499 | 501 | SymLinkLoop, |
| 500 | 502 | FileNotFound, |
| ... | ... | @@ -529,7 +531,7 @@ pub fn fchown(fd: fd_t, owner: ?uid_t, group: ?gid_t) FChownError!void { |
| 529 | 531 | .NOENT => return error.FileNotFound, |
| 530 | 532 | .NOMEM => return error.SystemResources, |
| 531 | 533 | .NOTDIR => return error.FileNotFound, |
| 532 | | .PERM => return error.AccessDenied, |
| 534 | .PERM => return error.PermissionDenied, |
| 533 | 535 | .ROFS => return error.ReadOnlyFileSystem, |
| 534 | 536 | else => |err| return unexpectedErrno(err), |
| 535 | 537 | } |
| ... | ... | @@ -1031,10 +1033,8 @@ pub const TruncateError = error{ |
| 1031 | 1033 | FileTooBig, |
| 1032 | 1034 | InputOutput, |
| 1033 | 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 | 1036 | AccessDenied, |
| 1037 | PermissionDenied, |
| 1038 | 1038 | } || UnexpectedError; |
| 1039 | 1039 | |
| 1040 | 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 | 1066 | .INTR => unreachable, |
| 1067 | 1067 | .FBIG => return error.FileTooBig, |
| 1068 | 1068 | .IO => return error.InputOutput, |
| 1069 | | .PERM => return error.AccessDenied, |
| 1069 | .PERM => return error.PermissionDenied, |
| 1070 | 1070 | .TXTBSY => return error.FileBusy, |
| 1071 | 1071 | .BADF => unreachable, // Handle not open for writing |
| 1072 | 1072 | .INVAL => unreachable, // Handle not open for writing |
| ... | ... | @@ -1082,7 +1082,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { |
| 1082 | 1082 | .INTR => continue, |
| 1083 | 1083 | .FBIG => return error.FileTooBig, |
| 1084 | 1084 | .IO => return error.InputOutput, |
| 1085 | | .PERM => return error.AccessDenied, |
| 1085 | .PERM => return error.PermissionDenied, |
| 1086 | 1086 | .TXTBSY => return error.FileBusy, |
| 1087 | 1087 | .BADF => unreachable, // Handle not open for writing |
| 1088 | 1088 | .INVAL => unreachable, // Handle not open for writing |
| ... | ... | @@ -1176,6 +1176,7 @@ pub const WriteError = error{ |
| 1176 | 1176 | |
| 1177 | 1177 | /// File descriptor does not hold the required rights to write to it. |
| 1178 | 1178 | AccessDenied, |
| 1179 | PermissionDenied, |
| 1179 | 1180 | BrokenPipe, |
| 1180 | 1181 | SystemResources, |
| 1181 | 1182 | OperationAborted, |
| ... | ... | @@ -1250,7 +1251,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { |
| 1250 | 1251 | .FBIG => return error.FileTooBig, |
| 1251 | 1252 | .IO => return error.InputOutput, |
| 1252 | 1253 | .NOSPC => return error.NoSpaceLeft, |
| 1253 | | .PERM => return error.AccessDenied, |
| 1254 | .PERM => return error.PermissionDenied, |
| 1254 | 1255 | .PIPE => return error.BrokenPipe, |
| 1255 | 1256 | .NOTCAPABLE => return error.AccessDenied, |
| 1256 | 1257 | else => |err| return unexpectedErrno(err), |
| ... | ... | @@ -1278,7 +1279,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { |
| 1278 | 1279 | .IO => return error.InputOutput, |
| 1279 | 1280 | .NOSPC => return error.NoSpaceLeft, |
| 1280 | 1281 | .ACCES => return error.AccessDenied, |
| 1281 | | .PERM => return error.AccessDenied, |
| 1282 | .PERM => return error.PermissionDenied, |
| 1282 | 1283 | .PIPE => return error.BrokenPipe, |
| 1283 | 1284 | .CONNRESET => return error.ConnectionResetByPeer, |
| 1284 | 1285 | .BUSY => return error.DeviceBusy, |
| ... | ... | @@ -1331,7 +1332,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { |
| 1331 | 1332 | .FBIG => return error.FileTooBig, |
| 1332 | 1333 | .IO => return error.InputOutput, |
| 1333 | 1334 | .NOSPC => return error.NoSpaceLeft, |
| 1334 | | .PERM => return error.AccessDenied, |
| 1335 | .PERM => return error.PermissionDenied, |
| 1335 | 1336 | .PIPE => return error.BrokenPipe, |
| 1336 | 1337 | .NOTCAPABLE => return error.AccessDenied, |
| 1337 | 1338 | else => |err| return unexpectedErrno(err), |
| ... | ... | @@ -1353,7 +1354,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { |
| 1353 | 1354 | .FBIG => return error.FileTooBig, |
| 1354 | 1355 | .IO => return error.InputOutput, |
| 1355 | 1356 | .NOSPC => return error.NoSpaceLeft, |
| 1356 | | .PERM => return error.AccessDenied, |
| 1357 | .PERM => return error.PermissionDenied, |
| 1357 | 1358 | .PIPE => return error.BrokenPipe, |
| 1358 | 1359 | .CONNRESET => return error.ConnectionResetByPeer, |
| 1359 | 1360 | .BUSY => return error.DeviceBusy, |
| ... | ... | @@ -1410,7 +1411,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { |
| 1410 | 1411 | .FBIG => return error.FileTooBig, |
| 1411 | 1412 | .IO => return error.InputOutput, |
| 1412 | 1413 | .NOSPC => return error.NoSpaceLeft, |
| 1413 | | .PERM => return error.AccessDenied, |
| 1414 | .PERM => return error.PermissionDenied, |
| 1414 | 1415 | .PIPE => return error.BrokenPipe, |
| 1415 | 1416 | .NXIO => return error.Unseekable, |
| 1416 | 1417 | .SPIPE => return error.Unseekable, |
| ... | ... | @@ -1443,7 +1444,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { |
| 1443 | 1444 | .FBIG => return error.FileTooBig, |
| 1444 | 1445 | .IO => return error.InputOutput, |
| 1445 | 1446 | .NOSPC => return error.NoSpaceLeft, |
| 1446 | | .PERM => return error.AccessDenied, |
| 1447 | .PERM => return error.PermissionDenied, |
| 1447 | 1448 | .PIPE => return error.BrokenPipe, |
| 1448 | 1449 | .NXIO => return error.Unseekable, |
| 1449 | 1450 | .SPIPE => return error.Unseekable, |
| ... | ... | @@ -1502,7 +1503,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz |
| 1502 | 1503 | .FBIG => return error.FileTooBig, |
| 1503 | 1504 | .IO => return error.InputOutput, |
| 1504 | 1505 | .NOSPC => return error.NoSpaceLeft, |
| 1505 | | .PERM => return error.AccessDenied, |
| 1506 | .PERM => return error.PermissionDenied, |
| 1506 | 1507 | .PIPE => return error.BrokenPipe, |
| 1507 | 1508 | .NXIO => return error.Unseekable, |
| 1508 | 1509 | .SPIPE => return error.Unseekable, |
| ... | ... | @@ -1528,7 +1529,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz |
| 1528 | 1529 | .FBIG => return error.FileTooBig, |
| 1529 | 1530 | .IO => return error.InputOutput, |
| 1530 | 1531 | .NOSPC => return error.NoSpaceLeft, |
| 1531 | | .PERM => return error.AccessDenied, |
| 1532 | .PERM => return error.PermissionDenied, |
| 1532 | 1533 | .PIPE => return error.BrokenPipe, |
| 1533 | 1534 | .NXIO => return error.Unseekable, |
| 1534 | 1535 | .SPIPE => return error.Unseekable, |
| ... | ... | @@ -1543,6 +1544,7 @@ pub const OpenError = error{ |
| 1543 | 1544 | /// In WASI, this error may occur when the file descriptor does |
| 1544 | 1545 | /// not hold the required rights to open a new resource relative to it. |
| 1545 | 1546 | AccessDenied, |
| 1547 | PermissionDenied, |
| 1546 | 1548 | SymLinkLoop, |
| 1547 | 1549 | ProcessFdQuotaExceeded, |
| 1548 | 1550 | SystemFdQuotaExceeded, |
| ... | ... | @@ -1660,7 +1662,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: O, perm: mode_t) OpenError!fd_t { |
| 1660 | 1662 | .NOMEM => return error.SystemResources, |
| 1661 | 1663 | .NOSPC => return error.NoSpaceLeft, |
| 1662 | 1664 | .NOTDIR => return error.NotDir, |
| 1663 | | .PERM => return error.AccessDenied, |
| 1665 | .PERM => return error.PermissionDenied, |
| 1664 | 1666 | .EXIST => return error.PathAlreadyExists, |
| 1665 | 1667 | .BUSY => return error.DeviceBusy, |
| 1666 | 1668 | .ILSEQ => |err| if (native_os == .wasi) |
| ... | ... | @@ -1831,7 +1833,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: O, mode: mode_t) O |
| 1831 | 1833 | .NOMEM => return error.SystemResources, |
| 1832 | 1834 | .NOSPC => return error.NoSpaceLeft, |
| 1833 | 1835 | .NOTDIR => return error.NotDir, |
| 1834 | | .PERM => return error.AccessDenied, |
| 1836 | .PERM => return error.PermissionDenied, |
| 1835 | 1837 | .EXIST => return error.PathAlreadyExists, |
| 1836 | 1838 | .BUSY => return error.DeviceBusy, |
| 1837 | 1839 | .OPNOTSUPP => return error.FileLocksNotSupported, |
| ... | ... | @@ -1873,6 +1875,7 @@ pub fn dup2(old_fd: fd_t, new_fd: fd_t) !void { |
| 1873 | 1875 | pub const ExecveError = error{ |
| 1874 | 1876 | SystemResources, |
| 1875 | 1877 | AccessDenied, |
| 1878 | PermissionDenied, |
| 1876 | 1879 | InvalidExe, |
| 1877 | 1880 | FileSystem, |
| 1878 | 1881 | IsDir, |
| ... | ... | @@ -1899,7 +1902,7 @@ pub fn execveZ( |
| 1899 | 1902 | .NFILE => return error.SystemFdQuotaExceeded, |
| 1900 | 1903 | .NOMEM => return error.SystemResources, |
| 1901 | 1904 | .ACCES => return error.AccessDenied, |
| 1902 | | .PERM => return error.AccessDenied, |
| 1905 | .PERM => return error.PermissionDenied, |
| 1903 | 1906 | .INVAL => return error.InvalidExe, |
| 1904 | 1907 | .NOEXEC => return error.InvalidExe, |
| 1905 | 1908 | .IO => return error.FileSystem, |
| ... | ... | @@ -2077,6 +2080,7 @@ pub const SymLinkError = error{ |
| 2077 | 2080 | /// In WASI, this error may occur when the file descriptor does |
| 2078 | 2081 | /// not hold the required rights to create a new symbolic link relative to it. |
| 2079 | 2082 | AccessDenied, |
| 2083 | PermissionDenied, |
| 2080 | 2084 | DiskQuota, |
| 2081 | 2085 | PathAlreadyExists, |
| 2082 | 2086 | FileSystem, |
| ... | ... | @@ -2130,7 +2134,7 @@ pub fn symlinkZ(target_path: [*:0]const u8, sym_link_path: [*:0]const u8) SymLin |
| 2130 | 2134 | .FAULT => unreachable, |
| 2131 | 2135 | .INVAL => unreachable, |
| 2132 | 2136 | .ACCES => return error.AccessDenied, |
| 2133 | | .PERM => return error.AccessDenied, |
| 2137 | .PERM => return error.PermissionDenied, |
| 2134 | 2138 | .DQUOT => return error.DiskQuota, |
| 2135 | 2139 | .EXIST => return error.PathAlreadyExists, |
| 2136 | 2140 | .IO => return error.FileSystem, |
| ... | ... | @@ -2208,7 +2212,7 @@ pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*: |
| 2208 | 2212 | .FAULT => unreachable, |
| 2209 | 2213 | .INVAL => unreachable, |
| 2210 | 2214 | .ACCES => return error.AccessDenied, |
| 2211 | | .PERM => return error.AccessDenied, |
| 2215 | .PERM => return error.PermissionDenied, |
| 2212 | 2216 | .DQUOT => return error.DiskQuota, |
| 2213 | 2217 | .EXIST => return error.PathAlreadyExists, |
| 2214 | 2218 | .IO => return error.FileSystem, |
| ... | ... | @@ -2229,6 +2233,7 @@ pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*: |
| 2229 | 2233 | |
| 2230 | 2234 | pub const LinkError = UnexpectedError || error{ |
| 2231 | 2235 | AccessDenied, |
| 2236 | PermissionDenied, |
| 2232 | 2237 | DiskQuota, |
| 2233 | 2238 | PathAlreadyExists, |
| 2234 | 2239 | FileSystem, |
| ... | ... | @@ -2264,7 +2269,7 @@ pub fn linkZ(oldpath: [*:0]const u8, newpath: [*:0]const u8) LinkError!void { |
| 2264 | 2269 | .NOENT => return error.FileNotFound, |
| 2265 | 2270 | .NOMEM => return error.SystemResources, |
| 2266 | 2271 | .NOSPC => return error.NoSpaceLeft, |
| 2267 | | .PERM => return error.AccessDenied, |
| 2272 | .PERM => return error.PermissionDenied, |
| 2268 | 2273 | .ROFS => return error.ReadOnlyFileSystem, |
| 2269 | 2274 | .XDEV => return error.NotSameFileSystem, |
| 2270 | 2275 | .INVAL => unreachable, |
| ... | ... | @@ -2318,7 +2323,7 @@ pub fn linkatZ( |
| 2318 | 2323 | .NOMEM => return error.SystemResources, |
| 2319 | 2324 | .NOSPC => return error.NoSpaceLeft, |
| 2320 | 2325 | .NOTDIR => return error.NotDir, |
| 2321 | | .PERM => return error.AccessDenied, |
| 2326 | .PERM => return error.PermissionDenied, |
| 2322 | 2327 | .ROFS => return error.ReadOnlyFileSystem, |
| 2323 | 2328 | .XDEV => return error.NotSameFileSystem, |
| 2324 | 2329 | .INVAL => unreachable, |
| ... | ... | @@ -2367,7 +2372,7 @@ pub fn linkat( |
| 2367 | 2372 | .NOMEM => return error.SystemResources, |
| 2368 | 2373 | .NOSPC => return error.NoSpaceLeft, |
| 2369 | 2374 | .NOTDIR => return error.NotDir, |
| 2370 | | .PERM => return error.AccessDenied, |
| 2375 | .PERM => return error.PermissionDenied, |
| 2371 | 2376 | .ROFS => return error.ReadOnlyFileSystem, |
| 2372 | 2377 | .XDEV => return error.NotSameFileSystem, |
| 2373 | 2378 | .INVAL => unreachable, |
| ... | ... | @@ -2386,6 +2391,7 @@ pub const UnlinkError = error{ |
| 2386 | 2391 | /// In WASI, this error may occur when the file descriptor does |
| 2387 | 2392 | /// not hold the required rights to unlink a resource by path relative to it. |
| 2388 | 2393 | AccessDenied, |
| 2394 | PermissionDenied, |
| 2389 | 2395 | FileBusy, |
| 2390 | 2396 | FileSystem, |
| 2391 | 2397 | IsDir, |
| ... | ... | @@ -2441,7 +2447,7 @@ pub fn unlinkZ(file_path: [*:0]const u8) UnlinkError!void { |
| 2441 | 2447 | switch (errno(system.unlink(file_path))) { |
| 2442 | 2448 | .SUCCESS => return, |
| 2443 | 2449 | .ACCES => return error.AccessDenied, |
| 2444 | | .PERM => return error.AccessDenied, |
| 2450 | .PERM => return error.PermissionDenied, |
| 2445 | 2451 | .BUSY => return error.FileBusy, |
| 2446 | 2452 | .FAULT => unreachable, |
| 2447 | 2453 | .INVAL => unreachable, |
| ... | ... | @@ -2535,7 +2541,7 @@ pub fn unlinkatZ(dirfd: fd_t, file_path_c: [*:0]const u8, flags: u32) UnlinkatEr |
| 2535 | 2541 | switch (errno(system.unlinkat(dirfd, file_path_c, flags))) { |
| 2536 | 2542 | .SUCCESS => return, |
| 2537 | 2543 | .ACCES => return error.AccessDenied, |
| 2538 | | .PERM => return error.AccessDenied, |
| 2544 | .PERM => return error.PermissionDenied, |
| 2539 | 2545 | .BUSY => return error.FileBusy, |
| 2540 | 2546 | .FAULT => unreachable, |
| 2541 | 2547 | .IO => return error.FileSystem, |
| ... | ... | @@ -2573,6 +2579,7 @@ pub const RenameError = error{ |
| 2573 | 2579 | /// On Windows, this error may be returned instead of PathAlreadyExists when |
| 2574 | 2580 | /// renaming a directory over an existing directory. |
| 2575 | 2581 | AccessDenied, |
| 2582 | PermissionDenied, |
| 2576 | 2583 | FileBusy, |
| 2577 | 2584 | DiskQuota, |
| 2578 | 2585 | IsDir, |
| ... | ... | @@ -2635,7 +2642,7 @@ pub fn renameZ(old_path: [*:0]const u8, new_path: [*:0]const u8) RenameError!voi |
| 2635 | 2642 | switch (errno(system.rename(old_path, new_path))) { |
| 2636 | 2643 | .SUCCESS => return, |
| 2637 | 2644 | .ACCES => return error.AccessDenied, |
| 2638 | | .PERM => return error.AccessDenied, |
| 2645 | .PERM => return error.PermissionDenied, |
| 2639 | 2646 | .BUSY => return error.FileBusy, |
| 2640 | 2647 | .DQUOT => return error.DiskQuota, |
| 2641 | 2648 | .FAULT => unreachable, |
| ... | ... | @@ -2750,7 +2757,7 @@ pub fn renameatZ( |
| 2750 | 2757 | switch (errno(system.renameat(old_dir_fd, old_path, new_dir_fd, new_path))) { |
| 2751 | 2758 | .SUCCESS => return, |
| 2752 | 2759 | .ACCES => return error.AccessDenied, |
| 2753 | | .PERM => return error.AccessDenied, |
| 2760 | .PERM => return error.PermissionDenied, |
| 2754 | 2761 | .BUSY => return error.FileBusy, |
| 2755 | 2762 | .DQUOT => return error.DiskQuota, |
| 2756 | 2763 | .FAULT => unreachable, |
| ... | ... | @@ -2933,7 +2940,7 @@ pub fn mkdiratZ(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: mode_t) MakeDir |
| 2933 | 2940 | .SUCCESS => return, |
| 2934 | 2941 | .ACCES => return error.AccessDenied, |
| 2935 | 2942 | .BADF => unreachable, |
| 2936 | | .PERM => return error.AccessDenied, |
| 2943 | .PERM => return error.PermissionDenied, |
| 2937 | 2944 | .DQUOT => return error.DiskQuota, |
| 2938 | 2945 | .EXIST => return error.PathAlreadyExists, |
| 2939 | 2946 | .FAULT => unreachable, |
| ... | ... | @@ -2978,6 +2985,7 @@ pub const MakeDirError = error{ |
| 2978 | 2985 | /// In WASI, this error may occur when the file descriptor does |
| 2979 | 2986 | /// not hold the required rights to create a new directory relative to it. |
| 2980 | 2987 | AccessDenied, |
| 2988 | PermissionDenied, |
| 2981 | 2989 | DiskQuota, |
| 2982 | 2990 | PathAlreadyExists, |
| 2983 | 2991 | SymLinkLoop, |
| ... | ... | @@ -3030,7 +3038,7 @@ pub fn mkdirZ(dir_path: [*:0]const u8, mode: mode_t) MakeDirError!void { |
| 3030 | 3038 | switch (errno(system.mkdir(dir_path, mode))) { |
| 3031 | 3039 | .SUCCESS => return, |
| 3032 | 3040 | .ACCES => return error.AccessDenied, |
| 3033 | | .PERM => return error.AccessDenied, |
| 3041 | .PERM => return error.PermissionDenied, |
| 3034 | 3042 | .DQUOT => return error.DiskQuota, |
| 3035 | 3043 | .EXIST => return error.PathAlreadyExists, |
| 3036 | 3044 | .FAULT => unreachable, |
| ... | ... | @@ -3071,6 +3079,7 @@ pub fn mkdirW(dir_path_w: []const u16, mode: mode_t) MakeDirError!void { |
| 3071 | 3079 | |
| 3072 | 3080 | pub const DeleteDirError = error{ |
| 3073 | 3081 | AccessDenied, |
| 3082 | PermissionDenied, |
| 3074 | 3083 | FileBusy, |
| 3075 | 3084 | SymLinkLoop, |
| 3076 | 3085 | NameTooLong, |
| ... | ... | @@ -3123,7 +3132,7 @@ pub fn rmdirZ(dir_path: [*:0]const u8) DeleteDirError!void { |
| 3123 | 3132 | switch (errno(system.rmdir(dir_path))) { |
| 3124 | 3133 | .SUCCESS => return, |
| 3125 | 3134 | .ACCES => return error.AccessDenied, |
| 3126 | | .PERM => return error.AccessDenied, |
| 3135 | .PERM => return error.PermissionDenied, |
| 3127 | 3136 | .BUSY => return error.FileBusy, |
| 3128 | 3137 | .FAULT => unreachable, |
| 3129 | 3138 | .INVAL => return error.BadPathName, |
| ... | ... | @@ -3254,6 +3263,7 @@ pub const ReadLinkError = error{ |
| 3254 | 3263 | /// In WASI, this error may occur when the file descriptor does |
| 3255 | 3264 | /// not hold the required rights to read value of a symbolic link relative to it. |
| 3256 | 3265 | AccessDenied, |
| 3266 | PermissionDenied, |
| 3257 | 3267 | FileSystem, |
| 3258 | 3268 | SymLinkLoop, |
| 3259 | 3269 | NameTooLong, |
| ... | ... | @@ -3534,7 +3544,7 @@ pub fn isatty(handle: fd_t) bool { |
| 3534 | 3544 | pub const SocketError = error{ |
| 3535 | 3545 | /// Permission to create a socket of the specified type and/or |
| 3536 | 3546 | /// pro‐tocol is denied. |
| 3537 | | PermissionDenied, |
| 3547 | AccessDenied, |
| 3538 | 3548 | |
| 3539 | 3549 | /// The implementation does not support the specified address family. |
| 3540 | 3550 | AddressFamilyNotSupported, |
| ... | ... | @@ -3604,7 +3614,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!socket_t |
| 3604 | 3614 | } |
| 3605 | 3615 | return fd; |
| 3606 | 3616 | }, |
| 3607 | | .ACCES => return error.PermissionDenied, |
| 3617 | .ACCES => return error.AccessDenied, |
| 3608 | 3618 | .AFNOSUPPORT => return error.AddressFamilyNotSupported, |
| 3609 | 3619 | .INVAL => return error.ProtocolFamilyNotAvailable, |
| 3610 | 3620 | .MFILE => return error.ProcessFdQuotaExceeded, |
| ... | ... | @@ -4188,6 +4198,9 @@ pub const ConnectError = error{ |
| 4188 | 4198 | /// or |
| 4189 | 4199 | /// The user tried to connect to a broadcast address without having the socket broadcast flag enabled or |
| 4190 | 4200 | /// the connection request failed because of a local firewall rule. |
| 4201 | AccessDenied, |
| 4202 | |
| 4203 | /// See AccessDenied |
| 4191 | 4204 | PermissionDenied, |
| 4192 | 4205 | |
| 4193 | 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 | 4274 | while (true) { |
| 4262 | 4275 | switch (errno(system.connect(sock, sock_addr, len))) { |
| 4263 | 4276 | .SUCCESS => return, |
| 4264 | | .ACCES => return error.PermissionDenied, |
| 4277 | .ACCES => return error.AccessDenied, |
| 4265 | 4278 | .PERM => return error.PermissionDenied, |
| 4266 | 4279 | .ADDRINUSE => return error.AddressInUse, |
| 4267 | 4280 | .ADDRNOTAVAIL => return error.AddressNotAvailable, |
| ... | ... | @@ -4323,7 +4336,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void { |
| 4323 | 4336 | switch (errno(rc)) { |
| 4324 | 4337 | .SUCCESS => switch (@as(E, @enumFromInt(err_code))) { |
| 4325 | 4338 | .SUCCESS => return, |
| 4326 | | .ACCES => return error.PermissionDenied, |
| 4339 | .ACCES => return error.AccessDenied, |
| 4327 | 4340 | .PERM => return error.PermissionDenied, |
| 4328 | 4341 | .ADDRINUSE => return error.AddressInUse, |
| 4329 | 4342 | .ADDRNOTAVAIL => return error.AddressNotAvailable, |
| ... | ... | @@ -4398,6 +4411,7 @@ pub const FStatError = error{ |
| 4398 | 4411 | /// In WASI, this error may occur when the file descriptor does |
| 4399 | 4412 | /// not hold the required rights to get its filestat information. |
| 4400 | 4413 | AccessDenied, |
| 4414 | PermissionDenied, |
| 4401 | 4415 | } || UnexpectedError; |
| 4402 | 4416 | |
| 4403 | 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 | 4480 | .BADF => unreachable, // Always a race condition. |
| 4467 | 4481 | .NOMEM => return error.SystemResources, |
| 4468 | 4482 | .ACCES => return error.AccessDenied, |
| 4469 | | .PERM => return error.AccessDenied, |
| 4483 | .PERM => return error.PermissionDenied, |
| 4470 | 4484 | .FAULT => unreachable, |
| 4471 | 4485 | .NAMETOOLONG => return error.NameTooLong, |
| 4472 | 4486 | .LOOP => return error.SymLinkLoop, |
| ... | ... | @@ -4870,6 +4884,7 @@ pub fn msync(memory: []align(page_size_min) u8, flags: i32) MSyncError!void { |
| 4870 | 4884 | } |
| 4871 | 4885 | |
| 4872 | 4886 | pub const AccessError = error{ |
| 4887 | AccessDenied, |
| 4873 | 4888 | PermissionDenied, |
| 4874 | 4889 | FileNotFound, |
| 4875 | 4890 | NameTooLong, |
| ... | ... | @@ -4917,7 +4932,7 @@ pub fn accessZ(path: [*:0]const u8, mode: u32) AccessError!void { |
| 4917 | 4932 | } |
| 4918 | 4933 | switch (errno(system.access(path, mode))) { |
| 4919 | 4934 | .SUCCESS => return, |
| 4920 | | .ACCES => return error.PermissionDenied, |
| 4935 | .ACCES => return error.AccessDenied, |
| 4921 | 4936 | .PERM => return error.PermissionDenied, |
| 4922 | 4937 | .ROFS => return error.ReadOnlyFileSystem, |
| 4923 | 4938 | .LOOP => return error.SymLinkLoop, |
| ... | ... | @@ -4998,7 +5013,7 @@ pub fn faccessatZ(dirfd: fd_t, path: [*:0]const u8, mode: u32, flags: u32) Acces |
| 4998 | 5013 | } |
| 4999 | 5014 | switch (errno(system.faccessat(dirfd, path, mode, flags))) { |
| 5000 | 5015 | .SUCCESS => return, |
| 5001 | | .ACCES => return error.PermissionDenied, |
| 5016 | .ACCES => return error.AccessDenied, |
| 5002 | 5017 | .PERM => return error.PermissionDenied, |
| 5003 | 5018 | .ROFS => return error.ReadOnlyFileSystem, |
| 5004 | 5019 | .LOOP => return error.SymLinkLoop, |
| ... | ... | @@ -5049,7 +5064,7 @@ pub fn faccessatW(dirfd: fd_t, sub_path_w: [*:0]const u16) AccessError!void { |
| 5049 | 5064 | .OBJECT_PATH_NOT_FOUND => return error.FileNotFound, |
| 5050 | 5065 | .OBJECT_NAME_INVALID => unreachable, |
| 5051 | 5066 | .INVALID_PARAMETER => unreachable, |
| 5052 | | .ACCESS_DENIED => return error.PermissionDenied, |
| 5067 | .ACCESS_DENIED => return error.AccessDenied, |
| 5053 | 5068 | .OBJECT_PATH_SYNTAX_BAD => unreachable, |
| 5054 | 5069 | else => |rc| return windows.unexpectedStatus(rc), |
| 5055 | 5070 | } |
| ... | ... | @@ -5431,6 +5446,7 @@ pub fn flock(fd: fd_t, operation: i32) FlockError!void { |
| 5431 | 5446 | pub const RealPathError = error{ |
| 5432 | 5447 | FileNotFound, |
| 5433 | 5448 | AccessDenied, |
| 5449 | PermissionDenied, |
| 5434 | 5450 | NameTooLong, |
| 5435 | 5451 | NotSupported, |
| 5436 | 5452 | NotDir, |
| ... | ... | @@ -6812,7 +6828,7 @@ pub const SetSockOptError = error{ |
| 6812 | 6828 | /// Insufficient resources are available in the system to complete the call. |
| 6813 | 6829 | SystemResources, |
| 6814 | 6830 | |
| 6815 | | // Setting the socket option requires more elevated permissions. |
| 6831 | /// Setting the socket option requires more elevated permissions. |
| 6816 | 6832 | PermissionDenied, |
| 6817 | 6833 | |
| 6818 | 6834 | OperationNotSupported, |
| ... | ... | @@ -7307,7 +7323,7 @@ pub fn perf_event_open( |
| 7307 | 7323 | } |
| 7308 | 7324 | |
| 7309 | 7325 | pub const TimerFdCreateError = error{ |
| 7310 | | AccessDenied, |
| 7326 | PermissionDenied, |
| 7311 | 7327 | ProcessFdQuotaExceeded, |
| 7312 | 7328 | SystemFdQuotaExceeded, |
| 7313 | 7329 | NoDevice, |
| ... | ... | @@ -7326,7 +7342,7 @@ pub fn timerfd_create(clock_id: system.timerfd_clockid_t, flags: system.TFD) Tim |
| 7326 | 7342 | .NFILE => return error.SystemFdQuotaExceeded, |
| 7327 | 7343 | .NODEV => return error.NoDevice, |
| 7328 | 7344 | .NOMEM => return error.SystemResources, |
| 7329 | | .PERM => return error.AccessDenied, |
| 7345 | .PERM => return error.PermissionDenied, |
| 7330 | 7346 | else => |err| return unexpectedErrno(err), |
| 7331 | 7347 | }; |
| 7332 | 7348 | } |