6031 6032 int os::bind(int fd, struct sockaddr* him, socklen_t len) { 6033 assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, 6034 "Assumed _thread_in_native"); 6035 return ::bind(fd, him, len); 6036 } 6037 6038 // Get the default path to the core file 6039 // Returns the length of the string 6040 int os::get_core_path(char* buffer, size_t bufferSize) { 6041 const char* p = get_current_directory(buffer, bufferSize); 6042 6043 if (p == NULL) { 6044 assert(p != NULL, "failed to get current directory"); 6045 return 0; 6046 } 6047 6048 return strlen(buffer); 6049 } 6050 6051 #ifndef PRODUCT 6052 void TestReserveMemorySpecial_test() { 6053 // No tests available for this platform 6054 } 6055 #endif | 6031 6032 int os::bind(int fd, struct sockaddr* him, socklen_t len) { 6033 assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, 6034 "Assumed _thread_in_native"); 6035 return ::bind(fd, him, len); 6036 } 6037 6038 // Get the default path to the core file 6039 // Returns the length of the string 6040 int os::get_core_path(char* buffer, size_t bufferSize) { 6041 const char* p = get_current_directory(buffer, bufferSize); 6042 6043 if (p == NULL) { 6044 assert(p != NULL, "failed to get current directory"); 6045 return 0; 6046 } 6047 6048 return strlen(buffer); 6049 } 6050 6051 // Check core dump limit and report possible place where core can be found 6052 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { 6053 int n; 6054 struct rlimit rlim; 6055 bool success; 6056 6057 n = get_core_path(buffer, bufferSize); 6058 6059 if (getrlimit(RLIMIT_CORE, &rlim) != 0) { 6060 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (may not exist)", current_process_id()); 6061 success = true; 6062 } else { 6063 switch(rlim.rlim_cur) { 6064 case RLIM_INFINITY: 6065 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d", current_process_id()); 6066 success = true; 6067 break; 6068 case 0: 6069 jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again"); 6070 success = false; 6071 break; 6072 default: 6073 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", current_process_id(), (unsigned long)(rlim.rlim_cur >> 10)); 6074 success = true; 6075 break; 6076 } 6077 } 6078 VMError::report_coredump_status(buffer, success); 6079 } 6080 6081 #ifndef PRODUCT 6082 void TestReserveMemorySpecial_test() { 6083 // No tests available for this platform 6084 } 6085 #endif |