From 33324a59ccdb220250cb74e15ce13af0e99dcb07 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Fri, 26 Jan 2024 07:57:29 +0000 Subject: [PATCH] 8324637: [aix] Implement support for reporting swap space in jdk.management Reviewed-by: kevinw, stuefe --- .../unix/native/libmanagement_ext/OperatingSystemImpl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c index 3183d8ef9a1..5b978ba38e1 100644 --- a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c +++ b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. 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 @@ -105,6 +105,12 @@ static jlong get_total_or_available_swap_space_size(JNIEnv* env, jboolean availa throw_internal_error(env, "sysctlbyname failed"); } return available ? (jlong)vmusage.xsu_avail : (jlong)vmusage.xsu_total; +#elif defined(_AIX) + perfstat_memory_total_t memory_info; + if (perfstat_memory_total(NULL, &memory_info, sizeof(perfstat_memory_total_t), 1) == -1) { + throw_internal_error(env, "perfstat_memory_total failed"); + } + return available ? (jlong)(memory_info.pgsp_free * 4L * 1024L) : (jlong)(memory_info.pgsp_total * 4L * 1024L); #else /* _ALLBSD_SOURCE */ /* * XXXBSD: there's no way available to get swap info in