authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-19 16:48:35-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:11-08:00
log64de4a7371e3851dddf39c608d08d480395bb0ab
tree2d323d592f66dbe273199190ccd7894500e03e90
parenta8088306f6223b07ad9b7ae37486bcc9e0ac08c9

std.Io.Threaded: remove handling of ECANCELED

The only known situation in which this occurs is when using musl with the undocumented extension PTHREAD_CANCEL_MASKED, causing the next syscall to return ECANCELED. However zig std lib does not use this mechanism, even when targeting musl libc because it would require each async task to be on a fresh pthread. For the same reason, if third party code were to cause ECANCELED to be returned from any of these syscalls, it would cause subsequent tasks to be incorrectly canceled since they cannot be rearmed. Thus, this Io implementation cannot handle this error code correctly, expecting never to receive it.

1 files changed, 1 insertions(+), 112 deletions(-)

lib/std/Io/Threaded.zig+1-112
...@@ -216,13 +216,6 @@ const Thread = struct {...@@ -216,13 +216,6 @@ const Thread = struct {
216 ) orelse return;216 ) orelse return;
217 }217 }
218218
219 fn endSyscallCanceled(thread: *Thread) Io.Cancelable {
220 if (thread.current_closure) |closure| {
221 @atomicStore(CancelStatus, &closure.cancel_status, .acknowledged, .release);
222 }
223 return error.Canceled;
224 }
225
226 fn currentSignalId() SignaleeId {219 fn currentSignalId() SignaleeId {
227 return if (std.Thread.use_pthreads) std.c.pthread_self() else std.Thread.getCurrentId();220 return if (std.Thread.use_pthreads) std.c.pthread_self() else std.Thread.getCurrentId();
228 }221 }
...@@ -1531,7 +1524,6 @@ fn dirCreateDirPosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, perm...@@ -1531,7 +1524,6 @@ fn dirCreateDirPosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, perm
1531 try current_thread.checkCancel();1524 try current_thread.checkCancel();
1532 continue;1525 continue;
1533 },1526 },
1534 .CANCELED => return current_thread.endSyscallCanceled(),
1535 else => |e| {1527 else => |e| {
1536 current_thread.endSyscall();1528 current_thread.endSyscall();
1537 switch (e) {1529 switch (e) {
...@@ -1574,7 +1566,6 @@ fn dirCreateDirWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permi...@@ -1574,7 +1566,6 @@ fn dirCreateDirWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permi
1574 try current_thread.checkCancel();1566 try current_thread.checkCancel();
1575 continue;1567 continue;
1576 },1568 },
1577 .CANCELED => return current_thread.endSyscallCanceled(),
1578 else => |e| {1569 else => |e| {
1579 current_thread.endSyscall();1570 current_thread.endSyscall();
1580 switch (e) {1571 switch (e) {
...@@ -1875,7 +1866,6 @@ fn dirStatFileLinux(...@@ -1875,7 +1866,6 @@ fn dirStatFileLinux(
1875 try current_thread.checkCancel();1866 try current_thread.checkCancel();
1876 continue;1867 continue;
1877 },1868 },
1878 .CANCELED => return current_thread.endSyscallCanceled(),
1879 else => |e| {1869 else => |e| {
1880 current_thread.endSyscall();1870 current_thread.endSyscall();
1881 switch (e) {1871 switch (e) {
...@@ -1925,7 +1915,6 @@ fn posixStatFile(current_thread: *Thread, dir_fd: posix.fd_t, sub_path: [:0]cons...@@ -1925,7 +1915,6 @@ fn posixStatFile(current_thread: *Thread, dir_fd: posix.fd_t, sub_path: [:0]cons
1925 try current_thread.checkCancel();1915 try current_thread.checkCancel();
1926 continue;1916 continue;
1927 },1917 },
1928 .CANCELED => return current_thread.endSyscallCanceled(),
1929 else => |e| {1918 else => |e| {
1930 current_thread.endSyscall();1919 current_thread.endSyscall();
1931 switch (e) {1920 switch (e) {
...@@ -1986,7 +1975,6 @@ fn dirStatFileWasi(...@@ -1986,7 +1975,6 @@ fn dirStatFileWasi(
1986 try current_thread.checkCancel();1975 try current_thread.checkCancel();
1987 continue;1976 continue;
1988 },1977 },
1989 .CANCELED => return current_thread.endSyscallCanceled(),
1990 else => |e| {1978 else => |e| {
1991 current_thread.endSyscall();1979 current_thread.endSyscall();
1992 switch (e) {1980 switch (e) {
...@@ -2026,7 +2014,6 @@ fn fileLength(userdata: ?*anyopaque, file: File) File.LengthError!u64 {...@@ -2026,7 +2014,6 @@ fn fileLength(userdata: ?*anyopaque, file: File) File.LengthError!u64 {
2026 try current_thread.checkCancel();2014 try current_thread.checkCancel();
2027 continue;2015 continue;
2028 },2016 },
2029 .CANCELED => return current_thread.endSyscallCanceled(),
2030 else => |e| {2017 else => |e| {
2031 current_thread.endSyscall();2018 current_thread.endSyscall();
2032 switch (e) {2019 switch (e) {
...@@ -2077,7 +2064,6 @@ fn fileStatPosix(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {...@@ -2077,7 +2064,6 @@ fn fileStatPosix(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {
2077 try current_thread.checkCancel();2064 try current_thread.checkCancel();
2078 continue;2065 continue;
2079 },2066 },
2080 .CANCELED => return current_thread.endSyscallCanceled(),
2081 else => |e| {2067 else => |e| {
2082 current_thread.endSyscall();2068 current_thread.endSyscall();
2083 switch (e) {2069 switch (e) {
...@@ -2130,7 +2116,6 @@ fn fileStatLinux(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {...@@ -2130,7 +2116,6 @@ fn fileStatLinux(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {
2130 try current_thread.checkCancel();2116 try current_thread.checkCancel();
2131 continue;2117 continue;
2132 },2118 },
2133 .CANCELED => return current_thread.endSyscallCanceled(),
2134 else => |e| {2119 else => |e| {
2135 current_thread.endSyscall();2120 current_thread.endSyscall();
2136 switch (e) {2121 switch (e) {
...@@ -2215,7 +2200,6 @@ fn fileStatWasi(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {...@@ -2215,7 +2200,6 @@ fn fileStatWasi(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {
2215 try current_thread.checkCancel();2200 try current_thread.checkCancel();
2216 continue;2201 continue;
2217 },2202 },
2218 .CANCELED => return current_thread.endSyscallCanceled(),
2219 else => |e| {2203 else => |e| {
2220 current_thread.endSyscall();2204 current_thread.endSyscall();
2221 switch (e) {2205 switch (e) {
...@@ -2267,7 +2251,6 @@ fn dirAccessPosix(...@@ -2267,7 +2251,6 @@ fn dirAccessPosix(
2267 try current_thread.checkCancel();2251 try current_thread.checkCancel();
2268 continue;2252 continue;
2269 },2253 },
2270 .CANCELED => return current_thread.endSyscallCanceled(),
2271 else => |e| {2254 else => |e| {
2272 current_thread.endSyscall();2255 current_thread.endSyscall();
2273 switch (e) {2256 switch (e) {
...@@ -2317,7 +2300,6 @@ fn dirAccessWasi(...@@ -2317,7 +2300,6 @@ fn dirAccessWasi(
2317 try current_thread.checkCancel();2300 try current_thread.checkCancel();
2318 continue;2301 continue;
2319 },2302 },
2320 .CANCELED => return current_thread.endSyscallCanceled(),
2321 else => |e| {2303 else => |e| {
2322 current_thread.endSyscall();2304 current_thread.endSyscall();
2323 switch (e) {2305 switch (e) {
...@@ -2464,7 +2446,6 @@ fn dirCreateFilePosix(...@@ -2464,7 +2446,6 @@ fn dirCreateFilePosix(
2464 try current_thread.checkCancel();2446 try current_thread.checkCancel();
2465 continue;2447 continue;
2466 },2448 },
2467 .CANCELED => return current_thread.endSyscallCanceled(),
2468 else => |e| {2449 else => |e| {
2469 current_thread.endSyscall();2450 current_thread.endSyscall();
2470 switch (e) {2451 switch (e) {
...@@ -2519,7 +2500,6 @@ fn dirCreateFilePosix(...@@ -2519,7 +2500,6 @@ fn dirCreateFilePosix(
2519 try current_thread.checkCancel();2500 try current_thread.checkCancel();
2520 continue;2501 continue;
2521 },2502 },
2522 .CANCELED => return current_thread.endSyscallCanceled(),
2523 else => |e| {2503 else => |e| {
2524 current_thread.endSyscall();2504 current_thread.endSyscall();
2525 switch (e) {2505 switch (e) {
...@@ -2686,7 +2666,6 @@ fn dirCreateFileWasi(...@@ -2686,7 +2666,6 @@ fn dirCreateFileWasi(
2686 try current_thread.checkCancel();2666 try current_thread.checkCancel();
2687 continue;2667 continue;
2688 },2668 },
2689 .CANCELED => return current_thread.endSyscallCanceled(),
2690 else => |e| {2669 else => |e| {
2691 current_thread.endSyscall();2670 current_thread.endSyscall();
2692 switch (e) {2671 switch (e) {
...@@ -2783,7 +2762,6 @@ fn dirOpenFilePosix(...@@ -2783,7 +2762,6 @@ fn dirOpenFilePosix(
2783 try current_thread.checkCancel();2762 try current_thread.checkCancel();
2784 continue;2763 continue;
2785 },2764 },
2786 .CANCELED => return current_thread.endSyscallCanceled(),
2787 else => |e| {2765 else => |e| {
2788 current_thread.endSyscall();2766 current_thread.endSyscall();
2789 switch (e) {2767 switch (e) {
...@@ -2849,7 +2827,6 @@ fn dirOpenFilePosix(...@@ -2849,7 +2827,6 @@ fn dirOpenFilePosix(
2849 try current_thread.checkCancel();2827 try current_thread.checkCancel();
2850 continue;2828 continue;
2851 },2829 },
2852 .CANCELED => return current_thread.endSyscallCanceled(),
2853 else => |e| {2830 else => |e| {
2854 current_thread.endSyscall();2831 current_thread.endSyscall();
2855 switch (e) {2832 switch (e) {
...@@ -2878,7 +2855,6 @@ fn dirOpenFilePosix(...@@ -2878,7 +2855,6 @@ fn dirOpenFilePosix(
2878 try current_thread.checkCancel();2855 try current_thread.checkCancel();
2879 continue;2856 continue;
2880 },2857 },
2881 .CANCELED => return current_thread.endSyscallCanceled(),
2882 else => |err| {2858 else => |err| {
2883 current_thread.endSyscall();2859 current_thread.endSyscall();
2884 return posix.unexpectedErrno(err);2860 return posix.unexpectedErrno(err);
...@@ -2899,7 +2875,6 @@ fn dirOpenFilePosix(...@@ -2899,7 +2875,6 @@ fn dirOpenFilePosix(
2899 try current_thread.checkCancel();2875 try current_thread.checkCancel();
2900 continue;2876 continue;
2901 },2877 },
2902 .CANCELED => return current_thread.endSyscallCanceled(),
2903 else => |err| {2878 else => |err| {
2904 current_thread.endSyscall();2879 current_thread.endSyscall();
2905 return posix.unexpectedErrno(err);2880 return posix.unexpectedErrno(err);
...@@ -3104,7 +3079,6 @@ fn dirOpenFileWasi(...@@ -3104,7 +3079,6 @@ fn dirOpenFileWasi(
3104 try current_thread.checkCancel();3079 try current_thread.checkCancel();
3105 continue;3080 continue;
3106 },3081 },
3107 .CANCELED => return current_thread.endSyscallCanceled(),
3108 else => |e| {3082 else => |e| {
3109 current_thread.endSyscall();3083 current_thread.endSyscall();
3110 switch (e) {3084 switch (e) {
...@@ -3203,7 +3177,6 @@ fn dirOpenDirPosix(...@@ -3203,7 +3177,6 @@ fn dirOpenDirPosix(
3203 try current_thread.checkCancel();3177 try current_thread.checkCancel();
3204 continue;3178 continue;
3205 },3179 },
3206 .CANCELED => return current_thread.endSyscallCanceled(),
3207 else => |e| {3180 else => |e| {
3208 current_thread.endSyscall();3181 current_thread.endSyscall();
3209 switch (e) {3182 switch (e) {
...@@ -3256,7 +3229,6 @@ fn dirOpenDirHaiku(...@@ -3256,7 +3229,6 @@ fn dirOpenDirHaiku(
3256 try current_thread.checkCancel();3229 try current_thread.checkCancel();
3257 continue;3230 continue;
3258 },3231 },
3259 .CANCELED => return current_thread.endSyscallCanceled(),
3260 else => |e| {3232 else => |e| {
3261 current_thread.endSyscall();3233 current_thread.endSyscall();
3262 switch (e) {3234 switch (e) {
...@@ -3398,7 +3370,6 @@ fn dirReadLinux(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir...@@ -3398,7 +3370,6 @@ fn dirReadLinux(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir
3398 try current_thread.checkCancel();3370 try current_thread.checkCancel();
3399 continue;3371 continue;
3400 },3372 },
3401 .CANCELED => return current_thread.endSyscallCanceled(),
3402 else => |e| {3373 else => |e| {
3403 current_thread.endSyscall();3374 current_thread.endSyscall();
3404 switch (e) {3375 switch (e) {
...@@ -3508,7 +3479,6 @@ fn dirReadDarwin(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Di...@@ -3508,7 +3479,6 @@ fn dirReadDarwin(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Di
3508 try current_thread.checkCancel();3479 try current_thread.checkCancel();
3509 continue;3480 continue;
3510 },3481 },
3511 .CANCELED => return current_thread.endSyscallCanceled(),
3512 else => |e| {3482 else => |e| {
3513 current_thread.endSyscall();3483 current_thread.endSyscall();
3514 switch (e) {3484 switch (e) {
...@@ -3585,7 +3555,6 @@ fn dirReadBsd(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir.R...@@ -3585,7 +3555,6 @@ fn dirReadBsd(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir.R
3585 try current_thread.checkCancel();3555 try current_thread.checkCancel();
3586 continue;3556 continue;
3587 },3557 },
3588 .CANCELED => return current_thread.endSyscallCanceled(),
3589 else => |e| {3558 else => |e| {
3590 current_thread.endSyscall();3559 current_thread.endSyscall();
3591 switch (e) {3560 switch (e) {
...@@ -3680,7 +3649,6 @@ fn dirReadIllumos(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) D...@@ -3680,7 +3649,6 @@ fn dirReadIllumos(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) D
3680 try current_thread.checkCancel();3649 try current_thread.checkCancel();
3681 continue;3650 continue;
3682 },3651 },
3683 .CANCELED => return current_thread.endSyscallCanceled(),
3684 else => |e| {3652 else => |e| {
3685 current_thread.endSyscall();3653 current_thread.endSyscall();
3686 switch (e) {3654 switch (e) {
...@@ -3957,7 +3925,6 @@ fn dirRealPathFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, o...@@ -3957,7 +3925,6 @@ fn dirRealPathFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, o
3957 try current_thread.checkCancel();3925 try current_thread.checkCancel();
3958 continue;3926 continue;
3959 },3927 },
3960 .CANCELED => return current_thread.endSyscallCanceled(),
3961 else => |e| {3928 else => |e| {
3962 current_thread.endSyscall();3929 current_thread.endSyscall();
3963 switch (e) {3930 switch (e) {
...@@ -4045,7 +4012,6 @@ fn realPathPosix(current_thread: *Thread, fd: posix.fd_t, out_buffer: []u8) File...@@ -4045,7 +4012,6 @@ fn realPathPosix(current_thread: *Thread, fd: posix.fd_t, out_buffer: []u8) File
4045 try current_thread.checkCancel();4012 try current_thread.checkCancel();
4046 continue;4013 continue;
4047 },4014 },
4048 .CANCELED => return current_thread.endSyscallCanceled(),
4049 else => |e| {4015 else => |e| {
4050 current_thread.endSyscall();4016 current_thread.endSyscall();
4051 switch (e) {4017 switch (e) {
...@@ -4082,7 +4048,6 @@ fn realPathPosix(current_thread: *Thread, fd: posix.fd_t, out_buffer: []u8) File...@@ -4082,7 +4048,6 @@ fn realPathPosix(current_thread: *Thread, fd: posix.fd_t, out_buffer: []u8) File
4082 try current_thread.checkCancel();4048 try current_thread.checkCancel();
4083 continue;4049 continue;
4084 },4050 },
4085 .CANCELED => return current_thread.endSyscallCanceled(),
4086 else => |e| {4051 else => |e| {
4087 current_thread.endSyscall();4052 current_thread.endSyscall();
4088 switch (e) {4053 switch (e) {
...@@ -4115,7 +4080,6 @@ fn realPathPosix(current_thread: *Thread, fd: posix.fd_t, out_buffer: []u8) File...@@ -4115,7 +4080,6 @@ fn realPathPosix(current_thread: *Thread, fd: posix.fd_t, out_buffer: []u8) File
4115 try current_thread.checkCancel();4080 try current_thread.checkCancel();
4116 continue;4081 continue;
4117 },4082 },
4118 .CANCELED => return current_thread.endSyscallCanceled(),
4119 else => |e| {4083 else => |e| {
4120 current_thread.endSyscall();4084 current_thread.endSyscall();
4121 switch (e) {4085 switch (e) {
...@@ -4163,7 +4127,6 @@ fn dirDeleteFileWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir....@@ -4163,7 +4127,6 @@ fn dirDeleteFileWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir.
4163 try current_thread.checkCancel();4127 try current_thread.checkCancel();
4164 continue;4128 continue;
4165 },4129 },
4166 .CANCELED => return current_thread.endSyscallCanceled(),
4167 else => |e| {4130 else => |e| {
4168 current_thread.endSyscall();4131 current_thread.endSyscall();
4169 switch (e) {4132 switch (e) {
...@@ -4208,7 +4171,6 @@ fn dirDeleteFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir...@@ -4208,7 +4171,6 @@ fn dirDeleteFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir
4208 try current_thread.checkCancel();4171 try current_thread.checkCancel();
4209 continue;4172 continue;
4210 },4173 },
4211 .CANCELED => return current_thread.endSyscallCanceled(),
4212 // Some systems return permission errors when trying to delete a4174 // Some systems return permission errors when trying to delete a
4213 // directory, so we need to handle that case specifically and4175 // directory, so we need to handle that case specifically and
4214 // translate the error.4176 // translate the error.
...@@ -4225,7 +4187,6 @@ fn dirDeleteFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir...@@ -4225,7 +4187,6 @@ fn dirDeleteFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir
4225 break;4187 break;
4226 },4188 },
4227 .INTR => continue,4189 .INTR => continue,
4228 .CANCELED => return current_thread.endSyscallCanceled(),
4229 else => {4190 else => {
4230 current_thread.endSyscall();4191 current_thread.endSyscall();
4231 return error.PermissionDenied;4192 return error.PermissionDenied;
...@@ -4443,7 +4404,6 @@ fn dirDeleteDirWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir.D...@@ -4443,7 +4404,6 @@ fn dirDeleteDirWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir.D
4443 try current_thread.checkCancel();4404 try current_thread.checkCancel();
4444 continue;4405 continue;
4445 },4406 },
4446 .CANCELED => return current_thread.endSyscallCanceled(),
4447 else => |e| {4407 else => |e| {
4448 current_thread.endSyscall();4408 current_thread.endSyscall();
4449 switch (e) {4409 switch (e) {
...@@ -4488,7 +4448,6 @@ fn dirDeleteDirPosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir....@@ -4488,7 +4448,6 @@ fn dirDeleteDirPosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir.
4488 try current_thread.checkCancel();4448 try current_thread.checkCancel();
4489 continue;4449 continue;
4490 },4450 },
4491 .CANCELED => return current_thread.endSyscallCanceled(),
4492 else => |e| {4451 else => |e| {
4493 current_thread.endSyscall();4452 current_thread.endSyscall();
4494 switch (e) {4453 switch (e) {
...@@ -4654,7 +4613,6 @@ fn dirRenameWasi(...@@ -4654,7 +4613,6 @@ fn dirRenameWasi(
4654 while (true) {4613 while (true) {
4655 switch (std.os.wasi.path_rename(old_dir.handle, old_sub_path.ptr, old_sub_path.len, new_dir.handle, new_sub_path.ptr, new_sub_path.len)) {4614 switch (std.os.wasi.path_rename(old_dir.handle, old_sub_path.ptr, old_sub_path.len, new_dir.handle, new_sub_path.ptr, new_sub_path.len)) {
4656 .SUCCESS => return current_thread.endSyscall(),4615 .SUCCESS => return current_thread.endSyscall(),
4657 .CANCELED => return current_thread.endSyscallCanceled(),
4658 .INTR => {4616 .INTR => {
4659 try current_thread.checkCancel();4617 try current_thread.checkCancel();
4660 continue;4618 continue;
...@@ -4709,7 +4667,6 @@ fn dirRenamePosix(...@@ -4709,7 +4667,6 @@ fn dirRenamePosix(
4709 while (true) {4667 while (true) {
4710 switch (posix.errno(posix.system.renameat(old_dir.handle, old_sub_path_posix, new_dir.handle, new_sub_path_posix))) {4668 switch (posix.errno(posix.system.renameat(old_dir.handle, old_sub_path_posix, new_dir.handle, new_sub_path_posix))) {
4711 .SUCCESS => return current_thread.endSyscall(),4669 .SUCCESS => return current_thread.endSyscall(),
4712 .CANCELED => return current_thread.endSyscallCanceled(),
4713 .INTR => {4670 .INTR => {
4714 try current_thread.checkCancel();4671 try current_thread.checkCancel();
4715 continue;4672 continue;
...@@ -4890,7 +4847,6 @@ fn dirSymLinkWasi(...@@ -4890,7 +4847,6 @@ fn dirSymLinkWasi(
4890 while (true) {4847 while (true) {
4891 switch (std.os.wasi.path_symlink(target_path.ptr, target_path.len, dir.handle, sym_link_path.ptr, sym_link_path.len)) {4848 switch (std.os.wasi.path_symlink(target_path.ptr, target_path.len, dir.handle, sym_link_path.ptr, sym_link_path.len)) {
4892 .SUCCESS => return current_thread.endSyscall(),4849 .SUCCESS => return current_thread.endSyscall(),
4893 .CANCELED => return current_thread.endSyscallCanceled(),
4894 .INTR => {4850 .INTR => {
4895 try current_thread.checkCancel();4851 try current_thread.checkCancel();
4896 continue;4852 continue;
...@@ -4943,7 +4899,6 @@ fn dirSymLinkPosix(...@@ -4943,7 +4899,6 @@ fn dirSymLinkPosix(
4943 while (true) {4899 while (true) {
4944 switch (posix.errno(posix.system.symlinkat(target_path_posix, dir.handle, sym_link_path_posix))) {4900 switch (posix.errno(posix.system.symlinkat(target_path_posix, dir.handle, sym_link_path_posix))) {
4945 .SUCCESS => return current_thread.endSyscall(),4901 .SUCCESS => return current_thread.endSyscall(),
4946 .CANCELED => return current_thread.endSyscallCanceled(),
4947 .INTR => {4902 .INTR => {
4948 try current_thread.checkCancel();4903 try current_thread.checkCancel();
4949 continue;4904 continue;
...@@ -5010,7 +4965,6 @@ fn dirReadLinkWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, buffer...@@ -5010,7 +4965,6 @@ fn dirReadLinkWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, buffer
5010 current_thread.endSyscall();4965 current_thread.endSyscall();
5011 return n;4966 return n;
5012 },4967 },
5013 .CANCELED => return current_thread.endSyscallCanceled(),
5014 .INTR => {4968 .INTR => {
5015 try current_thread.checkCancel();4969 try current_thread.checkCancel();
5016 continue;4970 continue;
...@@ -5052,7 +5006,6 @@ fn dirReadLinkPosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, buffe...@@ -5052,7 +5006,6 @@ fn dirReadLinkPosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, buffe
5052 const len: usize = @bitCast(rc);5006 const len: usize = @bitCast(rc);
5053 return len;5007 return len;
5054 },5008 },
5055 .CANCELED => return current_thread.endSyscallCanceled(),
5056 .INTR => {5009 .INTR => {
5057 try current_thread.checkCancel();5010 try current_thread.checkCancel();
5058 continue;5011 continue;
...@@ -5137,7 +5090,6 @@ fn posixFchmodat(...@@ -5137,7 +5090,6 @@ fn posixFchmodat(
5137 posix.system.fchmodat(dir_fd, path, mode);5090 posix.system.fchmodat(dir_fd, path, mode);
5138 switch (posix.errno(rc)) {5091 switch (posix.errno(rc)) {
5139 .SUCCESS => return current_thread.endSyscall(),5092 .SUCCESS => return current_thread.endSyscall(),
5140 .CANCELED => return current_thread.endSyscallCanceled(),
5141 .INTR => {5093 .INTR => {
5142 try current_thread.checkCancel();5094 try current_thread.checkCancel();
5143 continue;5095 continue;
...@@ -5176,7 +5128,6 @@ fn posixFchmodat(...@@ -5176,7 +5128,6 @@ fn posixFchmodat(
5176 while (true) {5128 while (true) {
5177 switch (std.os.linux.errno(std.os.linux.fchmodat2(dir_fd, path, mode, flags))) {5129 switch (std.os.linux.errno(std.os.linux.fchmodat2(dir_fd, path, mode, flags))) {
5178 .SUCCESS => return current_thread.endSyscall(),5130 .SUCCESS => return current_thread.endSyscall(),
5179 .CANCELED => return current_thread.endSyscallCanceled(),
5180 .INTR => {5131 .INTR => {
5181 try current_thread.checkCancel();5132 try current_thread.checkCancel();
5182 continue;5133 continue;
...@@ -5252,7 +5203,6 @@ fn posixFchown(current_thread: *Thread, fd: posix.fd_t, uid: posix.uid_t, gid: p...@@ -5252,7 +5203,6 @@ fn posixFchown(current_thread: *Thread, fd: posix.fd_t, uid: posix.uid_t, gid: p
5252 while (true) {5203 while (true) {
5253 switch (posix.errno(posix.system.fchown(fd, uid, gid))) {5204 switch (posix.errno(posix.system.fchown(fd, uid, gid))) {
5254 .SUCCESS => return current_thread.endSyscall(),5205 .SUCCESS => return current_thread.endSyscall(),
5255 .CANCELED => return current_thread.endSyscallCanceled(),
5256 .INTR => {5206 .INTR => {
5257 try current_thread.checkCancel();5207 try current_thread.checkCancel();
5258 continue;5208 continue;
...@@ -5333,7 +5283,6 @@ fn fileSyncPosix(userdata: ?*anyopaque, file: File) File.SyncError!void {...@@ -5333,7 +5283,6 @@ fn fileSyncPosix(userdata: ?*anyopaque, file: File) File.SyncError!void {
5333 while (true) {5283 while (true) {
5334 switch (posix.errno(posix.system.fsync(file.handle))) {5284 switch (posix.errno(posix.system.fsync(file.handle))) {
5335 .SUCCESS => return current_thread.endSyscall(),5285 .SUCCESS => return current_thread.endSyscall(),
5336 .CANCELED => return current_thread.endSyscallCanceled(),
5337 .INTR => {5286 .INTR => {
5338 try current_thread.checkCancel();5287 try current_thread.checkCancel();
5339 continue;5288 continue;
...@@ -5361,7 +5310,6 @@ fn fileSyncWasi(userdata: ?*anyopaque, file: File) File.SyncError!void {...@@ -5361,7 +5310,6 @@ fn fileSyncWasi(userdata: ?*anyopaque, file: File) File.SyncError!void {
5361 while (true) {5310 while (true) {
5362 switch (std.os.wasi.fd_sync(file.handle)) {5311 switch (std.os.wasi.fd_sync(file.handle)) {
5363 .SUCCESS => return current_thread.endSyscall(),5312 .SUCCESS => return current_thread.endSyscall(),
5364 .CANCELED => return current_thread.endSyscallCanceled(),
5365 .INTR => {5313 .INTR => {
5366 try current_thread.checkCancel();5314 try current_thread.checkCancel();
5367 continue;5315 continue;
...@@ -5405,7 +5353,6 @@ fn isTty(current_thread: *Thread, file: File) Io.Cancelable!bool {...@@ -5405,7 +5353,6 @@ fn isTty(current_thread: *Thread, file: File) Io.Cancelable!bool {
5405 current_thread.endSyscall();5353 current_thread.endSyscall();
5406 return true;5354 return true;
5407 },5355 },
5408 .CANCELED => return current_thread.endSyscallCanceled(),
5409 .INTR => {5356 .INTR => {
5410 try current_thread.checkCancel();5357 try current_thread.checkCancel();
5411 continue;5358 continue;
...@@ -5445,7 +5392,6 @@ fn isTty(current_thread: *Thread, file: File) Io.Cancelable!bool {...@@ -5445,7 +5392,6 @@ fn isTty(current_thread: *Thread, file: File) Io.Cancelable!bool {
5445 current_thread.endSyscall();5392 current_thread.endSyscall();
5446 return true;5393 return true;
5447 },5394 },
5448 .CANCELED => return current_thread.endSyscallCanceled(),
5449 .INTR => {5395 .INTR => {
5450 try current_thread.checkCancel();5396 try current_thread.checkCancel();
5451 continue;5397 continue;
...@@ -5627,7 +5573,6 @@ fn fileSetLength(userdata: ?*anyopaque, file: File, length: u64) File.SetLengthE...@@ -5627,7 +5573,6 @@ fn fileSetLength(userdata: ?*anyopaque, file: File, length: u64) File.SetLengthE
5627 while (true) {5573 while (true) {
5628 switch (std.os.wasi.fd_filestat_set_size(file.handle, length)) {5574 switch (std.os.wasi.fd_filestat_set_size(file.handle, length)) {
5629 .SUCCESS => return current_thread.endSyscall(),5575 .SUCCESS => return current_thread.endSyscall(),
5630 .CANCELED => return current_thread.endSyscallCanceled(),
5631 .INTR => {5576 .INTR => {
5632 try current_thread.checkCancel();5577 try current_thread.checkCancel();
5633 continue;5578 continue;
...@@ -5653,7 +5598,6 @@ fn fileSetLength(userdata: ?*anyopaque, file: File, length: u64) File.SetLengthE...@@ -5653,7 +5598,6 @@ fn fileSetLength(userdata: ?*anyopaque, file: File, length: u64) File.SetLengthE
5653 while (true) {5598 while (true) {
5654 switch (posix.errno(ftruncate_sym(file.handle, signed_len))) {5599 switch (posix.errno(ftruncate_sym(file.handle, signed_len))) {
5655 .SUCCESS => return current_thread.endSyscall(),5600 .SUCCESS => return current_thread.endSyscall(),
5656 .CANCELED => return current_thread.endSyscallCanceled(),
5657 .INTR => {5601 .INTR => {
5658 try current_thread.checkCancel();5602 try current_thread.checkCancel();
5659 continue;5603 continue;
...@@ -5723,7 +5667,6 @@ fn setPermissionsPosix(current_thread: *Thread, fd: posix.fd_t, mode: posix.mode...@@ -5723,7 +5667,6 @@ fn setPermissionsPosix(current_thread: *Thread, fd: posix.fd_t, mode: posix.mode
5723 while (true) {5667 while (true) {
5724 switch (posix.errno(posix.system.fchmod(fd, mode))) {5668 switch (posix.errno(posix.system.fchmod(fd, mode))) {
5725 .SUCCESS => return current_thread.endSyscall(),5669 .SUCCESS => return current_thread.endSyscall(),
5726 .CANCELED => return current_thread.endSyscallCanceled(),
5727 .INTR => {5670 .INTR => {
5728 try current_thread.checkCancel();5671 try current_thread.checkCancel();
5729 continue;5672 continue;
...@@ -5782,7 +5725,6 @@ fn dirSetTimestamps(...@@ -5782,7 +5725,6 @@ fn dirSetTimestamps(
5782 while (true) {5725 while (true) {
5783 switch (posix.errno(posix.system.utimensat(dir.handle, sub_path_posix, &times, flags))) {5726 switch (posix.errno(posix.system.utimensat(dir.handle, sub_path_posix, &times, flags))) {
5784 .SUCCESS => return current_thread.endSyscall(),5727 .SUCCESS => return current_thread.endSyscall(),
5785 .CANCELED => return current_thread.endSyscallCanceled(),
5786 .INTR => {5728 .INTR => {
5787 try current_thread.checkCancel();5729 try current_thread.checkCancel();
5788 continue;5730 continue;
...@@ -5829,7 +5771,6 @@ fn dirSetTimestampsNow(...@@ -5829,7 +5771,6 @@ fn dirSetTimestampsNow(
5829 while (true) {5771 while (true) {
5830 switch (posix.errno(posix.system.utimensat(dir.handle, sub_path_posix, null, flags))) {5772 switch (posix.errno(posix.system.utimensat(dir.handle, sub_path_posix, null, flags))) {
5831 .SUCCESS => return current_thread.endSyscall(),5773 .SUCCESS => return current_thread.endSyscall(),
5832 .CANCELED => return current_thread.endSyscallCanceled(),
5833 .INTR => {5774 .INTR => {
5834 try current_thread.checkCancel();5775 try current_thread.checkCancel();
5835 continue;5776 continue;
...@@ -5890,7 +5831,6 @@ fn fileSetTimestamps(...@@ -5890,7 +5831,6 @@ fn fileSetTimestamps(
5890 .MTIM = true,5831 .MTIM = true,
5891 })) {5832 })) {
5892 .SUCCESS => return current_thread.endSyscall(),5833 .SUCCESS => return current_thread.endSyscall(),
5893 .CANCELED => return current_thread.endSyscallCanceled(),
5894 .INTR => {5834 .INTR => {
5895 try current_thread.checkCancel();5835 try current_thread.checkCancel();
5896 continue;5836 continue;
...@@ -5915,7 +5855,6 @@ fn fileSetTimestamps(...@@ -5915,7 +5855,6 @@ fn fileSetTimestamps(
5915 while (true) {5855 while (true) {
5916 switch (posix.errno(posix.system.futimens(file.handle, &times))) {5856 switch (posix.errno(posix.system.futimens(file.handle, &times))) {
5917 .SUCCESS => return current_thread.endSyscall(),5857 .SUCCESS => return current_thread.endSyscall(),
5918 .CANCELED => return current_thread.endSyscallCanceled(),
5919 .INTR => {5858 .INTR => {
5920 try current_thread.checkCancel();5859 try current_thread.checkCancel();
5921 continue;5860 continue;
...@@ -5952,7 +5891,6 @@ fn fileSetTimestampsNow(userdata: ?*anyopaque, file: File) File.SetTimestampsErr...@@ -5952,7 +5891,6 @@ fn fileSetTimestampsNow(userdata: ?*anyopaque, file: File) File.SetTimestampsErr
5952 .MTIM_NOW = true,5891 .MTIM_NOW = true,
5953 })) {5892 })) {
5954 .SUCCESS => return current_thread.endSyscall(),5893 .SUCCESS => return current_thread.endSyscall(),
5955 .CANCELED => return current_thread.endSyscallCanceled(),
5956 .INTR => {5894 .INTR => {
5957 try current_thread.checkCancel();5895 try current_thread.checkCancel();
5958 continue;5896 continue;
...@@ -5977,7 +5915,6 @@ fn fileSetTimestampsNow(userdata: ?*anyopaque, file: File) File.SetTimestampsErr...@@ -5977,7 +5915,6 @@ fn fileSetTimestampsNow(userdata: ?*anyopaque, file: File) File.SetTimestampsErr
5977 while (true) {5915 while (true) {
5978 switch (posix.errno(posix.system.futimens(file.handle, null))) {5916 switch (posix.errno(posix.system.futimens(file.handle, null))) {
5979 .SUCCESS => return current_thread.endSyscall(),5917 .SUCCESS => return current_thread.endSyscall(),
5980 .CANCELED => return current_thread.endSyscallCanceled(),
5981 .INTR => {5918 .INTR => {
5982 try current_thread.checkCancel();5919 try current_thread.checkCancel();
5983 continue;5920 continue;
...@@ -6061,7 +5998,6 @@ fn fileLock(userdata: ?*anyopaque, file: File, lock: File.Lock) File.LockError!v...@@ -6061,7 +5998,6 @@ fn fileLock(userdata: ?*anyopaque, file: File, lock: File.Lock) File.LockError!v
6061 while (true) {5998 while (true) {
6062 switch (posix.errno(posix.system.flock(file.handle, operation))) {5999 switch (posix.errno(posix.system.flock(file.handle, operation))) {
6063 .SUCCESS => return current_thread.endSyscall(),6000 .SUCCESS => return current_thread.endSyscall(),
6064 .CANCELED => return current_thread.endSyscallCanceled(),
6065 .INTR => {6001 .INTR => {
6066 try current_thread.checkCancel();6002 try current_thread.checkCancel();
6067 continue;6003 continue;
...@@ -6143,7 +6079,6 @@ fn fileTryLock(userdata: ?*anyopaque, file: File, lock: File.Lock) File.LockErro...@@ -6143,7 +6079,6 @@ fn fileTryLock(userdata: ?*anyopaque, file: File, lock: File.Lock) File.LockErro
6143 current_thread.endSyscall();6079 current_thread.endSyscall();
6144 return true;6080 return true;
6145 },6081 },
6146 .CANCELED => return current_thread.endSyscallCanceled(),
6147 .INTR => {6082 .INTR => {
6148 try current_thread.checkCancel();6083 try current_thread.checkCancel();
6149 continue;6084 continue;
...@@ -6259,7 +6194,6 @@ fn fileDowngradeLock(userdata: ?*anyopaque, file: File) File.DowngradeLockError!...@@ -6259,7 +6194,6 @@ fn fileDowngradeLock(userdata: ?*anyopaque, file: File) File.DowngradeLockError!
6259 current_thread.endSyscall();6194 current_thread.endSyscall();
6260 return;6195 return;
6261 },6196 },
6262 .CANCELED => return current_thread.endSyscallCanceled(),
6263 .INTR => {6197 .INTR => {
6264 try current_thread.checkCancel();6198 try current_thread.checkCancel();
6265 continue;6199 continue;
...@@ -6328,7 +6262,6 @@ fn dirOpenDirWasi(...@@ -6328,7 +6262,6 @@ fn dirOpenDirWasi(
6328 try current_thread.checkCancel();6262 try current_thread.checkCancel();
6329 continue;6263 continue;
6330 },6264 },
6331 .CANCELED => return current_thread.endSyscallCanceled(),
6332 else => |e| {6265 else => |e| {
6333 current_thread.endSyscall();6266 current_thread.endSyscall();
6334 switch (e) {6267 switch (e) {
...@@ -6387,7 +6320,6 @@ fn dirHardLink(...@@ -6387,7 +6320,6 @@ fn dirHardLink(
6387 try current_thread.checkCancel();6320 try current_thread.checkCancel();
6388 continue;6321 continue;
6389 },6322 },
6390 .CANCELED => return current_thread.endSyscallCanceled(),
6391 else => |e| {6323 else => |e| {
6392 current_thread.endSyscall();6324 current_thread.endSyscall();
6393 switch (e) {6325 switch (e) {
...@@ -6437,7 +6369,6 @@ fn dirHardLink(...@@ -6437,7 +6369,6 @@ fn dirHardLink(
6437 try current_thread.checkCancel();6369 try current_thread.checkCancel();
6438 continue;6370 continue;
6439 },6371 },
6440 .CANCELED => return current_thread.endSyscallCanceled(),
6441 else => |e| {6372 else => |e| {
6442 current_thread.endSyscall();6373 current_thread.endSyscall();
6443 switch (e) {6374 switch (e) {
...@@ -6506,7 +6437,6 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: File, data: []const []u8)...@@ -6506,7 +6437,6 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: File, data: []const []u8)
6506 try current_thread.checkCancel();6437 try current_thread.checkCancel();
6507 continue;6438 continue;
6508 },6439 },
6509 .CANCELED => return current_thread.endSyscallCanceled(),
6510 else => |e| {6440 else => |e| {
6511 current_thread.endSyscall();6441 current_thread.endSyscall();
6512 switch (e) {6442 switch (e) {
...@@ -6540,7 +6470,6 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: File, data: []const []u8)...@@ -6540,7 +6470,6 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: File, data: []const []u8)
6540 try current_thread.checkCancel();6470 try current_thread.checkCancel();
6541 continue;6471 continue;
6542 },6472 },
6543 .CANCELED => return current_thread.endSyscallCanceled(),
6544 else => |e| {6473 else => |e| {
6545 current_thread.endSyscall();6474 current_thread.endSyscall();
6546 switch (e) {6475 switch (e) {
...@@ -6627,7 +6556,6 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: File, data: []const []u8...@@ -6627,7 +6556,6 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: File, data: []const []u8
6627 try current_thread.checkCancel();6556 try current_thread.checkCancel();
6628 continue;6557 continue;
6629 },6558 },
6630 .CANCELED => return current_thread.endSyscallCanceled(),
6631 else => |e| {6559 else => |e| {
6632 current_thread.endSyscall();6560 current_thread.endSyscall();
6633 switch (e) {6561 switch (e) {
...@@ -6665,7 +6593,6 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: File, data: []const []u8...@@ -6665,7 +6593,6 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: File, data: []const []u8
6665 try current_thread.checkCancel();6593 try current_thread.checkCancel();
6666 continue;6594 continue;
6667 },6595 },
6668 .CANCELED => return current_thread.endSyscallCanceled(),
6669 else => |e| {6596 else => |e| {
6670 current_thread.endSyscall();6597 current_thread.endSyscall();
6671 switch (e) {6598 switch (e) {
...@@ -6759,7 +6686,6 @@ fn fileSeekBy(userdata: ?*anyopaque, file: File, offset: i64) File.SeekError!voi...@@ -6759,7 +6686,6 @@ fn fileSeekBy(userdata: ?*anyopaque, file: File, offset: i64) File.SeekError!voi
6759 try current_thread.checkCancel();6686 try current_thread.checkCancel();
6760 continue;6687 continue;
6761 },6688 },
6762 .CANCELED => return current_thread.endSyscallCanceled(),
6763 else => |e| {6689 else => |e| {
6764 current_thread.endSyscall();6690 current_thread.endSyscall();
6765 switch (e) {6691 switch (e) {
...@@ -6793,7 +6719,6 @@ fn fileSeekBy(userdata: ?*anyopaque, file: File, offset: i64) File.SeekError!voi...@@ -6793,7 +6719,6 @@ fn fileSeekBy(userdata: ?*anyopaque, file: File, offset: i64) File.SeekError!voi
6793 try current_thread.checkCancel();6719 try current_thread.checkCancel();
6794 continue;6720 continue;
6795 },6721 },
6796 .CANCELED => return current_thread.endSyscallCanceled(),
6797 else => |e| {6722 else => |e| {
6798 current_thread.endSyscall();6723 current_thread.endSyscall();
6799 switch (e) {6724 switch (e) {
...@@ -6823,7 +6748,6 @@ fn fileSeekBy(userdata: ?*anyopaque, file: File, offset: i64) File.SeekError!voi...@@ -6823,7 +6748,6 @@ fn fileSeekBy(userdata: ?*anyopaque, file: File, offset: i64) File.SeekError!voi
6823 try current_thread.checkCancel();6748 try current_thread.checkCancel();
6824 continue;6749 continue;
6825 },6750 },
6826 .CANCELED => return current_thread.endSyscallCanceled(),
6827 else => |e| {6751 else => |e| {
6828 current_thread.endSyscall();6752 current_thread.endSyscall();
6829 switch (e) {6753 switch (e) {
...@@ -6862,7 +6786,6 @@ fn fileSeekTo(userdata: ?*anyopaque, file: File, offset: u64) File.SeekError!voi...@@ -6862,7 +6786,6 @@ fn fileSeekTo(userdata: ?*anyopaque, file: File, offset: u64) File.SeekError!voi
6862 try current_thread.checkCancel();6786 try current_thread.checkCancel();
6863 continue;6787 continue;
6864 },6788 },
6865 .CANCELED => return current_thread.endSyscallCanceled(),
6866 else => |e| {6789 else => |e| {
6867 current_thread.endSyscall();6790 current_thread.endSyscall();
6868 switch (e) {6791 switch (e) {
...@@ -6898,7 +6821,6 @@ fn posixSeekTo(current_thread: *Thread, fd: posix.fd_t, offset: u64) File.SeekEr...@@ -6898,7 +6821,6 @@ fn posixSeekTo(current_thread: *Thread, fd: posix.fd_t, offset: u64) File.SeekEr
6898 try current_thread.checkCancel();6821 try current_thread.checkCancel();
6899 continue;6822 continue;
6900 },6823 },
6901 .CANCELED => return current_thread.endSyscallCanceled(),
6902 else => |e| {6824 else => |e| {
6903 current_thread.endSyscall();6825 current_thread.endSyscall();
6904 switch (e) {6826 switch (e) {
...@@ -6925,7 +6847,6 @@ fn posixSeekTo(current_thread: *Thread, fd: posix.fd_t, offset: u64) File.SeekEr...@@ -6925,7 +6847,6 @@ fn posixSeekTo(current_thread: *Thread, fd: posix.fd_t, offset: u64) File.SeekEr
6925 try current_thread.checkCancel();6847 try current_thread.checkCancel();
6926 continue;6848 continue;
6927 },6849 },
6928 .CANCELED => return current_thread.endSyscallCanceled(),
6929 else => |e| {6850 else => |e| {
6930 current_thread.endSyscall();6851 current_thread.endSyscall();
6931 switch (e) {6852 switch (e) {
...@@ -7011,7 +6932,6 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) std.process.Ex...@@ -7011,7 +6932,6 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) std.process.Ex
7011 try current_thread.checkCancel();6932 try current_thread.checkCancel();
7012 continue;6933 continue;
7013 },6934 },
7014 .CANCELED => return current_thread.endSyscallCanceled(),
7015 else => |e| {6935 else => |e| {
7016 current_thread.endSyscall();6936 current_thread.endSyscall();
7017 switch (e) {6937 switch (e) {
...@@ -7040,7 +6960,6 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) std.process.Ex...@@ -7040,7 +6960,6 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) std.process.Ex
7040 try current_thread.checkCancel();6960 try current_thread.checkCancel();
7041 continue;6961 continue;
7042 },6962 },
7043 .CANCELED => return current_thread.endSyscallCanceled(),
7044 else => |e| {6963 else => |e| {
7045 current_thread.endSyscall();6964 current_thread.endSyscall();
7046 switch (e) {6965 switch (e) {
...@@ -7194,7 +7113,6 @@ fn fileWritePositional(...@@ -7194,7 +7113,6 @@ fn fileWritePositional(
7194 try current_thread.checkCancel();7113 try current_thread.checkCancel();
7195 continue;7114 continue;
7196 },7115 },
7197 .CANCELED => return current_thread.endSyscallCanceled(),
7198 else => |e| {7116 else => |e| {
7199 current_thread.endSyscall();7117 current_thread.endSyscall();
7200 switch (e) {7118 switch (e) {
...@@ -7232,7 +7150,6 @@ fn fileWritePositional(...@@ -7232,7 +7150,6 @@ fn fileWritePositional(
7232 try current_thread.checkCancel();7150 try current_thread.checkCancel();
7233 continue;7151 continue;
7234 },7152 },
7235 .CANCELED => return current_thread.endSyscallCanceled(),
7236 else => |e| {7153 else => |e| {
7237 current_thread.endSyscall();7154 current_thread.endSyscall();
7238 switch (e) {7155 switch (e) {
...@@ -7316,7 +7233,6 @@ fn fileWriteStreaming(...@@ -7316,7 +7233,6 @@ fn fileWriteStreaming(
7316 try current_thread.checkCancel();7233 try current_thread.checkCancel();
7317 continue;7234 continue;
7318 },7235 },
7319 .CANCELED => return current_thread.endSyscallCanceled(),
7320 else => |e| {7236 else => |e| {
7321 current_thread.endSyscall();7237 current_thread.endSyscall();
7322 switch (e) {7238 switch (e) {
...@@ -7351,7 +7267,6 @@ fn fileWriteStreaming(...@@ -7351,7 +7267,6 @@ fn fileWriteStreaming(
7351 try current_thread.checkCancel();7267 try current_thread.checkCancel();
7352 continue;7268 continue;
7353 },7269 },
7354 .CANCELED => return current_thread.endSyscallCanceled(),
7355 else => |e| {7270 else => |e| {
7356 current_thread.endSyscall();7271 current_thread.endSyscall();
7357 switch (e) {7272 switch (e) {
...@@ -7619,7 +7534,6 @@ fn fileWriteFileStreaming(...@@ -7619,7 +7534,6 @@ fn fileWriteFileStreaming(
7619 try current_thread.checkCancel();7534 try current_thread.checkCancel();
7620 continue;7535 continue;
7621 },7536 },
7622 .CANCELED => return current_thread.endSyscallCanceled(),
7623 else => |e| {7537 else => |e| {
7624 current_thread.endSyscall();7538 current_thread.endSyscall();
7625 assert(error.Unexpected == switch (e) {7539 assert(error.Unexpected == switch (e) {
...@@ -7692,7 +7606,6 @@ fn fileWriteFileStreaming(...@@ -7692,7 +7606,6 @@ fn fileWriteFileStreaming(
7692 try current_thread.checkCancel();7606 try current_thread.checkCancel();
7693 continue;7607 continue;
7694 },7608 },
7695 .CANCELED => return current_thread.endSyscallCanceled(),
7696 .OPNOTSUPP, .INVAL, .NOSYS => {7609 .OPNOTSUPP, .INVAL, .NOSYS => {
7697 // Give calling code chance to observe before trying7610 // Give calling code chance to observe before trying
7698 // something else.7611 // something else.
...@@ -7869,7 +7782,6 @@ fn fileWriteFilePositional(...@@ -7869,7 +7782,6 @@ fn fileWriteFilePositional(
7869 try current_thread.checkCancel();7782 try current_thread.checkCancel();
7870 continue;7783 continue;
7871 },7784 },
7872 .CANCELED => return current_thread.endSyscallCanceled(),
7873 .OPNOTSUPP, .INVAL, .NOSYS => {7785 .OPNOTSUPP, .INVAL, .NOSYS => {
7874 // Give calling code chance to observe before trying7786 // Give calling code chance to observe before trying
7875 // something else.7787 // something else.
...@@ -8098,7 +8010,6 @@ fn sleepLinux(userdata: ?*anyopaque, timeout: Io.Timeout) Io.SleepError!void {...@@ -8098,7 +8010,6 @@ fn sleepLinux(userdata: ?*anyopaque, timeout: Io.Timeout) Io.SleepError!void {
8098 try current_thread.checkCancel();8010 try current_thread.checkCancel();
8099 continue;8011 continue;
8100 },8012 },
8101 .CANCELED => return current_thread.endSyscallCanceled(),
8102 else => |e| {8013 else => |e| {
8103 current_thread.endSyscall();8014 current_thread.endSyscall();
8104 switch (e) {8015 switch (e) {
...@@ -8176,7 +8087,6 @@ fn sleepPosix(userdata: ?*anyopaque, timeout: Io.Timeout) Io.SleepError!void {...@@ -8176,7 +8087,6 @@ fn sleepPosix(userdata: ?*anyopaque, timeout: Io.Timeout) Io.SleepError!void {
8176 try current_thread.checkCancel();8087 try current_thread.checkCancel();
8177 continue;8088 continue;
8178 },8089 },
8179 .CANCELED => return current_thread.endSyscallCanceled(),
8180 // This prong handles success as well as unexpected errors.8090 // This prong handles success as well as unexpected errors.
8181 else => return current_thread.endSyscall(),8091 else => return current_thread.endSyscall(),
8182 }8092 }
...@@ -8250,7 +8160,6 @@ fn netListenIpPosix(...@@ -8250,7 +8160,6 @@ fn netListenIpPosix(
8250 try current_thread.checkCancel();8160 try current_thread.checkCancel();
8251 continue;8161 continue;
8252 },8162 },
8253 .CANCELED => return current_thread.endSyscallCanceled(),
8254 else => |e| {8163 else => |e| {
8255 current_thread.endSyscall();8164 current_thread.endSyscall();
8256 switch (e) {8165 switch (e) {
...@@ -8414,7 +8323,6 @@ fn netListenUnixPosix(...@@ -8414,7 +8323,6 @@ fn netListenUnixPosix(
8414 try current_thread.checkCancel();8323 try current_thread.checkCancel();
8415 continue;8324 continue;
8416 },8325 },
8417 .CANCELED => return current_thread.endSyscallCanceled(),
8418 else => |e| {8326 else => |e| {
8419 current_thread.endSyscall();8327 current_thread.endSyscall();
8420 switch (e) {8328 switch (e) {
...@@ -8538,7 +8446,6 @@ fn posixBindUnix(...@@ -8538,7 +8446,6 @@ fn posixBindUnix(
8538 try current_thread.checkCancel();8446 try current_thread.checkCancel();
8539 continue;8447 continue;
8540 },8448 },
8541 .CANCELED => return current_thread.endSyscallCanceled(),
8542 else => |e| {8449 else => |e| {
8543 current_thread.endSyscall();8450 current_thread.endSyscall();
8544 switch (e) {8451 switch (e) {
...@@ -8583,7 +8490,6 @@ fn posixBind(...@@ -8583,7 +8490,6 @@ fn posixBind(
8583 try current_thread.checkCancel();8490 try current_thread.checkCancel();
8584 continue;8491 continue;
8585 },8492 },
8586 .CANCELED => return current_thread.endSyscallCanceled(),
8587 else => |e| {8493 else => |e| {
8588 current_thread.endSyscall();8494 current_thread.endSyscall();
8589 switch (e) {8495 switch (e) {
...@@ -8619,7 +8525,6 @@ fn posixConnect(...@@ -8619,7 +8525,6 @@ fn posixConnect(
8619 try current_thread.checkCancel();8525 try current_thread.checkCancel();
8620 continue;8526 continue;
8621 },8527 },
8622 .CANCELED => return current_thread.endSyscallCanceled(),
8623 else => |e| {8528 else => |e| {
8624 current_thread.endSyscall();8529 current_thread.endSyscall();
8625 switch (e) {8530 switch (e) {
...@@ -8666,7 +8571,6 @@ fn posixConnectUnix(...@@ -8666,7 +8571,6 @@ fn posixConnectUnix(
8666 try current_thread.checkCancel();8571 try current_thread.checkCancel();
8667 continue;8572 continue;
8668 },8573 },
8669 .CANCELED => return current_thread.endSyscallCanceled(),
8670 else => |e| {8574 else => |e| {
8671 current_thread.endSyscall();8575 current_thread.endSyscall();
8672 switch (e) {8576 switch (e) {
...@@ -8711,7 +8615,6 @@ fn posixGetSockName(...@@ -8711,7 +8615,6 @@ fn posixGetSockName(
8711 try current_thread.checkCancel();8615 try current_thread.checkCancel();
8712 continue;8616 continue;
8713 },8617 },
8714 .CANCELED => return current_thread.endSyscallCanceled(),
8715 else => |e| {8618 else => |e| {
8716 current_thread.endSyscall();8619 current_thread.endSyscall();
8717 switch (e) {8620 switch (e) {
...@@ -8779,7 +8682,6 @@ fn setSocketOption(current_thread: *Thread, fd: posix.fd_t, level: i32, opt_name...@@ -8779,7 +8682,6 @@ fn setSocketOption(current_thread: *Thread, fd: posix.fd_t, level: i32, opt_name
8779 try current_thread.checkCancel();8682 try current_thread.checkCancel();
8780 continue;8683 continue;
8781 },8684 },
8782 .CANCELED => return current_thread.endSyscallCanceled(),
8783 else => |e| {8685 else => |e| {
8784 current_thread.endSyscall();8686 current_thread.endSyscall();
8785 switch (e) {8687 switch (e) {
...@@ -9109,7 +9011,6 @@ fn openSocketPosix(...@@ -9109,7 +9011,6 @@ fn openSocketPosix(
9109 switch (posix.errno(posix.system.fcntl(fd, posix.F.SETFD, @as(usize, posix.FD_CLOEXEC)))) {9011 switch (posix.errno(posix.system.fcntl(fd, posix.F.SETFD, @as(usize, posix.FD_CLOEXEC)))) {
9110 .SUCCESS => break,9012 .SUCCESS => break,
9111 .INTR => continue,9013 .INTR => continue,
9112 .CANCELED => return current_thread.endSyscallCanceled(),
9113 else => |err| {9014 else => |err| {
9114 current_thread.endSyscall();9015 current_thread.endSyscall();
9115 return posix.unexpectedErrno(err);9016 return posix.unexpectedErrno(err);
...@@ -9123,7 +9024,6 @@ fn openSocketPosix(...@@ -9123,7 +9024,6 @@ fn openSocketPosix(
9123 try current_thread.checkCancel();9024 try current_thread.checkCancel();
9124 continue;9025 continue;
9125 },9026 },
9126 .CANCELED => return current_thread.endSyscallCanceled(),
9127 else => |e| {9027 else => |e| {
9128 current_thread.endSyscall();9028 current_thread.endSyscall();
9129 switch (e) {9029 switch (e) {
...@@ -9225,7 +9125,6 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve...@@ -9225,7 +9125,6 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve
9225 try current_thread.checkCancel();9125 try current_thread.checkCancel();
9226 continue;9126 continue;
9227 },9127 },
9228 .CANCELED => return current_thread.endSyscallCanceled(),
9229 else => |e| {9128 else => |e| {
9230 current_thread.endSyscall();9129 current_thread.endSyscall();
9231 switch (e) {9130 switch (e) {
...@@ -9334,7 +9233,6 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net....@@ -9334,7 +9233,6 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net.
9334 try current_thread.checkCancel();9233 try current_thread.checkCancel();
9335 continue;9234 continue;
9336 },9235 },
9337 .CANCELED => return current_thread.endSyscallCanceled(),
9338 else => |e| {9236 else => |e| {
9339 current_thread.endSyscall();9237 current_thread.endSyscall();
9340 switch (e) {9238 switch (e) {
...@@ -9367,7 +9265,6 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net....@@ -9367,7 +9265,6 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net.
9367 try current_thread.checkCancel();9265 try current_thread.checkCancel();
9368 continue;9266 continue;
9369 },9267 },
9370 .CANCELED => return current_thread.endSyscallCanceled(),
9371 else => |e| {9268 else => |e| {
9372 current_thread.endSyscall();9269 current_thread.endSyscall();
9373 switch (e) {9270 switch (e) {
...@@ -9603,7 +9500,6 @@ fn netSendOne(...@@ -9603,7 +9500,6 @@ fn netSendOne(
9603 try current_thread.checkCancel();9500 try current_thread.checkCancel();
9604 continue;9501 continue;
9605 },9502 },
9606 .CANCELED => return current_thread.endSyscallCanceled(),
9607 else => |e| {9503 else => |e| {
9608 current_thread.endSyscall();9504 current_thread.endSyscall();
9609 switch (e) {9505 switch (e) {
...@@ -9680,7 +9576,6 @@ fn netSendMany(...@@ -9680,7 +9576,6 @@ fn netSendMany(
9680 try current_thread.checkCancel();9576 try current_thread.checkCancel();
9681 continue;9577 continue;
9682 },9578 },
9683 .CANCELED => return current_thread.endSyscallCanceled(),
9684 else => |e| {9579 else => |e| {
9685 current_thread.endSyscall();9580 current_thread.endSyscall();
9686 switch (e) {9581 switch (e) {
...@@ -9813,7 +9708,6 @@ fn netReceivePosix(...@@ -9813,7 +9708,6 @@ fn netReceivePosix(
9813 continue :recv;9708 continue :recv;
9814 },9709 },
9815 .INTR => continue,9710 .INTR => continue,
9816 .CANCELED => return .{ current_thread.endSyscallCanceled(), message_i },
98179711
9818 .FAULT => |err| return .{ errnoBug(err), message_i },9712 .FAULT => |err| return .{ errnoBug(err), message_i },
9819 .INVAL => |err| return .{ errnoBug(err), message_i },9713 .INVAL => |err| return .{ errnoBug(err), message_i },
...@@ -9822,7 +9716,6 @@ fn netReceivePosix(...@@ -9822,7 +9716,6 @@ fn netReceivePosix(
9822 }9716 }
9823 },9717 },
9824 .INTR => continue,9718 .INTR => continue,
9825 .CANCELED => return .{ current_thread.endSyscallCanceled(), message_i },
98269719
9827 .BADF => |err| return .{ errnoBug(err), message_i },9720 .BADF => |err| return .{ errnoBug(err), message_i },
9828 .NFILE => return .{ error.SystemFdQuotaExceeded, message_i },9721 .NFILE => return .{ error.SystemFdQuotaExceeded, message_i },
...@@ -9942,7 +9835,6 @@ fn netWritePosix(...@@ -9942,7 +9835,6 @@ fn netWritePosix(
9942 try current_thread.checkCancel();9835 try current_thread.checkCancel();
9943 continue;9836 continue;
9944 },9837 },
9945 .CANCELED => return current_thread.endSyscallCanceled(),
9946 else => |e| {9838 else => |e| {
9947 current_thread.endSyscall();9839 current_thread.endSyscall();
9948 switch (e) {9840 switch (e) {
...@@ -10040,8 +9932,7 @@ fn netWriteWindows(...@@ -10040,8 +9932,7 @@ fn netWriteWindows(
10040 else => |err| err,9932 else => |err| err,
10041 };9933 };
10042 switch (wsa_error) {9934 switch (wsa_error) {
10043 .EINTR => continue,9935 .EINTR, .ECANCELLED, .E_CANCELLED, .OPERATION_ABORTED => continue,
10044 .ECANCELLED, .E_CANCELLED, .OPERATION_ABORTED => return current_thread.endSyscallCanceled(),
10045 .NOTINITIALISED => {9936 .NOTINITIALISED => {
10046 try initializeWsa(t);9937 try initializeWsa(t);
10047 continue;9938 continue;
...@@ -10160,7 +10051,6 @@ fn netInterfaceNameResolve(...@@ -10160,7 +10051,6 @@ fn netInterfaceNameResolve(
10160 try current_thread.checkCancel();10051 try current_thread.checkCancel();
10161 continue;10052 continue;
10162 },10053 },
10163 .CANCELED => return current_thread.endSyscallCanceled(),
10164 else => |e| {10054 else => |e| {
10165 current_thread.endSyscall();10055 current_thread.endSyscall();
10166 switch (e) {10056 switch (e) {
...@@ -10464,7 +10354,6 @@ fn netLookupFallible(...@@ -10464,7 +10354,6 @@ fn netLookupFallible(
10464 try current_thread.checkCancel();10354 try current_thread.checkCancel();
10465 continue;10355 continue;
10466 },10356 },
10467 .CANCELED => return current_thread.endSyscallCanceled(),
10468 else => |e| {10357 else => |e| {
10469 current_thread.endSyscall();10358 current_thread.endSyscall();
10470 return posix.unexpectedErrno(e);10359 return posix.unexpectedErrno(e);