1.1 --- a/src/os/solaris/vm/os_solaris.cpp Thu Aug 01 03:44:03 2019 +0100 1.2 +++ b/src/os/solaris/vm/os_solaris.cpp Mon Aug 12 18:30:40 2019 +0300 1.3 @@ -1817,6 +1817,43 @@ 1.4 dlclose(handle); 1.5 } 1.6 1.7 +int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *param) { 1.8 + Dl_info dli; 1.9 + // Sanity check? 1.10 + if (dladdr(CAST_FROM_FN_PTR(void *, os::get_loaded_modules_info), &dli) == 0 || 1.11 + dli.dli_fname == NULL) { 1.12 + return 1; 1.13 + } 1.14 + 1.15 + void * handle = dlopen(dli.dli_fname, RTLD_LAZY); 1.16 + if (handle == NULL) { 1.17 + return 1; 1.18 + } 1.19 + 1.20 + Link_map *map; 1.21 + dlinfo(handle, RTLD_DI_LINKMAP, &map); 1.22 + if (map == NULL) { 1.23 + dlclose(handle); 1.24 + return 1; 1.25 + } 1.26 + 1.27 + while (map->l_prev != NULL) { 1.28 + map = map->l_prev; 1.29 + } 1.30 + 1.31 + while (map != NULL) { 1.32 + // Iterate through all map entries and call callback with fields of interest 1.33 + if(callback(map->l_name, (address)map->l_addr, (address)0, param)) { 1.34 + dlclose(handle); 1.35 + return 1; 1.36 + } 1.37 + map = map->l_next; 1.38 + } 1.39 + 1.40 + dlclose(handle); 1.41 + return 0; 1.42 +} 1.43 + 1.44 // Loads .dll/.so and 1.45 // in case of error it checks if .dll/.so was built for the 1.46 // same architecture as Hotspot is running on 1.47 @@ -3259,6 +3296,15 @@ 1.48 INTERRUPTIBLE_RETURN_INT_VM(::read(fd, buf, nBytes), os::Solaris::clear_interrupted); 1.49 } 1.50 1.51 +size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) { 1.52 + size_t res; 1.53 + JavaThread* thread = (JavaThread*)Thread::current(); 1.54 + assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm"); 1.55 + ThreadBlockInVM tbiv(thread); 1.56 + RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res); 1.57 + return res; 1.58 +} 1.59 + 1.60 size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) { 1.61 INTERRUPTIBLE_RETURN_INT(::read(fd, buf, nBytes), os::Solaris::clear_interrupted); 1.62 }