summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--9ns/src/nine.zig8
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"));