Embed PLPA (Portable Linux Processor Affinity) in order to support

conflicting affinity API of different Linux kernel versions.
This commit is contained in:
Hisham Muhammad
2008-03-05 09:46:47 +00:00
parent 5ed2b85c84
commit 4df76d127b
20 changed files with 2897 additions and 3 deletions

View File

@ -27,6 +27,8 @@ in the source distribution for its full text.
#include <pwd.h>
#include <sched.h>
#include <plpa.h>
// This works only with glibc 2.1+. On earlier versions
// the behavior is similar to have a hardcoded page size.
#ifndef PAGE_SIZE
@ -198,12 +200,12 @@ bool Process_setPriority(Process* this, int priority) {
unsigned long Process_getAffinity(Process* this) {
unsigned long mask = 0;
sched_getaffinity(this->pid, sizeof(unsigned long), (cpu_set_t*) &mask);
plpa_sched_getaffinity(this->pid, sizeof(unsigned long), (plpa_cpu_set_t*) &mask);
return mask;
}
bool Process_setAffinity(Process* this, unsigned long mask) {
return (sched_setaffinity(this->pid, sizeof(unsigned long), (cpu_set_t*) &mask) == 0);
return (plpa_sched_setaffinity(this->pid, sizeof(unsigned long), (plpa_cpu_set_t*) &mask) == 0);
}
void Process_sendSignal(Process* this, int signal) {