diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 09:37:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-09-28 09:37:36 -0300 |
| commit | a8c7a7158cc9d3bde78e34db6de11c084fde3d65 (patch) | |
| tree | 81aaa485e407f8cc7e3b2d2b0dc1d44bc41b143d /9ns/src | |
| parent | cca47d63c3ba774cb4de6f76603ba6edc5b475fe (diff) | |
| download | cloud9-a8c7a7158cc9d3bde78e34db6de11c084fde3d65.tar.gz cloud9-a8c7a7158cc9d3bde78e34db6de11c084fde3d65.zip | |
9ns: a refused control message is EINVAL
Plan 9 refuses a ctl write with "unknown control message" or "wrong #args
in control message" (kernel/misc/parse.c), quoting the message; pardes's
ctl files now answer the same. The rule comes first, since the quoted
message may hold any other rule's words.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to '9ns/src')
| -rw-r--r-- | 9ns/src/nine.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/9ns/src/nine.zig b/9ns/src/nine.zig index 1079a1d..aefc75a 100644 --- a/9ns/src/nine.zig +++ b/9ns/src/nine.zig @@ -908,6 +908,10 @@ fn readSocket(fd: i32, buf: []u8) Session.Error!usize { pub fn enameToErrno(ename: []const u8) linux.E { const Rule = struct { needle: []const u8, err: linux.E }; const rules = [_]Rule{ + // Plan 9's own refusals of a ctl write (kernel/misc/parse.c), first + // since they quote the message they refuse, whose words could be + // anything below: "unknown control message \"Find permission\"". + .{ .needle = "control message", .err = .INVAL }, // A server that answers a flushed request with an error (Pardes says // "Interrupted system call") should look like a flush to the caller. .{ .needle = "interrupt", .err = .INTR }, @@ -1057,6 +1061,10 @@ test "ename → errno mapping" { try testing.expectEqual(linux.E.INVAL, enameToErrno("bad offset")); try testing.expectEqual(linux.E.INVAL, enameToErrno("invalid argument")); try testing.expectEqual(linux.E.INVAL, enameToErrno("bad request")); + try testing.expectEqual(linux.E.INVAL, enameToErrno("unknown control message \"Bogus 1\"")); + try testing.expectEqual(linux.E.INVAL, enameToErrno("wrong #args in control message \"Newcol 2\"")); + try testing.expectEqual(linux.E.INVAL, enameToErrno("ill-formed control message")); + try testing.expectEqual(linux.E.INVAL, enameToErrno("unknown control message \"Find permission denied\"")); try testing.expectEqual(linux.E.BUSY, enameToErrno("device busy")); try testing.expectEqual(linux.E.NAMETOOLONG, enameToErrno("name too long")); try testing.expectEqual(linux.E.OPNOTSUPP, enameToErrno("operation not supported")); |
