Add ioctl errors

master
Luna 2020-03-29 17:45:43 -03:00 committed by Andrew Kelley
parent 2c641c93da
commit 901aab8761
1 changed files with 12 additions and 1 deletions

View File

@ -533,7 +533,18 @@ fn if_nametoindex(name: []const u8) !u32 {
@ptrToInt(&ifr),
);
return ifr.ifr_ifru.ifru_ivalue;
switch (os.errno(rc)) {
os.EBADF => return error.BadFile,
os.EINTR => return error.CaughtSignal,
os.EINVAL => unreachable,
os.EIO => return error.FileSystem,
os.ENOTTY => unreachable,
os.ENXIO => unreachable,
os.ENODEV => return error.Unsupported,
else => {},
}
return @bitCast(u32, ifr.ifr_ifru.ifru_ivalue);
}
pub const AddressList = struct {