1538 st->print(", AS ");
1539 getrlimit(RLIMIT_AS, &rlim);
1540 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
1541 else st->print("%uk", rlim.rlim_cur >> 10);
1542
1543 // Print limits on DATA, because it limits the C-heap.
1544 st->print(", DATA ");
1545 getrlimit(RLIMIT_DATA, &rlim);
1546 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
1547 else st->print("%uk", rlim.rlim_cur >> 10);
1548 st->cr();
1549
1550 // load average
1551 st->print("load average:");
1552 double loadavg[3] = {-1.L, -1.L, -1.L};
1553 os::loadavg(loadavg, 3);
1554 st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
1555 st->cr();
1556 }
1557
1558 void os::print_memory_info(outputStream* st) {
1559
1560 st->print_cr("Memory:");
1561
1562 st->print_cr(" default page size: %s", describe_pagesize(os::vm_page_size()));
1563 st->print_cr(" default stack page size: %s", describe_pagesize(os::vm_page_size()));
1564 st->print_cr(" default shm page size: %s", describe_pagesize(os::Aix::shm_default_page_size()));
1565 st->print_cr(" can use 64K pages dynamically: %s", (os::Aix::can_use_64K_pages() ? "yes" :"no"));
1566 st->print_cr(" can use 16M pages dynamically: %s", (os::Aix::can_use_16M_pages() ? "yes" :"no"));
1567 if (g_multipage_error != 0) {
1568 st->print_cr(" multipage error: %d", g_multipage_error);
1569 }
1570
1571 // print out LDR_CNTRL because it affects the default page sizes
1572 const char* const ldr_cntrl = ::getenv("LDR_CNTRL");
1573 st->print_cr(" LDR_CNTRL=%s.", ldr_cntrl ? ldr_cntrl : "<unset>");
1574
1575 const char* const extshm = ::getenv("EXTSHM");
1576 st->print_cr(" EXTSHM=%s.", extshm ? extshm : "<unset>");
1577
2776
2777 char* addr = NULL;
2778 if (use_mmap) {
2779 addr = reserve_mmaped_memory(bytes, requested_addr);
2780 } else {
2781 // shmat: wish address is mandatory, and do not try 16M pages here.
2782 shmatted_memory_info_t info;
2783 const int flags = RESSHM_WISHADDR_OR_FAIL;
2784 if (reserve_shmatted_memory(bytes, requested_addr, flags, &info)) {
2785 addr = info.addr;
2786 }
2787 }
2788
2789 return addr;
2790 }
2791
2792 size_t os::read(int fd, void *buf, unsigned int nBytes) {
2793 return ::read(fd, buf, nBytes);
2794 }
2795
2796 #define NANOSECS_PER_MILLISEC 1000000
2797
2798 int os::sleep(Thread* thread, jlong millis, bool interruptible) {
2799 assert(thread == Thread::current(), "thread consistency check");
2800
2801 // Prevent nasty overflow in deadline calculation
2802 // by handling long sleeps similar to solaris or windows.
2803 const jlong limit = INT_MAX;
2804 int result;
2805 while (millis > limit) {
2806 if ((result = os::sleep(thread, limit, interruptible)) != OS_OK) {
2807 return result;
2808 }
2809 millis -= limit;
2810 }
2811
2812 ParkEvent * const slp = thread->_SleepEvent;
2813 slp->reset();
2814 OrderAccess::fence();
2815
4167 }
4168
4169 bool os::check_heap(bool force) {
4170 return true;
4171 }
4172
4173 // int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
4174 // return ::vsnprintf(buf, count, format, args);
4175 // }
4176
4177 // Is a (classpath) directory empty?
4178 bool os::dir_is_empty(const char* path) {
4179 DIR *dir = NULL;
4180 struct dirent *ptr;
4181
4182 dir = opendir(path);
4183 if (dir == NULL) return true;
4184
4185 /* Scan the directory */
4186 bool result = true;
4187 char buf[sizeof(struct dirent) + MAX_PATH];
4188 while (result && (ptr = ::readdir(dir)) != NULL) {
4189 if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
4190 result = false;
4191 }
4192 }
4193 closedir(dir);
4194 return result;
4195 }
4196
4197 // This code originates from JDK's sysOpen and open64_w
4198 // from src/solaris/hpi/src/system_md.c
4199
4200 #ifndef O_DELETE
4201 #define O_DELETE 0x10000
4202 #endif
4203
4204 // Open a file. Unlink the file immediately after open returns
4205 // if the specified oflag has the O_DELETE flag set.
4206 // O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c
4207
4208 int os::open(const char *path, int oflag, int mode) {
|
1538 st->print(", AS ");
1539 getrlimit(RLIMIT_AS, &rlim);
1540 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
1541 else st->print("%uk", rlim.rlim_cur >> 10);
1542
1543 // Print limits on DATA, because it limits the C-heap.
1544 st->print(", DATA ");
1545 getrlimit(RLIMIT_DATA, &rlim);
1546 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
1547 else st->print("%uk", rlim.rlim_cur >> 10);
1548 st->cr();
1549
1550 // load average
1551 st->print("load average:");
1552 double loadavg[3] = {-1.L, -1.L, -1.L};
1553 os::loadavg(loadavg, 3);
1554 st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
1555 st->cr();
1556 }
1557
1558 int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *param) {
1559 // Not yet implemented.
1560 return 0;
1561 }
1562
1563 void os::print_memory_info(outputStream* st) {
1564
1565 st->print_cr("Memory:");
1566
1567 st->print_cr(" default page size: %s", describe_pagesize(os::vm_page_size()));
1568 st->print_cr(" default stack page size: %s", describe_pagesize(os::vm_page_size()));
1569 st->print_cr(" default shm page size: %s", describe_pagesize(os::Aix::shm_default_page_size()));
1570 st->print_cr(" can use 64K pages dynamically: %s", (os::Aix::can_use_64K_pages() ? "yes" :"no"));
1571 st->print_cr(" can use 16M pages dynamically: %s", (os::Aix::can_use_16M_pages() ? "yes" :"no"));
1572 if (g_multipage_error != 0) {
1573 st->print_cr(" multipage error: %d", g_multipage_error);
1574 }
1575
1576 // print out LDR_CNTRL because it affects the default page sizes
1577 const char* const ldr_cntrl = ::getenv("LDR_CNTRL");
1578 st->print_cr(" LDR_CNTRL=%s.", ldr_cntrl ? ldr_cntrl : "<unset>");
1579
1580 const char* const extshm = ::getenv("EXTSHM");
1581 st->print_cr(" EXTSHM=%s.", extshm ? extshm : "<unset>");
1582
2781
2782 char* addr = NULL;
2783 if (use_mmap) {
2784 addr = reserve_mmaped_memory(bytes, requested_addr);
2785 } else {
2786 // shmat: wish address is mandatory, and do not try 16M pages here.
2787 shmatted_memory_info_t info;
2788 const int flags = RESSHM_WISHADDR_OR_FAIL;
2789 if (reserve_shmatted_memory(bytes, requested_addr, flags, &info)) {
2790 addr = info.addr;
2791 }
2792 }
2793
2794 return addr;
2795 }
2796
2797 size_t os::read(int fd, void *buf, unsigned int nBytes) {
2798 return ::read(fd, buf, nBytes);
2799 }
2800
2801 size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
2802 return ::pread(fd, buf, nBytes, offset);
2803 }
2804
2805 #define NANOSECS_PER_MILLISEC 1000000
2806
2807 int os::sleep(Thread* thread, jlong millis, bool interruptible) {
2808 assert(thread == Thread::current(), "thread consistency check");
2809
2810 // Prevent nasty overflow in deadline calculation
2811 // by handling long sleeps similar to solaris or windows.
2812 const jlong limit = INT_MAX;
2813 int result;
2814 while (millis > limit) {
2815 if ((result = os::sleep(thread, limit, interruptible)) != OS_OK) {
2816 return result;
2817 }
2818 millis -= limit;
2819 }
2820
2821 ParkEvent * const slp = thread->_SleepEvent;
2822 slp->reset();
2823 OrderAccess::fence();
2824
4176 }
4177
4178 bool os::check_heap(bool force) {
4179 return true;
4180 }
4181
4182 // int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
4183 // return ::vsnprintf(buf, count, format, args);
4184 // }
4185
4186 // Is a (classpath) directory empty?
4187 bool os::dir_is_empty(const char* path) {
4188 DIR *dir = NULL;
4189 struct dirent *ptr;
4190
4191 dir = opendir(path);
4192 if (dir == NULL) return true;
4193
4194 /* Scan the directory */
4195 bool result = true;
4196 while (result && (ptr = readdir(dir)) != NULL) {
4197 if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
4198 result = false;
4199 }
4200 }
4201 closedir(dir);
4202 return result;
4203 }
4204
4205 // This code originates from JDK's sysOpen and open64_w
4206 // from src/solaris/hpi/src/system_md.c
4207
4208 #ifndef O_DELETE
4209 #define O_DELETE 0x10000
4210 #endif
4211
4212 // Open a file. Unlink the file immediately after open returns
4213 // if the specified oflag has the O_DELETE flag set.
4214 // O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c
4215
4216 int os::open(const char *path, int oflag, int mode) {
|