Minor fix for race condition during profile reloadings
Some checks failed
PikaOS Package Build & Release (amd64-v3) / build (push) Failing after 20s
Some checks failed
PikaOS Package Build & Release (amd64-v3) / build (push) Failing after 20s
This commit is contained in:
parent
aabb6c4dbe
commit
9decaf13e4
2
.github/release-nest-v3
vendored
2
.github/release-nest-v3
vendored
@ -1 +1 @@
|
||||
2
|
||||
1
|
@ -1,3 +1,9 @@
|
||||
falcond (1.0.2-101pika1) pika; urgency=low
|
||||
|
||||
* Minor fix for race condition during profile reloadings
|
||||
|
||||
-- ferreo <ferreo@pika-os.com> Sun, 12 Jan 2025 13:48:00 +0300
|
||||
|
||||
falcond (1.0.1-101pika5) pika; urgency=low
|
||||
|
||||
* Add config and profile autowatching + config for proton system files
|
||||
|
@ -75,17 +75,21 @@ pub const Daemon = struct {
|
||||
map.clearRetainingCapacity();
|
||||
}
|
||||
|
||||
const config = try Config.load(self.allocator, self.config_path);
|
||||
const power_profiles = try PowerProfiles.init(self.allocator, config);
|
||||
if (self.profile_manager.active_profile != null) {
|
||||
try self.profile_manager.unloadProfile(self.profile_manager.active_profile.?);
|
||||
}
|
||||
|
||||
self.profile_manager.deinit();
|
||||
self.power_profiles.deinit();
|
||||
self.config.deinit();
|
||||
|
||||
const config = try Config.load(self.allocator, self.config_path);
|
||||
const power_profiles = try PowerProfiles.init(self.allocator, config);
|
||||
var profile_manager = ProfileManager.init(self.allocator, power_profiles, config);
|
||||
try ProfileLoader.loadProfiles(self.allocator, &profile_manager.profiles, &profile_manager.proton_profile, self.oneshot);
|
||||
self.config = config;
|
||||
self.power_profiles = power_profiles;
|
||||
self.performance_mode = self.power_profiles.isPerformanceAvailable();
|
||||
|
||||
var profile_manager = ProfileManager.init(self.allocator, power_profiles, config);
|
||||
try ProfileLoader.loadProfiles(self.allocator, &profile_manager.profiles, &profile_manager.proton_profile, self.oneshot);
|
||||
self.profile_manager.deinit();
|
||||
self.profile_manager = profile_manager;
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,23 @@ pub const ProfileManager = struct {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unloadProfile(self: *ProfileManager, profile: *const Profile) !void {
|
||||
if (self.active_profile) |active| {
|
||||
if (active == profile) {
|
||||
std.log.info("Unloading profile: {s}", .{profile.name});
|
||||
|
||||
if (profile.performance_mode and self.power_profiles.isPerformanceAvailable()) {
|
||||
std.log.info("Disabling performance mode for profile: {s}", .{profile.name});
|
||||
self.power_profiles.disablePerformanceMode();
|
||||
}
|
||||
|
||||
vcache_setting.applyVCacheMode(.none);
|
||||
try scx_scheds.deactivateScheduler(self.allocator);
|
||||
self.active_profile = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn matchProcess(self: *ProfileManager, arena: std.mem.Allocator, pid: []const u8, process_name: []const u8) !?*const Profile {
|
||||
return matcher.matchProcess(self.profiles.items, self.proton_profile, arena, pid, process_name, self.config);
|
||||
}
|
||||
|
@ -3,32 +3,6 @@ const types = @import("types.zig");
|
||||
const Profile = types.Profile;
|
||||
const Config = @import("../config/config.zig").Config;
|
||||
|
||||
// Don't match Wine/Proton infrastructure
|
||||
// const system_processes = [_][]const u8{
|
||||
// "steam.exe",
|
||||
// "services.exe",
|
||||
// "winedevice.exe",
|
||||
// "plugplay.exe",
|
||||
// "svchost.exe",
|
||||
// "explorer.exe",
|
||||
// "rpcss.exe",
|
||||
// "tabtip.exe",
|
||||
// "wineboot.exe",
|
||||
// "rundll32.exe",
|
||||
// "iexplore.exe",
|
||||
// "conhost.exe",
|
||||
// "crashpad_handler.exe",
|
||||
// "iscriptevaluator.exe",
|
||||
// "VC_redist.x86.exe",
|
||||
// "VC_redist.x64.exe",
|
||||
// "cmd.exe",
|
||||
// "REDEngineErrorReporter.exe",
|
||||
// "REDprelauncher.exe",
|
||||
// "SteamService.exe",
|
||||
// "UnityCrashHandler64.exe",
|
||||
// "start.exe",
|
||||
// };
|
||||
|
||||
pub fn isProtonParent(arena: std.mem.Allocator, pid: []const u8) !bool {
|
||||
var path_buf: [std.fs.max_path_bytes]u8 = undefined;
|
||||
const status_path = try std.fmt.bufPrint(&path_buf, "/proc/{s}/status", .{pid});
|
||||
|
Loading…
x
Reference in New Issue
Block a user