< prev index next >
src/os/solaris/vm/os_solaris.cpp
Print this page
*** 1807,1816 ****
--- 1807,1853 ----
}
dlclose(handle);
}
+ int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *param) {
+ Dl_info dli;
+ // Sanity check?
+ if (dladdr(CAST_FROM_FN_PTR(void *, os::get_loaded_modules_info), &dli) == 0 ||
+ dli.dli_fname == NULL) {
+ return 1;
+ }
+
+ void * handle = dlopen(dli.dli_fname, RTLD_LAZY);
+ if (handle == NULL) {
+ return 1;
+ }
+
+ Link_map *map;
+ dlinfo(handle, RTLD_DI_LINKMAP, &map);
+ if (map == NULL) {
+ dlclose(handle);
+ return 1;
+ }
+
+ while (map->l_prev != NULL) {
+ map = map->l_prev;
+ }
+
+ while (map != NULL) {
+ // Iterate through all map entries and call callback with fields of interest
+ if(callback(map->l_name, (address)map->l_addr, (address)0, param)) {
+ dlclose(handle);
+ return 1;
+ }
+ map = map->l_next;
+ }
+
+ dlclose(handle);
+ return 0;
+ }
+
// Loads .dll/.so and
// in case of error it checks if .dll/.so was built for the
// same architecture as Hotspot is running on
void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
*** 3249,3258 ****
--- 3286,3304 ----
// Read calls from inside the vm need to perform state transitions
size_t os::read(int fd, void *buf, unsigned int nBytes) {
INTERRUPTIBLE_RETURN_INT_VM(::read(fd, buf, nBytes), os::Solaris::clear_interrupted);
}
+ size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ size_t res;
+ JavaThread* thread = (JavaThread*)Thread::current();
+ assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
+ ThreadBlockInVM tbiv(thread);
+ RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res);
+ return res;
+ }
+
size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
INTERRUPTIBLE_RETURN_INT(::read(fd, buf, nBytes), os::Solaris::clear_interrupted);
}
int os::sleep(Thread* thread, jlong millis, bool interruptible) {
*** 5146,5158 ****
dir = opendir(path);
if (dir == NULL) return true;
/* Scan the directory */
bool result = true;
! char buf[sizeof(struct dirent) + MAX_PATH];
! struct dirent *dbuf = (struct dirent *) buf;
! while (result && (ptr = readdir(dir, dbuf)) != NULL) {
if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
result = false;
}
}
closedir(dir);
--- 5192,5202 ----
dir = opendir(path);
if (dir == NULL) return true;
/* Scan the directory */
bool result = true;
! while (result && (ptr = readdir(dirf)) != NULL) {
if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
result = false;
}
}
closedir(dir);
< prev index next >