Fix build on head.

This commit is contained in:
Jung-uk Kim 2018-05-15 23:55:39 +00:00
parent 8c0fc6d665
commit 13e9eabe22
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=470063

View file

@ -1090,7 +1090,7 @@
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
@@ -126,11 +125,25 @@
@@ -126,11 +125,24 @@
# include <sys/shm.h>
#ifndef __APPLE__
# include <link.h>
@ -1104,7 +1104,6 @@
+#if __FreeBSD_version > 700109
+#include <sys/cpuset.h>
+#endif
+#include <vm/swap_pager.h>
+#include <vm/vm_param.h>
+#if __FreeBSD_version > 900030
+#include <pthread_np.h>
@ -1116,7 +1115,7 @@
#if defined(__FreeBSD__) || defined(__NetBSD__)
# include <elf.h>
#endif
@@ -162,8 +175,10 @@
@@ -162,8 +174,10 @@
#endif
int (*os::Bsd::_clock_gettime)(clockid_t, struct timespec *) = NULL;
@ -1128,7 +1127,7 @@
Mutex* os::Bsd::_createThread_lock = NULL;
#endif
pthread_t os::Bsd::_main_thread;
@@ -171,7 +186,11 @@
@@ -171,7 +185,11 @@
#ifndef _ALLBSD_SOURCE
bool os::Bsd::_is_floating_stack = false;
bool os::Bsd::_is_NPTL = false;
@ -1140,7 +1139,7 @@
const char * os::Bsd::_glibc_version = NULL;
const char * os::Bsd::_libpthread_version = NULL;
#endif
@@ -205,6 +224,30 @@
@@ -205,6 +223,30 @@
julong os::Bsd::available_memory() {
#ifdef _ALLBSD_SOURCE
@ -1171,7 +1170,7 @@
// XXXBSD: this is just a stopgap implementation
return physical_memory() >> 2;
#else
@@ -221,6 +264,17 @@
@@ -221,6 +263,17 @@
}
julong os::allocatable_physical_memory(julong size) {
@ -1189,7 +1188,7 @@
#ifdef _LP64
return size;
#else
@@ -308,16 +362,22 @@
@@ -308,16 +361,22 @@
#define COMPILER_VARIANT "client"
#endif
@ -1216,7 +1215,7 @@
int rslt = syscall(SYS_gettid);
if (rslt == -1) {
// old kernel, no NPTL support
@@ -325,6 +385,7 @@
@@ -325,6 +384,7 @@
} else {
return (pid_t)rslt;
}
@ -1224,7 +1223,7 @@
}
// Most versions of bsd have a bug where the number of processors are
@@ -337,7 +398,35 @@
@@ -337,7 +397,35 @@
"environment on Bsd when /proc filesystem is not mounted.";
#endif
@ -1261,7 +1260,7 @@
void os::Bsd::initialize_system_info() {
int mib[2];
size_t len;
@@ -452,7 +541,7 @@
@@ -452,7 +540,7 @@
* 7: The default directories, normally /lib and /usr/lib.
*/
#ifndef DEFAULT_LIBPATH
@ -1270,7 +1269,7 @@
#endif
#define EXTENSIONS_DIR "/lib/ext"
@@ -997,7 +1086,7 @@
@@ -997,7 +1085,7 @@
return NULL;
}
@ -1279,7 +1278,7 @@
#ifdef __APPLE__
// thread_id is mach thread on macos
osthread->set_thread_id(::mach_thread_self());
@@ -1009,6 +1098,7 @@
@@ -1009,6 +1097,7 @@
// thread_id is kernel thread id (similar to Solaris LWP id)
osthread->set_thread_id(os::Bsd::gettid());
@ -1287,7 +1286,7 @@
if (UseNUMA) {
int lgrp_id = os::numa_get_group_id();
if (lgrp_id != -1) {
@@ -1016,6 +1106,7 @@
@@ -1016,6 +1105,7 @@
}
}
#endif
@ -1295,7 +1294,7 @@
// initialize signal mask for this thread
os::Bsd::hotspot_sigmask(thread);
@@ -1105,7 +1196,7 @@
@@ -1105,7 +1195,7 @@
// let pthread_create() pick the default value.
}
@ -1304,7 +1303,7 @@
// glibc guard page
pthread_attr_setguardsize(&attr, os::Bsd::default_guard_size(thr_type));
#endif
@@ -1194,7 +1285,7 @@
@@ -1194,7 +1284,7 @@
}
// Store pthread info into the OSThread
@ -1313,7 +1312,7 @@
#ifdef __APPLE__
osthread->set_thread_id(::mach_thread_self());
#else
@@ -1630,7 +1721,10 @@
@@ -1630,7 +1720,10 @@
}
#endif
@ -1325,7 +1324,7 @@
#ifndef SYS_clock_getres
#if defined(IA32) || defined(AMD64)
@@ -1644,6 +1738,7 @@
@@ -1644,6 +1737,7 @@
#else
#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y)
#endif
@ -1333,7 +1332,7 @@
void os::Bsd::fast_thread_clock_init() {
if (!UseBsdPosixThreadCPUClocks) {
@@ -1814,8 +1909,10 @@
@@ -1814,8 +1908,10 @@
}
intx os::current_thread_id() {
@ -1345,7 +1344,7 @@
#else
return (intx)::pthread_self();
#endif
@@ -2338,14 +2435,16 @@
@@ -2338,14 +2434,16 @@
}
void os::print_os_info_brief(outputStream* st) {
@ -1364,7 +1363,7 @@
os::Posix::print_uname_info(st);
@@ -2363,7 +2462,23 @@
@@ -2363,7 +2461,23 @@
st->print("Memory:");
st->print(" %dk page", os::vm_page_size()>>10);
@ -1389,7 +1388,7 @@
// values in struct sysinfo are "unsigned long"
struct sysinfo si;
sysinfo(&si);
@@ -2373,17 +2488,22 @@
@@ -2373,17 +2487,22 @@
os::physical_memory() >> 10);
st->print("(" UINT64_FORMAT "k free)",
os::available_memory() >> 10);
@ -1414,7 +1413,7 @@
st->cr();
}
@@ -2396,7 +2516,7 @@
@@ -2396,7 +2515,7 @@
const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV",
"FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES",
@ -1423,7 +1422,7 @@
const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" };
@@ -2422,7 +2542,7 @@
@@ -2422,7 +2541,7 @@
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
break;
case SIGFPE:
@ -1432,7 +1431,7 @@
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
break;
case SIGSEGV:
@@ -2531,10 +2651,17 @@
@@ -2531,10 +2650,17 @@
jrelib_p = buf + len;
// Add the appropriate library subdir
@ -1450,7 +1449,7 @@
// Add the appropriate client or server subdir
len = strlen(buf);
@@ -2752,7 +2879,7 @@
@@ -2752,7 +2878,7 @@
if (::write(fd, "", 1) == 1) {
mmap(base, size,
PROT_READ|PROT_WRITE|PROT_EXEC,
@ -1459,7 +1458,7 @@
}
}
::close(fd);
@@ -2815,7 +2942,7 @@
@@ -2815,7 +2941,7 @@
}
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
@ -1468,7 +1467,7 @@
}
void os::numa_make_global(char *addr, size_t bytes) {
@@ -2962,7 +3089,7 @@
@@ -2962,7 +3088,7 @@
return ::mprotect(addr, size, PROT_NONE) == 0;
#else
uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
@ -1477,7 +1476,7 @@
return res != (uintptr_t) MAP_FAILED;
#endif
}
@@ -2989,15 +3116,16 @@
@@ -2989,15 +3115,16 @@
char * addr;
int flags;
@ -1498,7 +1497,7 @@
flags, -1, 0);
if (addr != MAP_FAILED) {
@@ -3242,9 +3370,11 @@
@@ -3242,9 +3369,11 @@
#endif
char* os::reserve_memory_special(size_t bytes, char* req_addr, bool exec) {
@ -1510,7 +1509,7 @@
key_t key = IPC_PRIVATE;
char *addr;
@@ -3319,11 +3449,19 @@
@@ -3319,11 +3448,19 @@
// with SysV SHM the entire memory region must be allocated as shared
// memory.
bool os::can_commit_large_page_memory() {
@ -1530,7 +1529,7 @@
}
// Reserve memory at an arbitrary address, only if that area is
@@ -3652,8 +3790,8 @@
@@ -3652,8 +3789,8 @@
return OS_OK;
#else
int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri);
@ -1540,7 +1539,7 @@
}
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
@@ -4169,7 +4307,7 @@
@@ -4169,7 +4306,7 @@
}
}
@ -1549,7 +1548,7 @@
// This is the fastest way to get thread cpu time on Bsd.
// Returns cpu time (user+sys) for any thread, not only for current.
// POSIX compliant clocks are implemented in the kernels 2.6.16+.
@@ -4186,6 +4324,7 @@
@@ -4186,6 +4323,7 @@
}
#endif
@ -1557,7 +1556,7 @@
/////
// glibc on Bsd platform uses non-documented flag
// to indicate, that some special sort of signal
@@ -4196,6 +4335,7 @@
@@ -4196,6 +4334,7 @@
#undef SIGNIFICANT_SIGNAL_MASK
#endif
#define SIGNIFICANT_SIGNAL_MASK (~0x04000000)
@ -1565,7 +1564,7 @@
static const char* get_signal_handler_name(address handler,
char* buf, int buflen) {
@@ -4220,8 +4360,10 @@
@@ -4220,8 +4359,10 @@
sigaction(sig, NULL, &sa);
@ -1576,7 +1575,7 @@
st->print("%s: ", os::exception_name(sig, buf, buflen));
@@ -4243,7 +4385,11 @@
@@ -4243,7 +4384,11 @@
// May be, handler was resetted by VMError?
if(rh != NULL) {
handler = rh;
@ -1588,7 +1587,7 @@
}
st->print(", sa_flags=" PTR32_FORMAT, sa.sa_flags);
@@ -4318,7 +4464,9 @@
@@ -4318,7 +4463,9 @@
os_sigaction(sig, (struct sigaction*)NULL, &act);
@ -1598,7 +1597,7 @@
address thisHandler = (act.sa_flags & SA_SIGINFO)
? CAST_FROM_FN_PTR(address, act.sa_sigaction)
@@ -4379,6 +4527,14 @@
@@ -4379,6 +4526,14 @@
extern bool signal_name(int signo, char* buf, size_t len);
@ -1613,7 +1612,7 @@
const char* os::exception_name(int exception_code, char* buf, size_t size) {
if (0 < exception_code && exception_code <= SIGRTMAX) {
// signal
@@ -4448,7 +4604,7 @@
@@ -4448,7 +4603,7 @@
// this is called _after_ the global arguments have been parsed
jint os::init_2(void)
{
@ -1622,7 +1621,7 @@
Bsd::fast_thread_clock_init();
#endif
@@ -4632,6 +4788,20 @@
@@ -4632,6 +4787,20 @@
int os::active_processor_count() {
#ifdef _ALLBSD_SOURCE
@ -1643,7 +1642,7 @@
return _processor_count;
#else
// Bsd doesn't yet have a (official) notion of processor sets,
@@ -5031,7 +5201,7 @@
@@ -5031,7 +5200,7 @@
return munmap(addr, bytes) == 0;
}
@ -1652,7 +1651,7 @@
static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time);
static clockid_t thread_cpu_clockid(Thread* thread) {
@@ -5055,7 +5225,7 @@
@@ -5055,7 +5224,7 @@
jlong os::current_thread_cpu_time() {
#ifdef __APPLE__
return os::thread_cpu_time(Thread::current(), true /* user + sys */);
@ -1661,7 +1660,7 @@
if (os::Bsd::supports_fast_thread_cpu_time()) {
return os::Bsd::fast_thread_cpu_time(CLOCK_THREAD_CPUTIME_ID);
} else {
@@ -5066,7 +5236,7 @@
@@ -5066,7 +5235,7 @@
}
jlong os::thread_cpu_time(Thread* thread) {
@ -1670,7 +1669,7 @@
// consistent with what current_thread_cpu_time() returns
if (os::Bsd::supports_fast_thread_cpu_time()) {
return os::Bsd::fast_thread_cpu_time(thread_cpu_clockid(thread));
@@ -5079,7 +5249,7 @@
@@ -5079,7 +5248,7 @@
jlong os::current_thread_cpu_time(bool user_sys_cpu_time) {
#ifdef __APPLE__
return os::thread_cpu_time(Thread::current(), user_sys_cpu_time);
@ -1679,7 +1678,7 @@
if (user_sys_cpu_time && os::Bsd::supports_fast_thread_cpu_time()) {
return os::Bsd::fast_thread_cpu_time(CLOCK_THREAD_CPUTIME_ID);
} else {
@@ -5108,7 +5278,7 @@
@@ -5108,7 +5277,7 @@
} else {
return ((jlong)tinfo.user_time.seconds * 1000000000) + ((jlong)tinfo.user_time.microseconds * (jlong)1000);
}
@ -1688,7 +1687,7 @@
if (user_sys_cpu_time && os::Bsd::supports_fast_thread_cpu_time()) {
return os::Bsd::fast_thread_cpu_time(thread_cpu_clockid(thread));
} else {
@@ -5117,12 +5287,15 @@
@@ -5117,12 +5286,15 @@
#endif
}
@ -1705,7 +1704,7 @@
static bool proc_pid_cpu_avail = true;
static bool proc_task_unchecked = true;
static const char *proc_stat_path = "/proc/%d/stat";
@@ -5206,6 +5379,7 @@
@@ -5206,6 +5378,7 @@
} else {
return (jlong)user_time * (1000000000 / clock_tics_per_sec);
}
@ -1713,7 +1712,7 @@
}
#endif
@@ -5224,7 +5398,7 @@
@@ -5224,7 +5397,7 @@
}
bool os::is_thread_cpu_time_supported() {
@ -1722,7 +1721,7 @@
return true;
#elif defined(_ALLBSD_SOURCE)
return false;
@@ -5799,3 +5973,30 @@
@@ -5799,3 +5972,30 @@
return true;
}