< prev index next >

src/os/bsd/vm/os_bsd.cpp

Print this page




1673 
1674   while (map->l_prev != NULL)
1675     map = map->l_prev;
1676 
1677   while (map != NULL) {
1678     st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name);
1679     map = map->l_next;
1680   }
1681 
1682   dlclose(handle);
1683 #elif defined(__APPLE__)
1684   for (uint32_t i = 1; i < _dyld_image_count(); i++) {
1685     st->print_cr(PTR_FORMAT " \t%s", _dyld_get_image_header(i),
1686         _dyld_get_image_name(i));
1687   }
1688 #else
1689   st->print_cr("Error: Cannot print dynamic libraries.");
1690 #endif
1691 }
1692 















































1693 void os::print_os_info_brief(outputStream* st) {
1694   st->print("Bsd");
1695 
1696   os::Posix::print_uname_info(st);
1697 }
1698 
1699 void os::print_os_info(outputStream* st) {
1700   st->print("OS:");
1701   st->print("Bsd");
1702 
1703   os::Posix::print_uname_info(st);
1704 
1705   os::Posix::print_rlimit_info(st);
1706 
1707   os::Posix::print_load_average(st);
1708 }
1709 
1710 void os::pd_print_cpu_info(outputStream* st) {
1711   // Nothing to do for now.
1712 }


2543 
2544   // Give back the unused reserved pieces.
2545 
2546   for (int j = 0; j < i; ++j) {
2547     if (base[j] != NULL) {
2548       unmap_memory(base[j], size[j]);
2549     }
2550   }
2551 
2552   if (i < max_tries) {
2553     _highest_vm_reserved_address = MAX2(old_highest, (address)requested_addr + bytes);
2554     return requested_addr;
2555   } else {
2556     _highest_vm_reserved_address = old_highest;
2557     return NULL;
2558   }
2559 }
2560 
2561 size_t os::read(int fd, void *buf, unsigned int nBytes) {
2562   RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));




2563 }
2564 
2565 // TODO-FIXME: reconcile Solaris' os::sleep with the bsd variation.
2566 // Solaris uses poll(), bsd uses park().
2567 // Poll() is likely a better choice, assuming that Thread.interrupt()
2568 // generates a SIGUSRx signal. Note that SIGUSR1 can interfere with
2569 // SIGSEGV, see 4355769.
2570 
2571 int os::sleep(Thread* thread, jlong millis, bool interruptible) {
2572   assert(thread == Thread::current(),  "thread consistency check");
2573 
2574   ParkEvent * const slp = thread->_SleepEvent ;
2575   slp->reset() ;
2576   OrderAccess::fence() ;
2577 
2578   if (interruptible) {
2579     jlong prevtime = javaTimeNanos();
2580 
2581     for (;;) {
2582       if (os::is_interrupted(thread, true)) {




1673 
1674   while (map->l_prev != NULL)
1675     map = map->l_prev;
1676 
1677   while (map != NULL) {
1678     st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name);
1679     map = map->l_next;
1680   }
1681 
1682   dlclose(handle);
1683 #elif defined(__APPLE__)
1684   for (uint32_t i = 1; i < _dyld_image_count(); i++) {
1685     st->print_cr(PTR_FORMAT " \t%s", _dyld_get_image_header(i),
1686         _dyld_get_image_name(i));
1687   }
1688 #else
1689   st->print_cr("Error: Cannot print dynamic libraries.");
1690 #endif
1691 }
1692 
1693 int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *param) {
1694 #ifdef RTLD_DI_LINKMAP
1695   Dl_info dli;
1696   void *handle;
1697   Link_map *map;
1698   Link_map *p;
1699 
1700   if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 ||
1701       dli.dli_fname == NULL) {
1702     return 1;
1703   }
1704   handle = dlopen(dli.dli_fname, RTLD_LAZY);
1705   if (handle == NULL) {
1706     return 1;
1707   }
1708   dlinfo(handle, RTLD_DI_LINKMAP, &map);
1709   if (map == NULL) {
1710     dlclose(handle);
1711     return 1;
1712   }
1713 
1714   while (map->l_prev != NULL)
1715     map = map->l_prev;
1716 
1717   while (map != NULL) {
1718     // Value for top_address is returned as 0 since we don't have any information about module size
1719     if (callback(map->l_name, (address)map->l_addr, (address)0, param)) {
1720       dlclose(handle);
1721       return 1;
1722     }
1723     map = map->l_next;
1724   }
1725 
1726   dlclose(handle);
1727 #elif defined(__APPLE__)
1728   for (uint32_t i = 1; i < _dyld_image_count(); i++) {
1729     // Value for top_address is returned as 0 since we don't have any information about module size
1730     if (callback(_dyld_get_image_name(i), (address)_dyld_get_image_header(i), (address)0, param)) {
1731       return 1;
1732     }
1733   }
1734   return 0;
1735 #else
1736   return 1;
1737 #endif
1738 }
1739 
1740 void os::print_os_info_brief(outputStream* st) {
1741   st->print("Bsd");
1742 
1743   os::Posix::print_uname_info(st);
1744 }
1745 
1746 void os::print_os_info(outputStream* st) {
1747   st->print("OS:");
1748   st->print("Bsd");
1749 
1750   os::Posix::print_uname_info(st);
1751 
1752   os::Posix::print_rlimit_info(st);
1753 
1754   os::Posix::print_load_average(st);
1755 }
1756 
1757 void os::pd_print_cpu_info(outputStream* st) {
1758   // Nothing to do for now.
1759 }


2590 
2591   // Give back the unused reserved pieces.
2592 
2593   for (int j = 0; j < i; ++j) {
2594     if (base[j] != NULL) {
2595       unmap_memory(base[j], size[j]);
2596     }
2597   }
2598 
2599   if (i < max_tries) {
2600     _highest_vm_reserved_address = MAX2(old_highest, (address)requested_addr + bytes);
2601     return requested_addr;
2602   } else {
2603     _highest_vm_reserved_address = old_highest;
2604     return NULL;
2605   }
2606 }
2607 
2608 size_t os::read(int fd, void *buf, unsigned int nBytes) {
2609   RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
2610 }
2611 
2612 size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
2613   RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
2614 }
2615 
2616 // TODO-FIXME: reconcile Solaris' os::sleep with the bsd variation.
2617 // Solaris uses poll(), bsd uses park().
2618 // Poll() is likely a better choice, assuming that Thread.interrupt()
2619 // generates a SIGUSRx signal. Note that SIGUSR1 can interfere with
2620 // SIGSEGV, see 4355769.
2621 
2622 int os::sleep(Thread* thread, jlong millis, bool interruptible) {
2623   assert(thread == Thread::current(),  "thread consistency check");
2624 
2625   ParkEvent * const slp = thread->_SleepEvent ;
2626   slp->reset() ;
2627   OrderAccess::fence() ;
2628 
2629   if (interruptible) {
2630     jlong prevtime = javaTimeNanos();
2631 
2632     for (;;) {
2633       if (os::is_interrupted(thread, true)) {


< prev index next >