2308 bool os::guard_memory(char* addr, size_t size) {
2309 return bsd_mprotect(addr, size, PROT_NONE);
2310 }
2311
2312 bool os::unguard_memory(char* addr, size_t size) {
2313 return bsd_mprotect(addr, size, PROT_READ|PROT_WRITE);
2314 }
2315
2316 bool os::Bsd::hugetlbfs_sanity_check(bool warn, size_t page_size) {
2317 return false;
2318 }
2319
2320 // Large page support
2321
2322 static size_t _large_page_size = 0;
2323
2324 void os::large_page_init() {
2325 }
2326
2327
2328 char* os::reserve_memory_special(size_t bytes, char* req_addr, bool exec) {
2329 // "exec" is passed in but not used. Creating the shared image for
2330 // the code cache doesn't have an SHM_X executable permission to check.
2331 assert(UseLargePages && UseSHM, "only for SHM large pages");
2332
2333 key_t key = IPC_PRIVATE;
2334 char *addr;
2335
2336 bool warn_on_failure = UseLargePages &&
2337 (!FLAG_IS_DEFAULT(UseLargePages) ||
2338 !FLAG_IS_DEFAULT(LargePageSizeInBytes)
2339 );
2340 char msg[128];
2341
2342 // Create a large shared memory region to attach to based on size.
2343 // Currently, size is the total size of the heap
2344 int shmid = shmget(key, bytes, IPC_CREAT|SHM_R|SHM_W);
2345 if (shmid == -1) {
2346 // Possible reasons for shmget failure:
2347 // 1. shmmax is too small for Java heap.
2348 // > check shmmax value: cat /proc/sys/kernel/shmmax
4731
4732 // check libawt_xawt.so
4733 strcpy(libmawtpath, buf);
4734 strcat(libmawtpath, new_xawtstr);
4735 if (::stat(libmawtpath, &statbuf) == 0) return false;
4736
4737 return true;
4738 }
4739
4740 // Get the default path to the core file
4741 // Returns the length of the string
4742 int os::get_core_path(char* buffer, size_t bufferSize) {
4743 int n = jio_snprintf(buffer, bufferSize, "/cores");
4744
4745 // Truncate if theoretical string was longer than bufferSize
4746 n = MIN2(n, (int)bufferSize);
4747
4748 return n;
4749 }
4750
|
2308 bool os::guard_memory(char* addr, size_t size) {
2309 return bsd_mprotect(addr, size, PROT_NONE);
2310 }
2311
2312 bool os::unguard_memory(char* addr, size_t size) {
2313 return bsd_mprotect(addr, size, PROT_READ|PROT_WRITE);
2314 }
2315
2316 bool os::Bsd::hugetlbfs_sanity_check(bool warn, size_t page_size) {
2317 return false;
2318 }
2319
2320 // Large page support
2321
2322 static size_t _large_page_size = 0;
2323
2324 void os::large_page_init() {
2325 }
2326
2327
2328 char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, bool exec) {
2329 fatal("This code is not used or maintained.");
2330
2331 // "exec" is passed in but not used. Creating the shared image for
2332 // the code cache doesn't have an SHM_X executable permission to check.
2333 assert(UseLargePages && UseSHM, "only for SHM large pages");
2334
2335 key_t key = IPC_PRIVATE;
2336 char *addr;
2337
2338 bool warn_on_failure = UseLargePages &&
2339 (!FLAG_IS_DEFAULT(UseLargePages) ||
2340 !FLAG_IS_DEFAULT(LargePageSizeInBytes)
2341 );
2342 char msg[128];
2343
2344 // Create a large shared memory region to attach to based on size.
2345 // Currently, size is the total size of the heap
2346 int shmid = shmget(key, bytes, IPC_CREAT|SHM_R|SHM_W);
2347 if (shmid == -1) {
2348 // Possible reasons for shmget failure:
2349 // 1. shmmax is too small for Java heap.
2350 // > check shmmax value: cat /proc/sys/kernel/shmmax
4733
4734 // check libawt_xawt.so
4735 strcpy(libmawtpath, buf);
4736 strcat(libmawtpath, new_xawtstr);
4737 if (::stat(libmawtpath, &statbuf) == 0) return false;
4738
4739 return true;
4740 }
4741
4742 // Get the default path to the core file
4743 // Returns the length of the string
4744 int os::get_core_path(char* buffer, size_t bufferSize) {
4745 int n = jio_snprintf(buffer, bufferSize, "/cores");
4746
4747 // Truncate if theoretical string was longer than bufferSize
4748 n = MIN2(n, (int)bufferSize);
4749
4750 return n;
4751 }
4752
4753 #ifndef PRODUCT
4754 void TestReserveMemorySpecial_test() {
4755 // No tests available for this platform
4756 }
4757 #endif
|