mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8333871: Check return values of sysinfo
Reviewed-by: dholmes, mdoerr, alanb
This commit is contained in:
parent
d57fc1b6dc
commit
30410fe265
@ -2433,6 +2433,7 @@ void os::Linux::print_uptime_info(outputStream* st) {
|
||||
if (ret == 0) {
|
||||
os::print_dhm(st, "OS uptime:", (long) sinfo.uptime);
|
||||
}
|
||||
assert(ret == 0, "sysinfo failed: %s", os::strerror(errno));
|
||||
}
|
||||
|
||||
bool os::Linux::print_container_info(outputStream* st) {
|
||||
@ -2597,7 +2598,8 @@ void os::print_memory_info(outputStream* st) {
|
||||
|
||||
// values in struct sysinfo are "unsigned long"
|
||||
struct sysinfo si;
|
||||
sysinfo(&si);
|
||||
int ret = sysinfo(&si);
|
||||
assert(ret == 0, "sysinfo failed: %s", os::strerror(errno));
|
||||
physical_memory_size_type phys_mem = physical_memory();
|
||||
st->print(", physical " PHYS_MEM_TYPE_FORMAT "k",
|
||||
phys_mem >> 10);
|
||||
@ -2605,10 +2607,12 @@ void os::print_memory_info(outputStream* st) {
|
||||
(void)os::available_memory(avail_mem);
|
||||
st->print("(" PHYS_MEM_TYPE_FORMAT "k free)",
|
||||
avail_mem >> 10);
|
||||
st->print(", swap " UINT64_FORMAT "k",
|
||||
((jlong)si.totalswap * si.mem_unit) >> 10);
|
||||
st->print("(" UINT64_FORMAT "k free)",
|
||||
((jlong)si.freeswap * si.mem_unit) >> 10);
|
||||
if (ret == 0) {
|
||||
st->print(", swap " UINT64_FORMAT "k",
|
||||
((jlong)si.totalswap * si.mem_unit) >> 10);
|
||||
st->print("(" UINT64_FORMAT "k free)",
|
||||
((jlong)si.freeswap * si.mem_unit) >> 10);
|
||||
}
|
||||
st->cr();
|
||||
st->print("Page Sizes: ");
|
||||
_page_sizes.print_on(st);
|
||||
|
||||
@ -388,8 +388,12 @@ GetJavaProperties(JNIEnv *env)
|
||||
/* supported instruction sets */
|
||||
{
|
||||
char list[258];
|
||||
sysinfo(SI_ISALIST, list, sizeof(list));
|
||||
sprops.cpu_isalist = strdup(list);
|
||||
int ret = sysinfo(SI_ISALIST, list, sizeof(list));
|
||||
if (ret == 0) {
|
||||
sprops.cpu_isalist = strdup(list);
|
||||
} else {
|
||||
sprops.cpu_isalist = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
sprops.cpu_isalist = NULL;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user