diff options
| -rw-r--r-- | src/9p_io.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/9p_io.zig b/src/9p_io.zig index 5f22b326..9bcb2827 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -724,6 +724,12 @@ pub const Listener = struct { /// and only between the editor's steps: a step out in a syscall may be /// reading one of these entries. fn collectOs(l: *Listener) void { + // A request out in a host syscall may be using an entry's path, or + // made one that no fid names yet (a walk's next element): swept at + // the next quiet instead. Taken back after a step of its own, the + // editor's frame (tty pollFrame) came here with one out, and a walk + // of a directory just made was answered ENOENT. + if (pardes.turn.out != 0) return; const core = l.core; var i: usize = 0; while (i < core.fs.os_paths.items.len) { @@ -1760,6 +1766,15 @@ test "a listening editor posts itself into the 9P registry and unposts on stop" const n = libc.readlink(entry, &link, link.len); try testing.expect(n > 0); try testing.expectEqualStrings(sock, link[0..@intCast(n)]); + // A host path no fid names is swept, but never while a request is + // out in a syscall: it may be that request's, mid-walk. + try p.fs.os_paths.append(gpa, .{ .node = @import("fs.zig").os_node | 1, .path = try gpa.dupe(u8, "/tmp") }); + pardes.turn.out = 1; + l.collectOs(); + pardes.turn.out = 0; + try testing.expectEqual(@as(usize, 1), p.fs.os_paths.items.len); + l.collectOs(); + try testing.expectEqual(@as(usize, 0), p.fs.os_paths.items.len); } // Stopping takes the name back out, so the next editor of that name // is not refused by its own corpse; the lock goes with the socket. |
