3457 // Allocate a single page and mark it as readable for safepoint polling |
3457 // Allocate a single page and mark it as readable for safepoint polling |
3458 address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); |
3458 address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); |
3459 guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page"); |
3459 guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page"); |
3460 |
3460 |
3461 os::set_polling_page(polling_page); |
3461 os::set_polling_page(polling_page); |
3462 |
3462 log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page)); |
3463 #ifndef PRODUCT |
|
3464 if (Verbose && PrintMiscellaneous) { |
|
3465 tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", |
|
3466 (intptr_t)polling_page); |
|
3467 } |
|
3468 #endif |
|
3469 |
3463 |
3470 if (!UseMembar) { |
3464 if (!UseMembar) { |
3471 address mem_serialize_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); |
3465 address mem_serialize_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); |
3472 guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page"); |
3466 guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page"); |
3473 os::set_memory_serialize_page(mem_serialize_page); |
3467 os::set_memory_serialize_page(mem_serialize_page); |
3474 |
3468 log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page)); |
3475 #ifndef PRODUCT |
|
3476 if (Verbose && PrintMiscellaneous) { |
|
3477 tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", |
|
3478 (intptr_t)mem_serialize_page); |
|
3479 } |
|
3480 #endif |
|
3481 } |
3469 } |
3482 |
3470 |
3483 // initialize suspend/resume support - must do this before signal_sets_init() |
3471 // initialize suspend/resume support - must do this before signal_sets_init() |
3484 if (SR_initialize() != 0) { |
3472 if (SR_initialize() != 0) { |
3485 perror("SR_initialize failed"); |
3473 perror("SR_initialize failed"); |
3517 // set the number of file descriptors to max. print out error |
3505 // set the number of file descriptors to max. print out error |
3518 // if getrlimit/setrlimit fails but continue regardless. |
3506 // if getrlimit/setrlimit fails but continue regardless. |
3519 struct rlimit nbr_files; |
3507 struct rlimit nbr_files; |
3520 int status = getrlimit(RLIMIT_NOFILE, &nbr_files); |
3508 int status = getrlimit(RLIMIT_NOFILE, &nbr_files); |
3521 if (status != 0) { |
3509 if (status != 0) { |
3522 if (PrintMiscellaneous && (Verbose || WizardMode)) { |
3510 log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno)); |
3523 perror("os::init_2 getrlimit failed"); |
|
3524 } |
|
3525 } else { |
3511 } else { |
3526 nbr_files.rlim_cur = nbr_files.rlim_max; |
3512 nbr_files.rlim_cur = nbr_files.rlim_max; |
3527 |
3513 |
3528 #ifdef __APPLE__ |
3514 #ifdef __APPLE__ |
3529 // Darwin returns RLIM_INFINITY for rlim_max, but fails with EINVAL if |
3515 // Darwin returns RLIM_INFINITY for rlim_max, but fails with EINVAL if |
3532 nbr_files.rlim_cur = MIN(OPEN_MAX, nbr_files.rlim_cur); |
3518 nbr_files.rlim_cur = MIN(OPEN_MAX, nbr_files.rlim_cur); |
3533 #endif |
3519 #endif |
3534 |
3520 |
3535 status = setrlimit(RLIMIT_NOFILE, &nbr_files); |
3521 status = setrlimit(RLIMIT_NOFILE, &nbr_files); |
3536 if (status != 0) { |
3522 if (status != 0) { |
3537 if (PrintMiscellaneous && (Verbose || WizardMode)) { |
3523 log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno)); |
3538 perror("os::init_2 setrlimit failed"); |
|
3539 } |
|
3540 } |
3524 } |
3541 } |
3525 } |
3542 } |
3526 } |
3543 |
3527 |
3544 // at-exit methods are called in the reverse order of their registration. |
3528 // at-exit methods are called in the reverse order of their registration. |