| ... | ... | @@ -145,6 +145,13 @@ const Thread = struct { |
| 145 | 145 | ) orelse return; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | fn endSyscallCanceled(thread: *Thread) Io.Cancelable { |
| 149 | if (thread.current_closure) |closure| { |
| 150 | @atomicStore(CancelStatus, &closure.cancel_status, .acknowledged, .release); |
| 151 | } |
| 152 | return error.Canceled; |
| 153 | } |
| 154 | |
| 148 | 155 | fn currentSignalId() SignaleeId { |
| 149 | 156 | return if (std.Thread.use_pthreads) std.c.pthread_self() else std.Thread.getCurrentId(); |
| 150 | 157 | } |
| ... | ... | @@ -1211,10 +1218,11 @@ fn dirMakePosix(userdata: ?*anyopaque, dir: Io.Dir, sub_path: []const u8, mode: |
| 1211 | 1218 | current_thread.endSyscall(); |
| 1212 | 1219 | return; |
| 1213 | 1220 | }, |
| 1214 | | .INTR, .CANCELED => { |
| 1221 | .INTR => { |
| 1215 | 1222 | try current_thread.checkCancel(); |
| 1216 | 1223 | continue; |
| 1217 | 1224 | }, |
| 1225 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1218 | 1226 | else => |e| { |
| 1219 | 1227 | current_thread.endSyscall(); |
| 1220 | 1228 | switch (e) { |
| ... | ... | @@ -1253,10 +1261,11 @@ fn dirMakeWasi(userdata: ?*anyopaque, dir: Io.Dir, sub_path: []const u8, mode: I |
| 1253 | 1261 | current_thread.endSyscall(); |
| 1254 | 1262 | return; |
| 1255 | 1263 | }, |
| 1256 | | .INTR, .CANCELED => { |
| 1264 | .INTR => { |
| 1257 | 1265 | try current_thread.checkCancel(); |
| 1258 | 1266 | continue; |
| 1259 | 1267 | }, |
| 1268 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1260 | 1269 | else => |e| { |
| 1261 | 1270 | current_thread.endSyscall(); |
| 1262 | 1271 | switch (e) { |
| ... | ... | @@ -1518,10 +1527,11 @@ fn dirStatPathLinux( |
| 1518 | 1527 | current_thread.endSyscall(); |
| 1519 | 1528 | return statFromLinux(&statx); |
| 1520 | 1529 | }, |
| 1521 | | .INTR, .CANCELED => { |
| 1530 | .INTR => { |
| 1522 | 1531 | try current_thread.checkCancel(); |
| 1523 | 1532 | continue; |
| 1524 | 1533 | }, |
| 1534 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1525 | 1535 | else => |e| { |
| 1526 | 1536 | current_thread.endSyscall(); |
| 1527 | 1537 | switch (e) { |
| ... | ... | @@ -1563,10 +1573,11 @@ fn dirStatPathPosix( |
| 1563 | 1573 | current_thread.endSyscall(); |
| 1564 | 1574 | return statFromPosix(&stat); |
| 1565 | 1575 | }, |
| 1566 | | .INTR, .CANCELED => { |
| 1576 | .INTR => { |
| 1567 | 1577 | try current_thread.checkCancel(); |
| 1568 | 1578 | continue; |
| 1569 | 1579 | }, |
| 1580 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1570 | 1581 | else => |e| { |
| 1571 | 1582 | current_thread.endSyscall(); |
| 1572 | 1583 | switch (e) { |
| ... | ... | @@ -1623,10 +1634,11 @@ fn dirStatPathWasi( |
| 1623 | 1634 | current_thread.endSyscall(); |
| 1624 | 1635 | return statFromWasi(&stat); |
| 1625 | 1636 | }, |
| 1626 | | .INTR, .CANCELED => { |
| 1637 | .INTR => { |
| 1627 | 1638 | try current_thread.checkCancel(); |
| 1628 | 1639 | continue; |
| 1629 | 1640 | }, |
| 1641 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1630 | 1642 | else => |e| { |
| 1631 | 1643 | current_thread.endSyscall(); |
| 1632 | 1644 | switch (e) { |
| ... | ... | @@ -1668,10 +1680,11 @@ fn fileStatPosix(userdata: ?*anyopaque, file: Io.File) Io.File.StatError!Io.File |
| 1668 | 1680 | current_thread.endSyscall(); |
| 1669 | 1681 | return statFromPosix(&stat); |
| 1670 | 1682 | }, |
| 1671 | | .INTR, .CANCELED => { |
| 1683 | .INTR => { |
| 1672 | 1684 | try current_thread.checkCancel(); |
| 1673 | 1685 | continue; |
| 1674 | 1686 | }, |
| 1687 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1675 | 1688 | else => |e| { |
| 1676 | 1689 | current_thread.endSyscall(); |
| 1677 | 1690 | switch (e) { |
| ... | ... | @@ -1706,10 +1719,11 @@ fn fileStatLinux(userdata: ?*anyopaque, file: Io.File) Io.File.StatError!Io.File |
| 1706 | 1719 | current_thread.endSyscall(); |
| 1707 | 1720 | return statFromLinux(&statx); |
| 1708 | 1721 | }, |
| 1709 | | .INTR, .CANCELED => { |
| 1722 | .INTR => { |
| 1710 | 1723 | try current_thread.checkCancel(); |
| 1711 | 1724 | continue; |
| 1712 | 1725 | }, |
| 1726 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1713 | 1727 | else => |e| { |
| 1714 | 1728 | current_thread.endSyscall(); |
| 1715 | 1729 | switch (e) { |
| ... | ... | @@ -1791,10 +1805,11 @@ fn fileStatWasi(userdata: ?*anyopaque, file: Io.File) Io.File.StatError!Io.File. |
| 1791 | 1805 | current_thread.endSyscall(); |
| 1792 | 1806 | return statFromWasi(&stat); |
| 1793 | 1807 | }, |
| 1794 | | .INTR, .CANCELED => { |
| 1808 | .INTR => { |
| 1795 | 1809 | try current_thread.checkCancel(); |
| 1796 | 1810 | continue; |
| 1797 | 1811 | }, |
| 1812 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1798 | 1813 | else => |e| { |
| 1799 | 1814 | current_thread.endSyscall(); |
| 1800 | 1815 | switch (e) { |
| ... | ... | @@ -1842,10 +1857,11 @@ fn dirAccessPosix( |
| 1842 | 1857 | current_thread.endSyscall(); |
| 1843 | 1858 | return; |
| 1844 | 1859 | }, |
| 1845 | | .INTR, .CANCELED => { |
| 1860 | .INTR => { |
| 1846 | 1861 | try current_thread.checkCancel(); |
| 1847 | 1862 | continue; |
| 1848 | 1863 | }, |
| 1864 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1849 | 1865 | else => |e| { |
| 1850 | 1866 | current_thread.endSyscall(); |
| 1851 | 1867 | switch (e) { |
| ... | ... | @@ -1891,10 +1907,11 @@ fn dirAccessWasi( |
| 1891 | 1907 | current_thread.endSyscall(); |
| 1892 | 1908 | break; |
| 1893 | 1909 | }, |
| 1894 | | .INTR, .CANCELED => { |
| 1910 | .INTR => { |
| 1895 | 1911 | try current_thread.checkCancel(); |
| 1896 | 1912 | continue; |
| 1897 | 1913 | }, |
| 1914 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 1898 | 1915 | else => |e| { |
| 1899 | 1916 | current_thread.endSyscall(); |
| 1900 | 1917 | switch (e) { |
| ... | ... | @@ -2037,10 +2054,11 @@ fn dirCreateFilePosix( |
| 2037 | 2054 | current_thread.endSyscall(); |
| 2038 | 2055 | break @intCast(rc); |
| 2039 | 2056 | }, |
| 2040 | | .INTR, .CANCELED => { |
| 2057 | .INTR => { |
| 2041 | 2058 | try current_thread.checkCancel(); |
| 2042 | 2059 | continue; |
| 2043 | 2060 | }, |
| 2061 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2044 | 2062 | else => |e| { |
| 2045 | 2063 | current_thread.endSyscall(); |
| 2046 | 2064 | switch (e) { |
| ... | ... | @@ -2091,10 +2109,11 @@ fn dirCreateFilePosix( |
| 2091 | 2109 | current_thread.endSyscall(); |
| 2092 | 2110 | break; |
| 2093 | 2111 | }, |
| 2094 | | .INTR, .CANCELED => { |
| 2112 | .INTR => { |
| 2095 | 2113 | try current_thread.checkCancel(); |
| 2096 | 2114 | continue; |
| 2097 | 2115 | }, |
| 2116 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2098 | 2117 | else => |e| { |
| 2099 | 2118 | current_thread.endSyscall(); |
| 2100 | 2119 | switch (e) { |
| ... | ... | @@ -2119,7 +2138,7 @@ fn dirCreateFilePosix( |
| 2119 | 2138 | current_thread.endSyscall(); |
| 2120 | 2139 | break @intCast(rc); |
| 2121 | 2140 | }, |
| 2122 | | .INTR, .CANCELED => { |
| 2141 | .INTR => { |
| 2123 | 2142 | try current_thread.checkCancel(); |
| 2124 | 2143 | continue; |
| 2125 | 2144 | }, |
| ... | ... | @@ -2139,7 +2158,7 @@ fn dirCreateFilePosix( |
| 2139 | 2158 | current_thread.endSyscall(); |
| 2140 | 2159 | break; |
| 2141 | 2160 | }, |
| 2142 | | .INTR, .CANCELED => { |
| 2161 | .INTR => { |
| 2143 | 2162 | try current_thread.checkCancel(); |
| 2144 | 2163 | continue; |
| 2145 | 2164 | }, |
| ... | ... | @@ -2245,10 +2264,11 @@ fn dirCreateFileWasi( |
| 2245 | 2264 | current_thread.endSyscall(); |
| 2246 | 2265 | return .{ .handle = fd }; |
| 2247 | 2266 | }, |
| 2248 | | .INTR, .CANCELED => { |
| 2267 | .INTR => { |
| 2249 | 2268 | try current_thread.checkCancel(); |
| 2250 | 2269 | continue; |
| 2251 | 2270 | }, |
| 2271 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2252 | 2272 | else => |e| { |
| 2253 | 2273 | current_thread.endSyscall(); |
| 2254 | 2274 | switch (e) { |
| ... | ... | @@ -2338,10 +2358,11 @@ fn dirOpenFilePosix( |
| 2338 | 2358 | current_thread.endSyscall(); |
| 2339 | 2359 | break @intCast(rc); |
| 2340 | 2360 | }, |
| 2341 | | .INTR, .CANCELED => { |
| 2361 | .INTR => { |
| 2342 | 2362 | try current_thread.checkCancel(); |
| 2343 | 2363 | continue; |
| 2344 | 2364 | }, |
| 2365 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2345 | 2366 | else => |e| { |
| 2346 | 2367 | current_thread.endSyscall(); |
| 2347 | 2368 | switch (e) { |
| ... | ... | @@ -2391,10 +2412,11 @@ fn dirOpenFilePosix( |
| 2391 | 2412 | current_thread.endSyscall(); |
| 2392 | 2413 | break; |
| 2393 | 2414 | }, |
| 2394 | | .INTR, .CANCELED => { |
| 2415 | .INTR => { |
| 2395 | 2416 | try current_thread.checkCancel(); |
| 2396 | 2417 | continue; |
| 2397 | 2418 | }, |
| 2419 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2398 | 2420 | else => |e| { |
| 2399 | 2421 | current_thread.endSyscall(); |
| 2400 | 2422 | switch (e) { |
| ... | ... | @@ -2419,10 +2441,11 @@ fn dirOpenFilePosix( |
| 2419 | 2441 | current_thread.endSyscall(); |
| 2420 | 2442 | break @intCast(rc); |
| 2421 | 2443 | }, |
| 2422 | | .INTR, .CANCELED => { |
| 2444 | .INTR => { |
| 2423 | 2445 | try current_thread.checkCancel(); |
| 2424 | 2446 | continue; |
| 2425 | 2447 | }, |
| 2448 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2426 | 2449 | else => |err| { |
| 2427 | 2450 | current_thread.endSyscall(); |
| 2428 | 2451 | return posix.unexpectedErrno(err); |
| ... | ... | @@ -2439,10 +2462,11 @@ fn dirOpenFilePosix( |
| 2439 | 2462 | current_thread.endSyscall(); |
| 2440 | 2463 | break; |
| 2441 | 2464 | }, |
| 2442 | | .INTR, .CANCELED => { |
| 2465 | .INTR => { |
| 2443 | 2466 | try current_thread.checkCancel(); |
| 2444 | 2467 | continue; |
| 2445 | 2468 | }, |
| 2469 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2446 | 2470 | else => |err| { |
| 2447 | 2471 | current_thread.endSyscall(); |
| 2448 | 2472 | return posix.unexpectedErrno(err); |
| ... | ... | @@ -2637,10 +2661,11 @@ fn dirOpenFileWasi( |
| 2637 | 2661 | current_thread.endSyscall(); |
| 2638 | 2662 | return .{ .handle = fd }; |
| 2639 | 2663 | }, |
| 2640 | | .INTR, .CANCELED => { |
| 2664 | .INTR => { |
| 2641 | 2665 | try current_thread.checkCancel(); |
| 2642 | 2666 | continue; |
| 2643 | 2667 | }, |
| 2668 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2644 | 2669 | else => |e| { |
| 2645 | 2670 | current_thread.endSyscall(); |
| 2646 | 2671 | switch (e) { |
| ... | ... | @@ -2720,10 +2745,11 @@ fn dirOpenDirPosix( |
| 2720 | 2745 | current_thread.endSyscall(); |
| 2721 | 2746 | return .{ .handle = @intCast(rc) }; |
| 2722 | 2747 | }, |
| 2723 | | .INTR, .CANCELED => { |
| 2748 | .INTR => { |
| 2724 | 2749 | try current_thread.checkCancel(); |
| 2725 | 2750 | continue; |
| 2726 | 2751 | }, |
| 2752 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2727 | 2753 | else => |e| { |
| 2728 | 2754 | current_thread.endSyscall(); |
| 2729 | 2755 | switch (e) { |
| ... | ... | @@ -2772,10 +2798,11 @@ fn dirOpenDirHaiku( |
| 2772 | 2798 | return .{ .handle = rc }; |
| 2773 | 2799 | } |
| 2774 | 2800 | switch (@as(posix.E, @enumFromInt(rc))) { |
| 2775 | | .INTR, .CANCELED => { |
| 2801 | .INTR => { |
| 2776 | 2802 | try current_thread.checkCancel(); |
| 2777 | 2803 | continue; |
| 2778 | 2804 | }, |
| 2805 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2779 | 2806 | else => |e| { |
| 2780 | 2807 | current_thread.endSyscall(); |
| 2781 | 2808 | switch (e) { |
| ... | ... | @@ -2916,10 +2943,11 @@ fn dirOpenDirWasi( |
| 2916 | 2943 | current_thread.endSyscall(); |
| 2917 | 2944 | return .{ .handle = fd }; |
| 2918 | 2945 | }, |
| 2919 | | .INTR, .CANCELED => { |
| 2946 | .INTR => { |
| 2920 | 2947 | try current_thread.checkCancel(); |
| 2921 | 2948 | continue; |
| 2922 | 2949 | }, |
| 2950 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2923 | 2951 | else => |e| { |
| 2924 | 2952 | current_thread.endSyscall(); |
| 2925 | 2953 | switch (e) { |
| ... | ... | @@ -2982,10 +3010,11 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8) Io |
| 2982 | 3010 | current_thread.endSyscall(); |
| 2983 | 3011 | return nread; |
| 2984 | 3012 | }, |
| 2985 | | .INTR, .CANCELED => { |
| 3013 | .INTR => { |
| 2986 | 3014 | try current_thread.checkCancel(); |
| 2987 | 3015 | continue; |
| 2988 | 3016 | }, |
| 3017 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 2989 | 3018 | else => |e| { |
| 2990 | 3019 | current_thread.endSyscall(); |
| 2991 | 3020 | switch (e) { |
| ... | ... | @@ -3015,10 +3044,11 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8) Io |
| 3015 | 3044 | current_thread.endSyscall(); |
| 3016 | 3045 | return @intCast(rc); |
| 3017 | 3046 | }, |
| 3018 | | .INTR, .CANCELED => { |
| 3047 | .INTR => { |
| 3019 | 3048 | try current_thread.checkCancel(); |
| 3020 | 3049 | continue; |
| 3021 | 3050 | }, |
| 3051 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3022 | 3052 | else => |e| { |
| 3023 | 3053 | current_thread.endSyscall(); |
| 3024 | 3054 | switch (e) { |
| ... | ... | @@ -3100,10 +3130,11 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8, o |
| 3100 | 3130 | current_thread.endSyscall(); |
| 3101 | 3131 | return nread; |
| 3102 | 3132 | }, |
| 3103 | | .INTR, .CANCELED => { |
| 3133 | .INTR => { |
| 3104 | 3134 | try current_thread.checkCancel(); |
| 3105 | 3135 | continue; |
| 3106 | 3136 | }, |
| 3137 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3107 | 3138 | else => |e| { |
| 3108 | 3139 | current_thread.endSyscall(); |
| 3109 | 3140 | switch (e) { |
| ... | ... | @@ -3137,10 +3168,11 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8, o |
| 3137 | 3168 | current_thread.endSyscall(); |
| 3138 | 3169 | return @bitCast(rc); |
| 3139 | 3170 | }, |
| 3140 | | .INTR, .CANCELED => { |
| 3171 | .INTR => { |
| 3141 | 3172 | try current_thread.checkCancel(); |
| 3142 | 3173 | continue; |
| 3143 | 3174 | }, |
| 3175 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3144 | 3176 | else => |e| { |
| 3145 | 3177 | current_thread.endSyscall(); |
| 3146 | 3178 | switch (e) { |
| ... | ... | @@ -3238,10 +3270,11 @@ fn fileSeekTo(userdata: ?*anyopaque, file: Io.File, offset: u64) Io.File.SeekErr |
| 3238 | 3270 | current_thread.endSyscall(); |
| 3239 | 3271 | return; |
| 3240 | 3272 | }, |
| 3241 | | .INTR, .CANCELED => { |
| 3273 | .INTR => { |
| 3242 | 3274 | try current_thread.checkCancel(); |
| 3243 | 3275 | continue; |
| 3244 | 3276 | }, |
| 3277 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3245 | 3278 | else => |e| { |
| 3246 | 3279 | current_thread.endSyscall(); |
| 3247 | 3280 | switch (e) { |
| ... | ... | @@ -3270,10 +3303,11 @@ fn fileSeekTo(userdata: ?*anyopaque, file: Io.File, offset: u64) Io.File.SeekErr |
| 3270 | 3303 | current_thread.endSyscall(); |
| 3271 | 3304 | return; |
| 3272 | 3305 | }, |
| 3273 | | .INTR, .CANCELED => { |
| 3306 | .INTR => { |
| 3274 | 3307 | try current_thread.checkCancel(); |
| 3275 | 3308 | continue; |
| 3276 | 3309 | }, |
| 3310 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3277 | 3311 | else => |e| { |
| 3278 | 3312 | current_thread.endSyscall(); |
| 3279 | 3313 | switch (e) { |
| ... | ... | @@ -3298,10 +3332,11 @@ fn fileSeekTo(userdata: ?*anyopaque, file: Io.File, offset: u64) Io.File.SeekErr |
| 3298 | 3332 | current_thread.endSyscall(); |
| 3299 | 3333 | return; |
| 3300 | 3334 | }, |
| 3301 | | .INTR, .CANCELED => { |
| 3335 | .INTR => { |
| 3302 | 3336 | try current_thread.checkCancel(); |
| 3303 | 3337 | continue; |
| 3304 | 3338 | }, |
| 3339 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3305 | 3340 | else => |e| { |
| 3306 | 3341 | current_thread.endSyscall(); |
| 3307 | 3342 | switch (e) { |
| ... | ... | @@ -3453,10 +3488,11 @@ fn sleepLinux(userdata: ?*anyopaque, timeout: Io.Timeout) Io.SleepError!void { |
| 3453 | 3488 | current_thread.endSyscall(); |
| 3454 | 3489 | return; |
| 3455 | 3490 | }, |
| 3456 | | .INTR, .CANCELED => { |
| 3491 | .INTR => { |
| 3457 | 3492 | try current_thread.checkCancel(); |
| 3458 | 3493 | continue; |
| 3459 | 3494 | }, |
| 3495 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3460 | 3496 | else => |e| { |
| 3461 | 3497 | current_thread.endSyscall(); |
| 3462 | 3498 | switch (e) { |
| ... | ... | @@ -3530,10 +3566,11 @@ fn sleepPosix(userdata: ?*anyopaque, timeout: Io.Timeout) Io.SleepError!void { |
| 3530 | 3566 | try current_thread.beginSyscall(); |
| 3531 | 3567 | while (true) { |
| 3532 | 3568 | switch (posix.errno(posix.system.nanosleep(&timespec, &timespec))) { |
| 3533 | | .INTR, .CANCELED => { |
| 3569 | .INTR => { |
| 3534 | 3570 | try current_thread.checkCancel(); |
| 3535 | 3571 | continue; |
| 3536 | 3572 | }, |
| 3573 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3537 | 3574 | // This prong handles success as well as unexpected errors. |
| 3538 | 3575 | else => return current_thread.endSyscall(), |
| 3539 | 3576 | } |
| ... | ... | @@ -3603,10 +3640,11 @@ fn netListenIpPosix( |
| 3603 | 3640 | current_thread.endSyscall(); |
| 3604 | 3641 | break; |
| 3605 | 3642 | }, |
| 3606 | | .INTR, .CANCELED => { |
| 3643 | .INTR => { |
| 3607 | 3644 | try current_thread.checkCancel(); |
| 3608 | 3645 | continue; |
| 3609 | 3646 | }, |
| 3647 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3610 | 3648 | else => |e| { |
| 3611 | 3649 | current_thread.endSyscall(); |
| 3612 | 3650 | switch (e) { |
| ... | ... | @@ -3766,10 +3804,11 @@ fn netListenUnixPosix( |
| 3766 | 3804 | current_thread.endSyscall(); |
| 3767 | 3805 | break; |
| 3768 | 3806 | }, |
| 3769 | | .INTR, .CANCELED => { |
| 3807 | .INTR => { |
| 3770 | 3808 | try current_thread.checkCancel(); |
| 3771 | 3809 | continue; |
| 3772 | 3810 | }, |
| 3811 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3773 | 3812 | else => |e| { |
| 3774 | 3813 | current_thread.endSyscall(); |
| 3775 | 3814 | switch (e) { |
| ... | ... | @@ -3889,10 +3928,11 @@ fn posixBindUnix( |
| 3889 | 3928 | current_thread.endSyscall(); |
| 3890 | 3929 | break; |
| 3891 | 3930 | }, |
| 3892 | | .INTR, .CANCELED => { |
| 3931 | .INTR => { |
| 3893 | 3932 | try current_thread.checkCancel(); |
| 3894 | 3933 | continue; |
| 3895 | 3934 | }, |
| 3935 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3896 | 3936 | else => |e| { |
| 3897 | 3937 | current_thread.endSyscall(); |
| 3898 | 3938 | switch (e) { |
| ... | ... | @@ -3933,10 +3973,11 @@ fn posixBind( |
| 3933 | 3973 | current_thread.endSyscall(); |
| 3934 | 3974 | break; |
| 3935 | 3975 | }, |
| 3936 | | .INTR, .CANCELED => { |
| 3976 | .INTR => { |
| 3937 | 3977 | try current_thread.checkCancel(); |
| 3938 | 3978 | continue; |
| 3939 | 3979 | }, |
| 3980 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3940 | 3981 | else => |e| { |
| 3941 | 3982 | current_thread.endSyscall(); |
| 3942 | 3983 | switch (e) { |
| ... | ... | @@ -3968,10 +4009,11 @@ fn posixConnect( |
| 3968 | 4009 | current_thread.endSyscall(); |
| 3969 | 4010 | return; |
| 3970 | 4011 | }, |
| 3971 | | .INTR, .CANCELED => { |
| 4012 | .INTR => { |
| 3972 | 4013 | try current_thread.checkCancel(); |
| 3973 | 4014 | continue; |
| 3974 | 4015 | }, |
| 4016 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 3975 | 4017 | else => |e| { |
| 3976 | 4018 | current_thread.endSyscall(); |
| 3977 | 4019 | switch (e) { |
| ... | ... | @@ -4014,10 +4056,11 @@ fn posixConnectUnix( |
| 4014 | 4056 | current_thread.endSyscall(); |
| 4015 | 4057 | return; |
| 4016 | 4058 | }, |
| 4017 | | .INTR, .CANCELED => { |
| 4059 | .INTR => { |
| 4018 | 4060 | try current_thread.checkCancel(); |
| 4019 | 4061 | continue; |
| 4020 | 4062 | }, |
| 4063 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4021 | 4064 | else => |e| { |
| 4022 | 4065 | current_thread.endSyscall(); |
| 4023 | 4066 | switch (e) { |
| ... | ... | @@ -4058,10 +4101,11 @@ fn posixGetSockName( |
| 4058 | 4101 | current_thread.endSyscall(); |
| 4059 | 4102 | break; |
| 4060 | 4103 | }, |
| 4061 | | .INTR, .CANCELED => { |
| 4104 | .INTR => { |
| 4062 | 4105 | try current_thread.checkCancel(); |
| 4063 | 4106 | continue; |
| 4064 | 4107 | }, |
| 4108 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4065 | 4109 | else => |e| { |
| 4066 | 4110 | current_thread.endSyscall(); |
| 4067 | 4111 | switch (e) { |
| ... | ... | @@ -4125,10 +4169,11 @@ fn setSocketOption(current_thread: *Thread, fd: posix.fd_t, level: i32, opt_name |
| 4125 | 4169 | current_thread.endSyscall(); |
| 4126 | 4170 | return; |
| 4127 | 4171 | }, |
| 4128 | | .INTR, .CANCELED => { |
| 4172 | .INTR => { |
| 4129 | 4173 | try current_thread.checkCancel(); |
| 4130 | 4174 | continue; |
| 4131 | 4175 | }, |
| 4176 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4132 | 4177 | else => |e| { |
| 4133 | 4178 | current_thread.endSyscall(); |
| 4134 | 4179 | switch (e) { |
| ... | ... | @@ -4457,7 +4502,8 @@ fn openSocketPosix( |
| 4457 | 4502 | try current_thread.checkCancel(); |
| 4458 | 4503 | switch (posix.errno(posix.system.fcntl(fd, posix.F.SETFD, @as(usize, posix.FD_CLOEXEC)))) { |
| 4459 | 4504 | .SUCCESS => break, |
| 4460 | | .INTR, .CANCELED => continue, |
| 4505 | .INTR => continue, |
| 4506 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4461 | 4507 | else => |err| { |
| 4462 | 4508 | current_thread.endSyscall(); |
| 4463 | 4509 | return posix.unexpectedErrno(err); |
| ... | ... | @@ -4467,10 +4513,11 @@ fn openSocketPosix( |
| 4467 | 4513 | current_thread.endSyscall(); |
| 4468 | 4514 | break fd; |
| 4469 | 4515 | }, |
| 4470 | | .INTR, .CANCELED => { |
| 4516 | .INTR => { |
| 4471 | 4517 | try current_thread.checkCancel(); |
| 4472 | 4518 | continue; |
| 4473 | 4519 | }, |
| 4520 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4474 | 4521 | else => |e| { |
| 4475 | 4522 | current_thread.endSyscall(); |
| 4476 | 4523 | switch (e) { |
| ... | ... | @@ -4558,7 +4605,7 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve |
| 4558 | 4605 | try current_thread.checkCancel(); |
| 4559 | 4606 | switch (posix.errno(posix.system.fcntl(fd, posix.F.SETFD, @as(usize, posix.FD_CLOEXEC)))) { |
| 4560 | 4607 | .SUCCESS => break, |
| 4561 | | .INTR, .CANCELED => continue, |
| 4608 | .INTR => continue, |
| 4562 | 4609 | else => |err| { |
| 4563 | 4610 | current_thread.endSyscall(); |
| 4564 | 4611 | return posix.unexpectedErrno(err); |
| ... | ... | @@ -4568,10 +4615,11 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve |
| 4568 | 4615 | current_thread.endSyscall(); |
| 4569 | 4616 | break fd; |
| 4570 | 4617 | }, |
| 4571 | | .INTR, .CANCELED => { |
| 4618 | .INTR => { |
| 4572 | 4619 | try current_thread.checkCancel(); |
| 4573 | 4620 | continue; |
| 4574 | 4621 | }, |
| 4622 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4575 | 4623 | else => |e| { |
| 4576 | 4624 | current_thread.endSyscall(); |
| 4577 | 4625 | switch (e) { |
| ... | ... | @@ -4676,10 +4724,11 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net. |
| 4676 | 4724 | current_thread.endSyscall(); |
| 4677 | 4725 | return n; |
| 4678 | 4726 | }, |
| 4679 | | .INTR, .CANCELED => { |
| 4727 | .INTR => { |
| 4680 | 4728 | try current_thread.checkCancel(); |
| 4681 | 4729 | continue; |
| 4682 | 4730 | }, |
| 4731 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4683 | 4732 | else => |e| { |
| 4684 | 4733 | current_thread.endSyscall(); |
| 4685 | 4734 | switch (e) { |
| ... | ... | @@ -4708,10 +4757,11 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net. |
| 4708 | 4757 | current_thread.endSyscall(); |
| 4709 | 4758 | return @intCast(rc); |
| 4710 | 4759 | }, |
| 4711 | | .INTR, .CANCELED => { |
| 4760 | .INTR => { |
| 4712 | 4761 | try current_thread.checkCancel(); |
| 4713 | 4762 | continue; |
| 4714 | 4763 | }, |
| 4764 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4715 | 4765 | else => |e| { |
| 4716 | 4766 | current_thread.endSyscall(); |
| 4717 | 4767 | switch (e) { |
| ... | ... | @@ -4943,10 +4993,11 @@ fn netSendOne( |
| 4943 | 4993 | message.data_len = @intCast(rc); |
| 4944 | 4994 | return; |
| 4945 | 4995 | }, |
| 4946 | | .INTR, .CANCELED => { |
| 4996 | .INTR => { |
| 4947 | 4997 | try current_thread.checkCancel(); |
| 4948 | 4998 | continue; |
| 4949 | 4999 | }, |
| 5000 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 4950 | 5001 | else => |e| { |
| 4951 | 5002 | current_thread.endSyscall(); |
| 4952 | 5003 | switch (e) { |
| ... | ... | @@ -5019,10 +5070,11 @@ fn netSendMany( |
| 5019 | 5070 | } |
| 5020 | 5071 | return n; |
| 5021 | 5072 | }, |
| 5022 | | .INTR, .CANCELED => { |
| 5073 | .INTR => { |
| 5023 | 5074 | try current_thread.checkCancel(); |
| 5024 | 5075 | continue; |
| 5025 | 5076 | }, |
| 5077 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 5026 | 5078 | else => |e| { |
| 5027 | 5079 | current_thread.endSyscall(); |
| 5028 | 5080 | switch (e) { |
| ... | ... | @@ -5154,7 +5206,8 @@ fn netReceivePosix( |
| 5154 | 5206 | } |
| 5155 | 5207 | continue :recv; |
| 5156 | 5208 | }, |
| 5157 | | .INTR, .CANCELED => continue, |
| 5209 | .INTR => continue, |
| 5210 | .CANCELED => return .{ current_thread.endSyscallCanceled(), message_i }, |
| 5158 | 5211 | |
| 5159 | 5212 | .FAULT => |err| return .{ errnoBug(err), message_i }, |
| 5160 | 5213 | .INVAL => |err| return .{ errnoBug(err), message_i }, |
| ... | ... | @@ -5162,7 +5215,8 @@ fn netReceivePosix( |
| 5162 | 5215 | else => |err| return .{ posix.unexpectedErrno(err), message_i }, |
| 5163 | 5216 | } |
| 5164 | 5217 | }, |
| 5165 | | .INTR, .CANCELED => continue, |
| 5218 | .INTR => continue, |
| 5219 | .CANCELED => return .{ current_thread.endSyscallCanceled(), message_i }, |
| 5166 | 5220 | |
| 5167 | 5221 | .BADF => |err| return .{ errnoBug(err), message_i }, |
| 5168 | 5222 | .NFILE => return .{ error.SystemFdQuotaExceeded, message_i }, |
| ... | ... | @@ -5277,10 +5331,11 @@ fn netWritePosix( |
| 5277 | 5331 | current_thread.endSyscall(); |
| 5278 | 5332 | return @intCast(rc); |
| 5279 | 5333 | }, |
| 5280 | | .INTR, .CANCELED => { |
| 5334 | .INTR => { |
| 5281 | 5335 | try current_thread.checkCancel(); |
| 5282 | 5336 | continue; |
| 5283 | 5337 | }, |
| 5338 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 5284 | 5339 | else => |e| { |
| 5285 | 5340 | current_thread.endSyscall(); |
| 5286 | 5341 | switch (e) { |
| ... | ... | @@ -5378,7 +5433,8 @@ fn netWriteWindows( |
| 5378 | 5433 | else => |err| err, |
| 5379 | 5434 | }; |
| 5380 | 5435 | switch (wsa_error) { |
| 5381 | | .EINTR, .ECANCELLED, .E_CANCELLED, .OPERATION_ABORTED => continue, |
| 5436 | .EINTR => continue, |
| 5437 | .ECANCELLED, .E_CANCELLED, .OPERATION_ABORTED => return current_thread.endSyscallCanceled(), |
| 5382 | 5438 | .NOTINITIALISED => { |
| 5383 | 5439 | try initializeWsa(t); |
| 5384 | 5440 | continue; |
| ... | ... | @@ -5486,10 +5542,11 @@ fn netInterfaceNameResolve( |
| 5486 | 5542 | current_thread.endSyscall(); |
| 5487 | 5543 | return .{ .index = @bitCast(ifr.ifru.ivalue) }; |
| 5488 | 5544 | }, |
| 5489 | | .INTR, .CANCELED => { |
| 5545 | .INTR => { |
| 5490 | 5546 | try current_thread.checkCancel(); |
| 5491 | 5547 | continue; |
| 5492 | 5548 | }, |
| 5549 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 5493 | 5550 | else => |e| { |
| 5494 | 5551 | current_thread.endSyscall(); |
| 5495 | 5552 | switch (e) { |
| ... | ... | @@ -5786,10 +5843,11 @@ fn netLookupFallible( |
| 5786 | 5843 | break; |
| 5787 | 5844 | }, |
| 5788 | 5845 | .SYSTEM => switch (posix.errno(-1)) { |
| 5789 | | .INTR, .CANCELED => { |
| 5846 | .INTR => { |
| 5790 | 5847 | try current_thread.checkCancel(); |
| 5791 | 5848 | continue; |
| 5792 | 5849 | }, |
| 5850 | .CANCELED => return current_thread.endSyscallCanceled(), |
| 5793 | 5851 | else => |e| { |
| 5794 | 5852 | current_thread.endSyscall(); |
| 5795 | 5853 | return posix.unexpectedErrno(e); |