aboutsummaryrefslogtreecommitdiff
path: root/system.old/libraries/io/location.zig
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-02-24 06:56:58 +0530
committerBobby <[email protected]>2026-02-24 06:56:58 +0530
commit5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8 (patch)
tree2ae2a13678844b82b43583ca28eed4d4b6223ec0 /system.old/libraries/io/location.zig
parent297c66b480a238dad5ce7f03405fe6f5b9123701 (diff)
downloadakiba-5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8.tar.xz
akiba-5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8.zip
Bunch of stuff moved as .old for new arch change
Diffstat (limited to 'system.old/libraries/io/location.zig')
-rw-r--r--system.old/libraries/io/location.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/system.old/libraries/io/location.zig b/system.old/libraries/io/location.zig
new file mode 100644
index 0000000..0f1e114
--- /dev/null
+++ b/system.old/libraries/io/location.zig
@@ -0,0 +1,30 @@
+//! Location operations
+
+const sys = @import("sys");
+const types = @import("types.zig");
+
+const ERROR_RESULT: u64 = @bitCast(@as(i64, -1));
+
+pub fn get(buffer: []u8) types.Error![]u8 {
+ const result = sys.syscall(.getlocation, .{
+ @intFromPtr(buffer.ptr),
+ buffer.len,
+ });
+
+ if (result == ERROR_RESULT) {
+ return types.Error.GetLocationFailed;
+ }
+
+ return buffer[0..@intCast(result)];
+}
+
+pub fn set(location: []const u8) types.Error!void {
+ const result = sys.syscall(.setlocation, .{
+ @intFromPtr(location.ptr),
+ location.len,
+ });
+
+ if (result == ERROR_RESULT) {
+ return types.Error.InvalidLocation;
+ }
+}