mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8309475: Test java/foreign/TestByteBuffer.java fails: a problem with msync (aix)
Reviewed-by: mbaesken, alanb, mdoerr
This commit is contained in:
parent
f481477144
commit
395fc78880
3 changed files with 210 additions and 25 deletions
|
@ -33,10 +33,6 @@
|
|||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _AIX
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Output type for mincore(2) */
|
||||
#ifdef __linux__
|
||||
typedef unsigned char mincore_vec_t;
|
||||
|
@ -44,16 +40,6 @@ typedef unsigned char mincore_vec_t;
|
|||
typedef char mincore_vec_t;
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
static long calculate_number_of_pages_in_range(void* address, size_t len, size_t pagesize) {
|
||||
uintptr_t address_unaligned = (uintptr_t) address;
|
||||
uintptr_t address_aligned = address_unaligned & (~(pagesize - 1));
|
||||
size_t len2 = len + (address_unaligned - address_aligned);
|
||||
long numPages = (len2 + pagesize - 1) / pagesize;
|
||||
return numPages;
|
||||
}
|
||||
#endif
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_java_nio_MappedMemoryUtils_isLoaded0(JNIEnv *env, jobject obj, jlong address,
|
||||
jlong len, jlong numPages)
|
||||
|
@ -64,15 +50,6 @@ Java_java_nio_MappedMemoryUtils_isLoaded0(JNIEnv *env, jobject obj, jlong addres
|
|||
void *a = (void *) jlong_to_ptr(address);
|
||||
mincore_vec_t* vec = NULL;
|
||||
|
||||
#ifdef _AIX
|
||||
/* See JDK-8186665 */
|
||||
size_t pagesize = (size_t)sysconf(_SC_PAGESIZE);
|
||||
if ((long)pagesize == -1) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
numPages = (jlong) calculate_number_of_pages_in_range(a, len, pagesize);
|
||||
#endif
|
||||
|
||||
/* Include space for one sentinel byte at the end of the buffer
|
||||
* to catch overflows. */
|
||||
vec = (mincore_vec_t*) malloc(numPages + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue