1317 ::free(p); // *not* os::free 1318 } else { 1319 // Fallback for platforms struggling with modern Posix standards (AIX 5.3, 6.1). If realpath 1320 // returns EINVAL, this may indicate that realpath is not POSIX.1-2008 compatible and 1321 // that it complains about the NULL we handed down as user buffer. 1322 // In this case, use the user provided buffer but at least check whether realpath caused 1323 // a memory overwrite. 1324 if (errno == EINVAL) { 1325 outbuf[outbuflen - 1] = '\0'; 1326 p = ::realpath(filename, outbuf); 1327 if (p != NULL) { 1328 guarantee(outbuf[outbuflen - 1] == '\0', "realpath buffer overwrite detected."); 1329 result = p; 1330 } 1331 } 1332 } 1333 return result; 1334 1335 } 1336 1337 1338 // Check minimum allowable stack sizes for thread creation and to initialize 1339 // the java system classes, including StackOverflowError - depends on page 1340 // size. 1341 // The space needed for frames during startup is platform dependent. It 1342 // depends on word size, platform calling conventions, C frame layout and 1343 // interpreter/C1/C2 design decisions. Therefore this is given in a 1344 // platform (os/cpu) dependent constant. 1345 // To this, space for guard mechanisms is added, which depends on the 1346 // page size which again depends on the concrete system the VM is running 1347 // on. Space for libc guard pages is not included in this size. 1348 jint os::Posix::set_minimum_stack_sizes() { 1349 size_t os_min_stack_allowed = SOLARIS_ONLY(thr_min_stack()) NOT_SOLARIS(PTHREAD_STACK_MIN); 1350 1351 _java_thread_min_stack_allowed = _java_thread_min_stack_allowed + 1352 JavaThread::stack_guard_zone_size() + 1353 JavaThread::stack_shadow_zone_size(); 1354 1355 _java_thread_min_stack_allowed = align_up(_java_thread_min_stack_allowed, vm_page_size()); 1356 _java_thread_min_stack_allowed = MAX2(_java_thread_min_stack_allowed, os_min_stack_allowed); | 1317 ::free(p); // *not* os::free 1318 } else { 1319 // Fallback for platforms struggling with modern Posix standards (AIX 5.3, 6.1). If realpath 1320 // returns EINVAL, this may indicate that realpath is not POSIX.1-2008 compatible and 1321 // that it complains about the NULL we handed down as user buffer. 1322 // In this case, use the user provided buffer but at least check whether realpath caused 1323 // a memory overwrite. 1324 if (errno == EINVAL) { 1325 outbuf[outbuflen - 1] = '\0'; 1326 p = ::realpath(filename, outbuf); 1327 if (p != NULL) { 1328 guarantee(outbuf[outbuflen - 1] == '\0', "realpath buffer overwrite detected."); 1329 result = p; 1330 } 1331 } 1332 } 1333 return result; 1334 1335 } 1336 1337 int os::stat(const char *path, struct stat *sbuf) { 1338 return ::stat(path, sbuf); 1339 } 1340 1341 char * os::native_path(char *path) { 1342 return path; 1343 } 1344 1345 // Check minimum allowable stack sizes for thread creation and to initialize 1346 // the java system classes, including StackOverflowError - depends on page 1347 // size. 1348 // The space needed for frames during startup is platform dependent. It 1349 // depends on word size, platform calling conventions, C frame layout and 1350 // interpreter/C1/C2 design decisions. Therefore this is given in a 1351 // platform (os/cpu) dependent constant. 1352 // To this, space for guard mechanisms is added, which depends on the 1353 // page size which again depends on the concrete system the VM is running 1354 // on. Space for libc guard pages is not included in this size. 1355 jint os::Posix::set_minimum_stack_sizes() { 1356 size_t os_min_stack_allowed = SOLARIS_ONLY(thr_min_stack()) NOT_SOLARIS(PTHREAD_STACK_MIN); 1357 1358 _java_thread_min_stack_allowed = _java_thread_min_stack_allowed + 1359 JavaThread::stack_guard_zone_size() + 1360 JavaThread::stack_shadow_zone_size(); 1361 1362 _java_thread_min_stack_allowed = align_up(_java_thread_min_stack_allowed, vm_page_size()); 1363 _java_thread_min_stack_allowed = MAX2(_java_thread_min_stack_allowed, os_min_stack_allowed); |