--- a/src/hotspot/os/linux/os_linux.cpp Fri May 18 08:47:42 2018 -0400
+++ b/src/hotspot/os/linux/os_linux.cpp Fri May 18 15:21:23 2018 +0200
@@ -2872,6 +2872,10 @@
set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t,
(void*)&sched_getcpu_syscall));
}
+
+ if (sched_getcpu() == -1) {
+ vm_exit_during_initialization("getcpu(2) system call not supported by kernel");
+ }
}
// Something to do with the numa-aware allocator needs these symbols
@@ -5229,6 +5233,12 @@
return active_cpus;
}
+uint os::processor_id() {
+ const int id = Linux::sched_getcpu();
+ assert(id >= 0 && id < _processor_count, "Invalid processor id");
+ return (uint)id;
+}
+
void os::set_native_thread_name(const char *name) {
if (Linux::_pthread_setname_np) {
char buf [16]; // according to glibc manpage, 16 chars incl. '/0'