diff --git a/src/apprt/gtk/cgroup.zig b/src/apprt/gtk/cgroup.zig index 15673159f..d808d1484 100644 --- a/src/apprt/gtk/cgroup.zig +++ b/src/apprt/gtk/cgroup.zig @@ -20,7 +20,7 @@ pub fn init(app: *App) ![]const u8 { // Get our initial cgroup. We need this so we can compare // and detect when we've switched to our transient group. - const original = try internal_os.linux.cgroupPath( + const original = try internal_os.cgroup.current( alloc, pid, ) orelse ""; @@ -31,7 +31,7 @@ pub fn init(app: *App) ![]const u8 { // to do a dumb busy loop to wait for the move to complete. try createScope(connection); const transient = transient: while (true) { - const current = try internal_os.linux.cgroupPath( + const current = try internal_os.cgroup.current( alloc, pid, ) orelse ""; @@ -52,7 +52,7 @@ pub fn init(app: *App) ![]const u8 { /// Enable all the cgroup controllers for the given cgroup. fn enableControllers(alloc: Allocator, cgroup: []const u8) !void { - const raw = try internal_os.linux.cgroupControllers(alloc, cgroup); + const raw = try internal_os.cgroup.controllers(alloc, cgroup); defer alloc.free(raw); // Build our string builder for enabling all controllers diff --git a/src/os/linux.zig b/src/os/cgroup.zig similarity index 93% rename from src/os/linux.zig rename to src/os/cgroup.zig index c9d4d0ba8..0a7cc541f 100644 --- a/src/os/linux.zig +++ b/src/os/cgroup.zig @@ -3,7 +3,7 @@ const assert = std.debug.assert; const Allocator = std.mem.Allocator; /// Returns the path to the cgroup for the given pid. -pub fn cgroupPath(alloc: Allocator, pid: std.os.linux.pid_t) !?[]const u8 { +pub fn current(alloc: Allocator, pid: std.os.linux.pid_t) !?[]const u8 { var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; // Read our cgroup by opening /proc//cgroup and reading the first @@ -35,7 +35,7 @@ pub fn cgroupPath(alloc: Allocator, pid: std.os.linux.pid_t) !?[]const u8 { /// controllers from the /sys/fs directory. This avoids some extra /// work since creating an iterator over this is easy and much cheaper /// than allocating a bunch of copies for an array. -pub fn cgroupControllers(alloc: Allocator, cgroup: []const u8) ![]const u8 { +pub fn controllers(alloc: Allocator, cgroup: []const u8) ![]const u8 { assert(cgroup[0] == '/'); var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; diff --git a/src/os/main.zig b/src/os/main.zig index e3c3ef595..cee592027 100644 --- a/src/os/main.zig +++ b/src/os/main.zig @@ -13,7 +13,7 @@ pub usingnamespace @import("open.zig"); pub usingnamespace @import("pipe.zig"); pub usingnamespace @import("resourcesdir.zig"); pub const TempDir = @import("TempDir.zig"); -pub const linux = @import("linux.zig"); +pub const cgroup = @import("cgroup.zig"); pub const passwd = @import("passwd.zig"); pub const xdg = @import("xdg.zig"); pub const windows = @import("windows.zig");