mirror of
https://github.com/thepigeongenerator/cpusetcores.git
synced 2025-12-18 14:35:45 +01:00
fix: cpu.c was not coded correctly; some edge cases and using static-width integers
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/sysinfo.h>
|
||||
@@ -10,10 +11,10 @@
|
||||
static inline bool cpu_setter(uint32_t id, bool nstate, uint8_t opts) {
|
||||
bool cstate = !nstate;
|
||||
if (!(opts & OPT_SET_ALL))
|
||||
cstate = getcpu(id);
|
||||
cstate = cpu_getenabled(id);
|
||||
|
||||
if (cstate != nstate) {
|
||||
setcpu(id, nstate);
|
||||
cpu_setenabled(id, nstate);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user