mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-10 05:29:48 +00:00
8067015: Implement os::pd_map_memory() on AIX
Reviewed-by: dholmes
This commit is contained in:
parent
db929c3598
commit
7d42a4167f
@ -4144,8 +4144,29 @@ int os::available(int fd, jlong *bytes) {
|
||||
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
|
||||
char *addr, size_t bytes, bool read_only,
|
||||
bool allow_exec) {
|
||||
Unimplemented();
|
||||
return NULL;
|
||||
int prot;
|
||||
int flags = MAP_PRIVATE;
|
||||
|
||||
if (read_only) {
|
||||
prot = PROT_READ;
|
||||
} else {
|
||||
prot = PROT_READ | PROT_WRITE;
|
||||
}
|
||||
|
||||
if (allow_exec) {
|
||||
prot |= PROT_EXEC;
|
||||
}
|
||||
|
||||
if (addr != NULL) {
|
||||
flags |= MAP_FIXED;
|
||||
}
|
||||
|
||||
char* mapped_address = (char*)mmap(addr, (size_t)bytes, prot, flags,
|
||||
fd, file_offset);
|
||||
if (mapped_address == MAP_FAILED) {
|
||||
return NULL;
|
||||
}
|
||||
return mapped_address;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user