Skip to content

Commit d60db00

Browse files
committed
Merge pull request OpenHFT#13 from lburgazzoli/HFT-AFFINITY-13
AFFINITY-13 CentOS 5.10 : UnsatisfiedLinkError - undefined symbol: sched_getcpu
2 parents 5af7fba + 21372b5 commit d60db00

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

affinity/src/main/java/net/openhft/affinity/impl/PosixJNAAffinity.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ public int getCpu() {
107107
return ret;
108108
} catch (LastErrorException e) {
109109
throw new IllegalStateException("sched_getcpu( ) errorNo=" + e.getErrorCode(), e);
110+
} catch (UnsatisfiedLinkError ule) {
111+
try {
112+
final IntByReference cpu = new IntByReference();
113+
final IntByReference node = new IntByReference();
114+
final int ret = lib.syscall(318, cpu, node, null);
115+
if (ret != 0) {
116+
throw new IllegalStateException("getcpu( ) return " + ret);
117+
}
118+
119+
return cpu.getValue();
120+
} catch (LastErrorException lee) {
121+
throw new IllegalStateException("getcpu( ) errorNo=" + lee.getErrorCode(), lee);
122+
}
110123
}
111124
}
112125

@@ -183,6 +196,10 @@ int sched_getaffinity(final int pid,
183196
final PointerType cpuset) throws LastErrorException;
184197

185198
int sched_getcpu() throws LastErrorException;
199+
200+
int getcpu(final IntByReference cpu,
201+
final IntByReference node,
202+
final PointerType tcache) throws LastErrorException;
186203

187204
int getpid() throws LastErrorException;
188205

0 commit comments

Comments
 (0)