diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-06-12 22:04:37 +0200 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2021-07-18 07:47:09 +0200 |
commit | 11d2206f40dd1680923ccae6e421a494c2af0992 (patch) | |
tree | 76513a64006184ee1bfc59ce9fa4aab1b0a2fc43 /openbsd | |
parent | 41af31be7ffbd34518b27aad56a4f54af6a8adf3 (diff) |
Add ProcessList_isCPUonline
Diffstat (limited to 'openbsd')
-rw-r--r-- | openbsd/OpenBSDProcessList.c | 13 | ||||
-rw-r--r-- | openbsd/OpenBSDProcessList.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c index 09eb383c..4f8d7b9a 100644 --- a/openbsd/OpenBSDProcessList.c +++ b/openbsd/OpenBSDProcessList.c @@ -447,3 +447,16 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) { OpenBSDProcessList_scanProcs(opl); } + +bool ProcessList_isCPUonline(const ProcessList* super, unsigned int id) { + assert(id < super->existingCPUs); + + const OpenBSDProcessList* opl = (const OpenBSDProcessList*) super; + + for (unsigned int i = 0; i < super->activeCPUs; i++) { + if (opl->cpus[i].cpuIndex == id) + return true; + } + + return false; +} diff --git a/openbsd/OpenBSDProcessList.h b/openbsd/OpenBSDProcessList.h index 5734d3ab..7e96b429 100644 --- a/openbsd/OpenBSDProcessList.h +++ b/openbsd/OpenBSDProcessList.h @@ -55,4 +55,6 @@ void ProcessList_delete(ProcessList* this); void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate); +bool ProcessList_isCPUonline(const ProcessList* super, unsigned int id); + #endif |