8328930: [AIX] remove pase related coding
Reviewed-by: clanger, lucy
This commit is contained in:
parent
da8a095a19
commit
153410f480
src
hotspot/os/aix
jdk.attach/aix/native/libattach
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -228,7 +228,6 @@ int AixAttachListener::init() {
|
||||
addr.sun_family = AF_UNIX;
|
||||
strcpy(addr.sun_path, initial_path);
|
||||
::unlink(initial_path);
|
||||
// We must call bind with the actual socketaddr length. This is obligatory for AS400.
|
||||
int res = ::bind(listener, (struct sockaddr*)&addr, SUN_LEN(&addr));
|
||||
if (res == -1) {
|
||||
::close(listener);
|
||||
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2016 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libo4.hpp"
|
||||
|
||||
// global variables
|
||||
|
||||
// whether initialization worked
|
||||
static bool g_initialized = false;
|
||||
|
||||
//////////////////////////
|
||||
// class libo4 - impl //
|
||||
//////////////////////////
|
||||
|
||||
bool libo4::init() {
|
||||
if (g_initialized) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void libo4::cleanup() {
|
||||
if (g_initialized) {
|
||||
g_initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool libo4::get_memory_info(unsigned long long* p_virt_total,
|
||||
unsigned long long* p_real_total,
|
||||
unsigned long long* p_real_free,
|
||||
unsigned long long* p_pgsp_total,
|
||||
unsigned long long* p_pgsp_free) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool libo4::get_load_avg(double* p_avg1, double* p_avg5, double* p_avg15) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool libo4::realpath(const char* file_name, char* resolved_name,
|
||||
int resolved_name_len) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool libo4::removeEscapeMessageFromJoblogByContext(const void* context) {
|
||||
// Note: no tracing here! We run in signal handling context
|
||||
|
||||
return false;
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2016 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
// Class libo4 is a C++ wrapper around the libo4 porting library. It handles
|
||||
// basic stuff like dynamic loading, library initialization etc.
|
||||
// The libo4 porting library is a set of functions that bridge from the AIX
|
||||
// runtime environment on OS/400 (aka PASE layer) into native OS/400
|
||||
// functionality (aka ILE layer) to close some functional gaps that exist in
|
||||
// the PASE layer.
|
||||
|
||||
#ifndef OS_AIX_LIBO4_HPP
|
||||
#define OS_AIX_LIBO4_HPP
|
||||
|
||||
class libo4 {
|
||||
public:
|
||||
// Initialize the libo4 porting library.
|
||||
// Returns true if succeeded, false if error.
|
||||
static bool init();
|
||||
|
||||
// Triggers cleanup of the libo4 porting library.
|
||||
static void cleanup();
|
||||
|
||||
// Returns a number of memory statistics from OS/400.
|
||||
//
|
||||
// See libo4.h for details on this API.
|
||||
//
|
||||
// Specify null for numbers you are not interested in.
|
||||
//
|
||||
// Returns false if an error happened. Activate OsMisc trace for
|
||||
// trace output.
|
||||
//
|
||||
static bool get_memory_info(unsigned long long* p_virt_total,
|
||||
unsigned long long* p_real_total,
|
||||
unsigned long long* p_real_free,
|
||||
unsigned long long* p_pgsp_total,
|
||||
unsigned long long* p_pgsp_free);
|
||||
|
||||
// Returns information about system load
|
||||
// (similar to "loadavg()" under other Unices)
|
||||
//
|
||||
// See libo4.h for details on this API.
|
||||
//
|
||||
// Specify null for numbers you are not interested in.
|
||||
//
|
||||
// Returns false if an error happened. Activate OsMisc trace for
|
||||
// trace output.
|
||||
//
|
||||
static bool get_load_avg(double* p_avg1, double* p_avg5, double* p_avg15);
|
||||
|
||||
// This is a replacement for the "realpath()" API which does not really work
|
||||
// in PASE together with the (case insensitive but case preserving)
|
||||
// filesystem on OS/400.
|
||||
//
|
||||
// See libo4.h for details on this API.
|
||||
//
|
||||
// Returns false if an error happened. Activate OsMisc trace for
|
||||
// trace output.
|
||||
//
|
||||
static bool realpath(const char* file_name, char* resolved_name,
|
||||
int resolved_name_len);
|
||||
|
||||
// Call libo4_RemoveEscapeMessageFromJoblogByContext API to remove messages
|
||||
// from the OS/400 job log.
|
||||
//
|
||||
// See libo4.h for details on this API.
|
||||
static bool removeEscapeMessageFromJoblogByContext(const void* context);
|
||||
};
|
||||
|
||||
#endif // OS_AIX_LIBO4_HPP
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2024 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,11 +30,8 @@
|
||||
|
||||
#include <odmi.h>
|
||||
|
||||
|
||||
// The purpose of this code is to dynamically load the libodm library
|
||||
// instead of statically linking against it. The library is AIX-specific.
|
||||
// It only exists on AIX, not on PASE. In order to share binaries
|
||||
// between AIX and PASE, we can't directly link against it.
|
||||
|
||||
typedef int (*fun_odm_initialize )(void);
|
||||
typedef char* (*fun_odm_set_path )(char*);
|
||||
|
@ -27,9 +27,7 @@
|
||||
// Encapsulates the libperfstat library.
|
||||
//
|
||||
// The purpose of this code is to dynamically load the libperfstat library
|
||||
// instead of statically linking against it. The libperfstat library is an
|
||||
// AIX-specific library which only exists on AIX, not on PASE. If I want to
|
||||
// share binaries between AIX and PASE, I cannot directly link against libperfstat.so.
|
||||
// instead of statically linking against it.
|
||||
|
||||
#ifndef OS_AIX_LIBPERFSTAT_AIX_HPP
|
||||
#define OS_AIX_LIBPERFSTAT_AIX_HPP
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "jvm.h"
|
||||
#include "jvmtifiles/jvmti.h"
|
||||
#include "libo4.hpp"
|
||||
#include "libperfstat_aix.hpp"
|
||||
#include "libodm_aix.hpp"
|
||||
#include "loadlib_aix.hpp"
|
||||
@ -175,9 +174,6 @@ julong os::Aix::_physical_memory = 0;
|
||||
|
||||
pthread_t os::Aix::_main_thread = ((pthread_t)0);
|
||||
|
||||
// -1 = uninitialized, 0 if AIX, 1 if OS/400 pase
|
||||
int os::Aix::_on_pase = -1;
|
||||
|
||||
// 0 = uninitialized, otherwise 32 bit number:
|
||||
// 0xVVRRTTSS
|
||||
// VV - major version
|
||||
@ -267,10 +263,6 @@ julong os::available_memory() {
|
||||
}
|
||||
|
||||
julong os::Aix::available_memory() {
|
||||
// Avoid expensive API call here, as returned value will always be null.
|
||||
if (os::Aix::on_pase()) {
|
||||
return 0x0LL;
|
||||
}
|
||||
os::Aix::meminfo_t mi;
|
||||
if (os::Aix::get_meminfo(&mi)) {
|
||||
return mi.real_free;
|
||||
@ -300,7 +292,7 @@ julong os::physical_memory() {
|
||||
}
|
||||
|
||||
// Helper function, emulates disclaim64 using multiple 32bit disclaims
|
||||
// because we cannot use disclaim64() on AS/400 and old AIX releases.
|
||||
// because we cannot use disclaim64() on old AIX releases.
|
||||
static bool my_disclaim64(char* addr, size_t size) {
|
||||
|
||||
if (size == 0) {
|
||||
@ -444,15 +436,6 @@ static void query_multipage_support() {
|
||||
g_multipage_support.textpsize = os::Aix::query_pagesize(any_function);
|
||||
}
|
||||
|
||||
// Now probe for support of 64K pages and 16M pages.
|
||||
|
||||
// Before OS/400 V6R1, there is no support for pages other than 4K.
|
||||
if (os::Aix::on_pase_V5R4_or_older()) {
|
||||
trcVerbose("OS/400 < V6R1 - no large page support.");
|
||||
g_multipage_support.error = ERROR_MP_OS_TOO_OLD;
|
||||
goto query_multipage_support_end;
|
||||
}
|
||||
|
||||
// Now check which page sizes the OS claims it supports, and of those, which actually can be used.
|
||||
{
|
||||
const int MAX_PAGE_SIZES = 4;
|
||||
@ -619,66 +602,33 @@ void os::init_system_properties_values() {
|
||||
bool os::Aix::get_meminfo(meminfo_t* pmi) {
|
||||
|
||||
assert(pmi, "get_meminfo: invalid parameter");
|
||||
|
||||
memset(pmi, 0, sizeof(meminfo_t));
|
||||
|
||||
if (os::Aix::on_pase()) {
|
||||
// On PASE, use the libo4 porting library.
|
||||
|
||||
unsigned long long virt_total = 0;
|
||||
unsigned long long real_total = 0;
|
||||
unsigned long long real_free = 0;
|
||||
unsigned long long pgsp_total = 0;
|
||||
unsigned long long pgsp_free = 0;
|
||||
if (libo4::get_memory_info(&virt_total, &real_total, &real_free, &pgsp_total, &pgsp_free)) {
|
||||
pmi->virt_total = virt_total;
|
||||
pmi->real_total = real_total;
|
||||
pmi->real_free = real_free;
|
||||
pmi->pgsp_total = pgsp_total;
|
||||
pmi->pgsp_free = pgsp_free;
|
||||
return true;
|
||||
}
|
||||
// dynamically loaded perfstat library is used to retrieve memory statistics
|
||||
perfstat_memory_total_t psmt;
|
||||
memset (&psmt, '\0', sizeof(psmt));
|
||||
const int rc = libperfstat::perfstat_memory_total(nullptr, &psmt, sizeof(psmt), 1);
|
||||
if (rc == -1) {
|
||||
trcVerbose("perfstat_memory_total() failed (errno=%d)", errno);
|
||||
assert(0, "perfstat_memory_total() failed");
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
// On AIX, I use the (dynamically loaded) perfstat library to retrieve memory statistics
|
||||
// See:
|
||||
// http://publib.boulder.ibm.com/infocenter/systems/index.jsp
|
||||
// ?topic=/com.ibm.aix.basetechref/doc/basetrf1/perfstat_memtot.htm
|
||||
// http://publib.boulder.ibm.com/infocenter/systems/index.jsp
|
||||
// ?topic=/com.ibm.aix.files/doc/aixfiles/libperfstat.h.htm
|
||||
|
||||
perfstat_memory_total_t psmt;
|
||||
memset (&psmt, '\0', sizeof(psmt));
|
||||
const int rc = libperfstat::perfstat_memory_total(nullptr, &psmt, sizeof(psmt), 1);
|
||||
if (rc == -1) {
|
||||
trcVerbose("perfstat_memory_total() failed (errno=%d)", errno);
|
||||
assert(0, "perfstat_memory_total() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(rc == 1, "perfstat_memory_total() - weird return code");
|
||||
|
||||
// excerpt from
|
||||
// http://publib.boulder.ibm.com/infocenter/systems/index.jsp
|
||||
// ?topic=/com.ibm.aix.files/doc/aixfiles/libperfstat.h.htm
|
||||
// The fields of perfstat_memory_total_t:
|
||||
// u_longlong_t virt_total Total virtual memory (in 4 KB pages).
|
||||
// u_longlong_t real_total Total real memory (in 4 KB pages).
|
||||
// u_longlong_t real_free Free real memory (in 4 KB pages).
|
||||
// u_longlong_t pgsp_total Total paging space (in 4 KB pages).
|
||||
// u_longlong_t pgsp_free Free paging space (in 4 KB pages).
|
||||
|
||||
pmi->virt_total = psmt.virt_total * 4096;
|
||||
pmi->real_total = psmt.real_total * 4096;
|
||||
pmi->real_free = psmt.real_free * 4096;
|
||||
pmi->pgsp_total = psmt.pgsp_total * 4096;
|
||||
pmi->pgsp_free = psmt.pgsp_free * 4096;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
assert(rc == 1, "perfstat_memory_total() - weird return code");
|
||||
|
||||
// The fields of perfstat_memory_total_t:
|
||||
// u_longlong_t virt_total Total virtual memory (in 4 KB pages).
|
||||
// u_longlong_t real_total Total real memory (in 4 KB pages).
|
||||
// u_longlong_t real_free Free real memory (in 4 KB pages).
|
||||
// u_longlong_t pgsp_total Total paging space (in 4 KB pages).
|
||||
// u_longlong_t pgsp_free Free paging space (in 4 KB pages).
|
||||
pmi->virt_total = psmt.virt_total * 4096;
|
||||
pmi->real_total = psmt.real_total * 4096;
|
||||
pmi->real_free = psmt.real_free * 4096;
|
||||
pmi->pgsp_total = psmt.pgsp_total * 4096;
|
||||
pmi->pgsp_free = psmt.pgsp_free * 4096;
|
||||
|
||||
return true;
|
||||
} // end os::Aix::get_meminfo
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -957,44 +907,15 @@ double os::elapsedVTime() {
|
||||
//
|
||||
// See: https://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.basetrf2/read_real_time.htm
|
||||
//
|
||||
// On PASE: mread_real_time will always return RTC_POWER_PC data, so no
|
||||
// conversion is necessary. However, mread_real_time will not return
|
||||
// monotonic results but merely matches read_real_time. So we need a tweak
|
||||
// to ensure monotonic results.
|
||||
//
|
||||
// For PASE no public documentation exists, just word by IBM
|
||||
jlong os::javaTimeNanos() {
|
||||
timebasestruct_t time;
|
||||
int rc = mread_real_time(&time, TIMEBASE_SZ);
|
||||
if (os::Aix::on_pase()) {
|
||||
assert(rc == RTC_POWER, "expected time format RTC_POWER from mread_real_time in PASE");
|
||||
jlong now = jlong(time.tb_high) * NANOSECS_PER_SEC + jlong(time.tb_low);
|
||||
jlong prev = max_real_time;
|
||||
if (now <= prev) {
|
||||
return prev; // same or retrograde time;
|
||||
}
|
||||
jlong obsv = Atomic::cmpxchg(&max_real_time, prev, now);
|
||||
assert(obsv >= prev, "invariant"); // Monotonicity
|
||||
// If the CAS succeeded then we're done and return "now".
|
||||
// If the CAS failed and the observed value "obsv" is >= now then
|
||||
// we should return "obsv". If the CAS failed and now > obsv > prv then
|
||||
// some other thread raced this thread and installed a new value, in which case
|
||||
// we could either (a) retry the entire operation, (b) retry trying to install now
|
||||
// or (c) just return obsv. We use (c). No loop is required although in some cases
|
||||
// we might discard a higher "now" value in deference to a slightly lower but freshly
|
||||
// installed obsv value. That's entirely benign -- it admits no new orderings compared
|
||||
// to (a) or (b) -- and greatly reduces coherence traffic.
|
||||
// We might also condition (c) on the magnitude of the delta between obsv and now.
|
||||
// Avoiding excessive CAS operations to hot RW locations is critical.
|
||||
// See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate
|
||||
return (prev == obsv) ? now : obsv;
|
||||
} else {
|
||||
if (rc != RTC_POWER) {
|
||||
rc = time_base_to_time(&time, TIMEBASE_SZ);
|
||||
assert(rc != -1, "error calling time_base_to_time()");
|
||||
}
|
||||
return jlong(time.tb_high) * NANOSECS_PER_SEC + jlong(time.tb_low);
|
||||
|
||||
if (rc != RTC_POWER) {
|
||||
rc = time_base_to_time(&time, TIMEBASE_SZ);
|
||||
assert(rc != -1, "error calling time_base_to_time()");
|
||||
}
|
||||
return jlong(time.tb_high) * NANOSECS_PER_SEC + jlong(time.tb_low);
|
||||
}
|
||||
|
||||
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
|
||||
@ -1564,12 +1485,6 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// For old AS/400's (V5R4 and older) we should not even be here - System V shared memory is not
|
||||
// really supported (max size 4GB), so reserve_mmapped_memory should have been used instead.
|
||||
if (os::Aix::on_pase_V5R4_or_older()) {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
// Align size of shm up to 64K to avoid errors if we later try to change the page size.
|
||||
const size_t size = align_up(bytes, 64*K);
|
||||
|
||||
@ -2086,27 +2001,6 @@ static bool checked_mprotect(char* addr, size_t size, int prot) {
|
||||
} else {
|
||||
rc = read_protected;
|
||||
}
|
||||
|
||||
if (!rc) {
|
||||
if (os::Aix::on_pase()) {
|
||||
// There is an issue on older PASE systems where mprotect() will return success but the
|
||||
// memory will not be protected.
|
||||
// This has nothing to do with the problem of using mproect() on SPEC1170 incompatible
|
||||
// machines; we only see it rarely, when using mprotect() to protect the guard page of
|
||||
// a stack. It is an OS error.
|
||||
//
|
||||
// A valid strategy is just to try again. This usually works. :-/
|
||||
|
||||
::usleep(1000);
|
||||
Events::log(nullptr, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(addr), p2i(addr+size), prot);
|
||||
if (::mprotect(addr, size, prot) == 0) {
|
||||
const bool read_protected_2 =
|
||||
(SafeFetch32((int*)addr, 0x12345678) == 0x12345678 &&
|
||||
SafeFetch32((int*)addr, 0x76543210) == 0x76543210) ? true : false;
|
||||
rc = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert(rc == true, "mprotect failed.");
|
||||
@ -2232,7 +2126,6 @@ void os::naked_yield() {
|
||||
// (Actually, I doubt this even has an impact on AIX, as we do kernel
|
||||
// scheduling there; however, this still leaves iSeries.)
|
||||
//
|
||||
// We use the same values for AIX and PASE.
|
||||
int os::java_to_os_priority[CriticalPriority + 1] = {
|
||||
54, // 0 Entry should never be used
|
||||
|
||||
@ -2320,8 +2213,7 @@ void os::init(void) {
|
||||
g_brk_at_startup = (address) ::sbrk(0);
|
||||
assert(g_brk_at_startup != (address) -1, "sbrk failed");
|
||||
|
||||
// First off, we need to know whether we run on AIX or PASE, and
|
||||
// the OS level we run on.
|
||||
// First off, we need to know the OS level we run on.
|
||||
os::Aix::initialize_os_info();
|
||||
|
||||
// Scan environment (SPEC1170 behaviour, etc).
|
||||
@ -2343,7 +2235,7 @@ void os::init(void) {
|
||||
//
|
||||
// So, we do the following:
|
||||
// LDR_CNTRL can_use_64K_pages_dynamically what we do remarks
|
||||
// 4K no 4K old systems (aix 5.2, as/400 v5r4) or new systems with AME activated
|
||||
// 4K no 4K old systems (aix 5.2) or new systems with AME activated
|
||||
// 4k yes 64k (treat 4k stacks as 64k) different loader than java and standard settings
|
||||
// 64k no --- AIX 5.2 ? ---
|
||||
// 64k yes 64k new systems and standard java loader (we set datapsize=64k when linking)
|
||||
@ -2396,12 +2288,8 @@ void os::init(void) {
|
||||
// debug trace
|
||||
trcVerbose("os::vm_page_size %s", describe_pagesize(os::vm_page_size()));
|
||||
|
||||
// Next, we need to initialize libo4 and libperfstat libraries.
|
||||
if (os::Aix::on_pase()) {
|
||||
os::Aix::initialize_libo4();
|
||||
} else {
|
||||
os::Aix::initialize_libperfstat();
|
||||
}
|
||||
// Next, we need to initialize libperfstat
|
||||
os::Aix::initialize_libperfstat();
|
||||
|
||||
// Reset the perfstat information provided by ODM.
|
||||
libperfstat::perfstat_reset();
|
||||
@ -2425,12 +2313,6 @@ jint os::init_2(void) {
|
||||
|
||||
os::Posix::init_2();
|
||||
|
||||
if (os::Aix::on_pase()) {
|
||||
trcVerbose("Running on PASE.");
|
||||
} else {
|
||||
trcVerbose("Running on AIX (not PASE).");
|
||||
}
|
||||
|
||||
trcVerbose("processor count: %d", os::_processor_count);
|
||||
trcVerbose("physical memory: %lu", Aix::_physical_memory);
|
||||
|
||||
@ -2753,33 +2635,16 @@ int os::loadavg(double values[], int nelem) {
|
||||
guarantee(nelem >= 0 && nelem <= 3, "argument error");
|
||||
guarantee(values, "argument error");
|
||||
|
||||
if (os::Aix::on_pase()) {
|
||||
|
||||
// AS/400 PASE: use libo4 porting library
|
||||
double v[3] = { 0.0, 0.0, 0.0 };
|
||||
|
||||
if (libo4::get_load_avg(v, v + 1, v + 2)) {
|
||||
for (int i = 0; i < nelem; i ++) {
|
||||
values[i] = v[i];
|
||||
}
|
||||
return nelem;
|
||||
} else {
|
||||
return -1;
|
||||
// AIX: use libperfstat
|
||||
libperfstat::cpuinfo_t ci;
|
||||
if (libperfstat::get_cpuinfo(&ci)) {
|
||||
for (int i = 0; i < nelem; i++) {
|
||||
values[i] = ci.loadavg[i];
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// AIX: use libperfstat
|
||||
libperfstat::cpuinfo_t ci;
|
||||
if (libperfstat::get_cpuinfo(&ci)) {
|
||||
for (int i = 0; i < nelem; i++) {
|
||||
values[i] = ci.loadavg[i];
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return nelem;
|
||||
return -1;
|
||||
}
|
||||
return nelem;
|
||||
}
|
||||
|
||||
bool os::is_primordial_thread(void) {
|
||||
@ -2790,18 +2655,17 @@ bool os::is_primordial_thread(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// OS recognitions (PASE/AIX, OS level) call this before calling any
|
||||
// one of Aix::on_pase(), Aix::os_version() static
|
||||
// OS recognitions (OS level) call this before calling Aix::os_version()
|
||||
void os::Aix::initialize_os_info() {
|
||||
|
||||
assert(_on_pase == -1 && _os_version == 0, "already called.");
|
||||
assert(_os_version == 0, "already called.");
|
||||
|
||||
struct utsname uts;
|
||||
memset(&uts, 0, sizeof(uts));
|
||||
strcpy(uts.sysname, "?");
|
||||
if (::uname(&uts) == -1) {
|
||||
trcVerbose("uname failed (%d)", errno);
|
||||
guarantee(0, "Could not determine whether we run on AIX or PASE");
|
||||
guarantee(0, "Could not determine uname information");
|
||||
} else {
|
||||
trcVerbose("uname says: sysname \"%s\" version \"%s\" release \"%s\" "
|
||||
"node \"%s\" machine \"%s\"\n",
|
||||
@ -2813,18 +2677,9 @@ void os::Aix::initialize_os_info() {
|
||||
_os_version = (major << 24) | (minor << 16);
|
||||
char ver_str[20] = {0};
|
||||
const char* name_str = "unknown OS";
|
||||
if (strcmp(uts.sysname, "OS400") == 0) {
|
||||
// We run on AS/400 PASE. We do not support versions older than V5R4M0.
|
||||
_on_pase = 1;
|
||||
if (os_version_short() < 0x0504) {
|
||||
trcVerbose("OS/400 releases older than V5R4M0 not supported.");
|
||||
assert(false, "OS/400 release too old.");
|
||||
}
|
||||
name_str = "OS/400 (pase)";
|
||||
jio_snprintf(ver_str, sizeof(ver_str), "%u.%u", major, minor);
|
||||
} else if (strcmp(uts.sysname, "AIX") == 0) {
|
||||
|
||||
if (strcmp(uts.sysname, "AIX") == 0) {
|
||||
// We run on AIX. We do not support versions older than AIX 7.1.
|
||||
_on_pase = 0;
|
||||
// Determine detailed AIX version: Version, Release, Modification, Fix Level.
|
||||
odmWrapper::determine_os_kernel_version(&_os_version);
|
||||
if (os_version_short() < 0x0701) {
|
||||
@ -2840,7 +2695,7 @@ void os::Aix::initialize_os_info() {
|
||||
trcVerbose("We run on %s %s", name_str, ver_str);
|
||||
}
|
||||
|
||||
guarantee(_on_pase != -1 && _os_version, "Could not determine AIX/OS400 release");
|
||||
guarantee(_os_version, "Could not determine AIX release");
|
||||
} // end: os::Aix::initialize_os_info()
|
||||
|
||||
// Scan environment for important settings which might effect the VM.
|
||||
@ -2895,36 +2750,14 @@ void os::Aix::scan_environment() {
|
||||
_xpg_sus_mode = 0;
|
||||
}
|
||||
|
||||
if (os::Aix::on_pase()) {
|
||||
p = ::getenv("QIBM_MULTI_THREADED");
|
||||
trcVerbose("QIBM_MULTI_THREADED=%s.", p ? p : "<unset>");
|
||||
}
|
||||
|
||||
p = ::getenv("LDR_CNTRL");
|
||||
trcVerbose("LDR_CNTRL=%s.", p ? p : "<unset>");
|
||||
if (os::Aix::on_pase() && os::Aix::os_version_short() == 0x0701) {
|
||||
if (p && ::strstr(p, "TEXTPSIZE")) {
|
||||
trcVerbose("*** WARNING - LDR_CNTRL contains TEXTPSIZE. "
|
||||
"you may experience hangs or crashes on OS/400 V7R1.");
|
||||
}
|
||||
}
|
||||
|
||||
p = ::getenv("AIXTHREAD_GUARDPAGES");
|
||||
trcVerbose("AIXTHREAD_GUARDPAGES=%s.", p ? p : "<unset>");
|
||||
|
||||
} // end: os::Aix::scan_environment()
|
||||
|
||||
// PASE: initialize the libo4 library (PASE porting library).
|
||||
void os::Aix::initialize_libo4() {
|
||||
guarantee(os::Aix::on_pase(), "OS/400 only.");
|
||||
if (!libo4::init()) {
|
||||
trcVerbose("libo4 initialization failed.");
|
||||
assert(false, "libo4 initialization failed");
|
||||
} else {
|
||||
trcVerbose("libo4 initialized.");
|
||||
}
|
||||
}
|
||||
|
||||
void os::Aix::initialize_libperfstat() {
|
||||
if (!libperfstat::init()) {
|
||||
trcVerbose("libperfstat initialization failed.");
|
||||
|
@ -38,14 +38,10 @@ class os::Aix {
|
||||
static julong _physical_memory;
|
||||
static pthread_t _main_thread;
|
||||
|
||||
// -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE)
|
||||
static int _on_pase;
|
||||
|
||||
// 0 = uninitialized, otherwise 16 bit number:
|
||||
// lower 8 bit - minor version
|
||||
// higher 8 bit - major version
|
||||
// For AIX, e.g. 0x0601 for AIX 6.1
|
||||
// for OS/400 e.g. 0x0504 for OS/400 V5R4
|
||||
static uint32_t _os_version;
|
||||
|
||||
// -1 = uninitialized,
|
||||
@ -63,8 +59,7 @@ class os::Aix {
|
||||
static julong physical_memory() { return _physical_memory; }
|
||||
static void initialize_system_info();
|
||||
|
||||
// OS recognitions (PASE/AIX, OS level) call this before calling any
|
||||
// one of Aix::on_pase(), Aix::os_version().
|
||||
// OS recognitions (AIX OS level) call this before calling Aix::os_version().
|
||||
static void initialize_os_info();
|
||||
|
||||
// Scan environment for important settings which might effect the
|
||||
@ -74,9 +69,8 @@ class os::Aix {
|
||||
// Must run after os::Aix::initialue_os_info().
|
||||
static void scan_environment();
|
||||
|
||||
// Initialize libo4 (on PASE) and libperfstat (on AIX). Call this
|
||||
// Initialize libperfstat; call this
|
||||
// before relying on functions from either lib, e.g. Aix::get_meminfo().
|
||||
static void initialize_libo4();
|
||||
static void initialize_libperfstat();
|
||||
|
||||
public:
|
||||
@ -94,13 +88,6 @@ class os::Aix {
|
||||
// libpthread version string
|
||||
static void libpthread_init();
|
||||
|
||||
// Function returns true if we run on OS/400 (pase), false if we run
|
||||
// on AIX.
|
||||
static bool on_pase() {
|
||||
assert(_on_pase != -1, "not initialized");
|
||||
return _on_pase ? true : false;
|
||||
}
|
||||
|
||||
// Get 4 byte AIX kernel version number:
|
||||
// highest 2 bytes: Version, Release
|
||||
// if available: lowest 2 bytes: Tech Level, Service Pack.
|
||||
@ -112,17 +99,11 @@ class os::Aix {
|
||||
// 0 = uninitialized, otherwise 16 bit number:
|
||||
// lower 8 bit - minor version
|
||||
// higher 8 bit - major version
|
||||
// For AIX, e.g. 0x0601 for AIX 6.1
|
||||
// for OS/400 e.g. 0x0504 for OS/400 V5R4
|
||||
// For AIX, e.g. 0x0701 for AIX 7.1
|
||||
static int os_version_short() {
|
||||
return os_version() >> 16;
|
||||
}
|
||||
|
||||
// Convenience method: returns true if running on PASE V5R4 or older.
|
||||
static bool on_pase_V5R4_or_older() {
|
||||
return on_pase() && os_version_short() <= 0x0504;
|
||||
}
|
||||
|
||||
// Returns true if we run in SPEC1170 compliant mode (XPG_SUS_ENV=ON).
|
||||
static bool xpg_sus_mode() {
|
||||
assert(_xpg_sus_mode != -1, "not initialized");
|
||||
@ -155,8 +136,7 @@ class os::Aix {
|
||||
|
||||
};
|
||||
|
||||
// Functions to retrieve memory information on AIX, PASE.
|
||||
// (on AIX, using libperfstat, on PASE with libo4.so).
|
||||
// function to retrieve memory information, using libperfstat
|
||||
// Returns true if ok, false if error.
|
||||
static bool get_meminfo(meminfo_t* pmi);
|
||||
|
||||
|
@ -74,7 +74,6 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_connect
|
||||
addr.sun_family = AF_UNIX;
|
||||
/* strncpy is safe because addr.sun_path was zero-initialized before. */
|
||||
strncpy(addr.sun_path, p, sizeof(addr.sun_path) - 1);
|
||||
/* We must call bind with the actual socketaddr length. This is obligatory for AS400. */
|
||||
if (connect(fd, (struct sockaddr*)&addr, SUN_LEN(&addr)) == -1) {
|
||||
err = errno;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user