io_interface: implement fileSetLength

This commit is contained in:
2026-06-20 09:46:35 +02:00
parent edecb61ba4
commit 3f96898f54
+6 -4
View File
@@ -1012,10 +1012,12 @@ fn fileSupportsAnsiEscapeCodes(userdata: ?*anyopaque, file: File) Cancelable!boo
} }
fn fileSetLength(userdata: ?*anyopaque, file: File, length: u64) File.SetLengthError!void { fn fileSetLength(userdata: ?*anyopaque, file: File, length: u64) File.SetLengthError!void {
_ = userdata; const node: *Node = @ptrCast(@alignCast(userdata.?));
_ = file; node.setFileLength(file.handle, @intCast(length)) catch |err| switch (err) {
_ = length; error.InvalidHandle => return error.AccessDenied,
@panic("Not implemented yet"); error.OutOfMemory => return error.InputOutput,
error.Canceled => return error.Canceled,
};
} }
fn fileSetOwner(userdata: ?*anyopaque, file: File, owner: ?File.Uid, group: ?File.Gid) File.SetOwnerError!void { fn fileSetOwner(userdata: ?*anyopaque, file: File, owner: ?File.Uid, group: ?File.Gid) File.SetOwnerError!void {