| author | |
| committer | |
| log | 750b1431bf34b238bd991b2ee3b50e81ff20b667 |
| tree | e99550f5c65f7b014baf7d9b56332c774daca3da |
| parent | eadfefa002b642d1b9173fa7d9a281a70a61e233 |
6 files changed, 16 insertions(+), 9 deletions(-)
lib/std/Io/Dir.zig+1-1| ... | ... | @@ -263,6 +263,6 @@ pub const StatPathError = File.OpenError || File.StatError; |
| 263 | 263 | /// * On Windows, `sub_path` should be encoded as [WTF-8](https://simonsapin.github.io/wtf-8/). |
| 264 | 264 | /// * On WASI, `sub_path` should be encoded as valid UTF-8. |
| 265 | 265 | /// * On other platforms, `sub_path` is an opaque sequence of bytes with no particular encoding. |
| 266 | pub fn statPath(dir: Dir, io: Io, sub_path: []const u8) StatPathError!File.Stat { | |
| 266 | pub fn statPath(dir: Dir, io: Io, sub_path: []const u8) StatPathError!Stat { | |
| 267 | 267 | return io.vtable.dirStatPath(io.userdata, dir, sub_path); |
| 268 | 268 | } |
lib/std/fs/test.zig+1-1| ... | ... | @@ -1928,7 +1928,7 @@ test "'.' and '..' in fs.Dir functions" { |
| 1928 | 1928 | try ctx.dir.writeFile(.{ .sub_path = update_path, .data = "something" }); |
| 1929 | 1929 | var dir = ctx.dir.adaptToNewApi(); |
| 1930 | 1930 | const prev_status = try dir.updateFile(io, file_path, dir, update_path, .{}); |
| 1931 | try testing.expectEqual(fs.Dir.PrevStatus.stale, prev_status); | |
| 1931 | try testing.expectEqual(Io.Dir.PrevStatus.stale, prev_status); | |
| 1932 | 1932 | |
| 1933 | 1933 | try ctx.dir.deleteDir(subdir_path); |
| 1934 | 1934 | } |
lib/std/http/Client.zig+9-4| ... | ... | @@ -300,7 +300,7 @@ pub const Connection = struct { |
| 300 | 300 | remote_host: HostName, |
| 301 | 301 | port: u16, |
| 302 | 302 | stream: Io.net.Stream, |
| 303 | ) error{ OutOfMemory, TlsInitializationFailed }!*Tls { | |
| 303 | ) !*Tls { | |
| 304 | 304 | const io = client.io; |
| 305 | 305 | const gpa = client.allocator; |
| 306 | 306 | const alloc_len = allocLen(client, remote_host.bytes.len); |
| ... | ... | @@ -320,7 +320,7 @@ pub const Connection = struct { |
| 320 | 320 | const tls: *Tls = @ptrCast(base); |
| 321 | 321 | var random_buffer: [176]u8 = undefined; |
| 322 | 322 | std.crypto.random.bytes(&random_buffer); |
| 323 | const now_ts = if (Io.Clock.real.now(io)) |ts| ts.toSeconds() else |_| return error.TlsInitializationFailed; | |
| 323 | const now_ts = if (Io.Clock.real.now(io)) |ts| ts.toSeconds() else |err| return err; | |
| 324 | 324 | tls.* = .{ |
| 325 | 325 | .connection = .{ |
| 326 | 326 | .client = client, |
| ... | ... | @@ -349,7 +349,11 @@ pub const Connection = struct { |
| 349 | 349 | // the content length which is used to detect truncation attacks. |
| 350 | 350 | .allow_truncation_attacks = true, |
| 351 | 351 | }, |
| 352 | ) catch return error.TlsInitializationFailed, | |
| 352 | ) catch |err| switch (err) { | |
| 353 | error.WriteFailed => return tls.connection.stream_writer.err.?, | |
| 354 | error.ReadFailed => return tls.connection.stream_reader.err.?, | |
| 355 | else => |e| return e, | |
| 356 | }, | |
| 353 | 357 | }; |
| 354 | 358 | return tls; |
| 355 | 359 | } |
| ... | ... | @@ -1446,7 +1450,8 @@ pub fn connectTcpOptions(client: *Client, options: ConnectTcpOptions) ConnectTcp |
| 1446 | 1450 | const tc = Connection.Tls.create(client, proxied_host, proxied_port, stream) catch |err| switch (err) { |
| 1447 | 1451 | error.OutOfMemory => |e| return e, |
| 1448 | 1452 | error.Unexpected => |e| return e, |
| 1449 | error.UnsupportedClock => return error.TlsInitializationFailed, | |
| 1453 | error.Canceled => |e| return e, | |
| 1454 | else => return error.TlsInitializationFailed, | |
| 1450 | 1455 | }; |
| 1451 | 1456 | client.connection_pool.addUsed(&tc.connection); |
| 1452 | 1457 | return &tc.connection; |
lib/std/os/linux/IoUring.zig+2-2| ... | ... | @@ -2459,12 +2459,12 @@ test "timeout (after a relative time)" { |
| 2459 | 2459 | const margin = 5; |
| 2460 | 2460 | const ts: linux.kernel_timespec = .{ .sec = 0, .nsec = ms * 1000000 }; |
| 2461 | 2461 | |
| 2462 | const started = try std.Io.Timestamp.now(io, .awake); | |
| 2462 | const started = try std.Io.Clock.awake.now(io); | |
| 2463 | 2463 | const sqe = try ring.timeout(0x55555555, &ts, 0, 0); |
| 2464 | 2464 | try testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe.opcode); |
| 2465 | 2465 | try testing.expectEqual(@as(u32, 1), try ring.submit()); |
| 2466 | 2466 | const cqe = try ring.copy_cqe(); |
| 2467 | const stopped = try std.Io.Timestamp.now(io, .awake); | |
| 2467 | const stopped = try std.Io.Clock.awake.now(io); | |
| 2468 | 2468 | |
| 2469 | 2469 | try testing.expectEqual(linux.io_uring_cqe{ |
| 2470 | 2470 | .user_data = 0x55555555, |
lib/std/posix.zig+2| ... | ... | @@ -357,6 +357,7 @@ pub const FChmodAtError = FChmodError || error{ |
| 357 | 357 | ProcessFdQuotaExceeded, |
| 358 | 358 | /// The procfs fallback was used but the system exceeded it open file limit. |
| 359 | 359 | SystemFdQuotaExceeded, |
| 360 | Canceled, | |
| 360 | 361 | }; |
| 361 | 362 | |
| 362 | 363 | /// Changes the `mode` of `path` relative to the directory referred to by |
| ... | ... | @@ -487,6 +488,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr |
| 487 | 488 | error.NameTooLong => unreachable, |
| 488 | 489 | error.FileNotFound => unreachable, |
| 489 | 490 | error.InvalidUtf8 => unreachable, |
| 491 | error.Canceled => return error.Canceled, | |
| 490 | 492 | else => |e| return e, |
| 491 | 493 | }; |
| 492 | 494 | if ((stat.mode & S.IFMT) == S.IFLNK) |
lib/std/time.zig+1-1| ... | ... | @@ -204,7 +204,7 @@ test Timer { |
| 204 | 204 | |
| 205 | 205 | var timer = try Timer.start(); |
| 206 | 206 | |
| 207 | try std.Io.Duration.sleep(.fromMilliseconds(10), io); | |
| 207 | try std.Io.Clock.Duration.sleep(.{ .clock = .awake, .raw = .fromMilliseconds(10) }, io); | |
| 208 | 208 | const time_0 = timer.read(); |
| 209 | 209 | try testing.expect(time_0 > 0); |
| 210 | 210 |