hotspot/src/os/aix/vm/os_aix.cpp
changeset 47089 27050b653624
parent 46823 d38520dd1ec3
child 47102 2f0905582ea4
equal deleted inserted replaced
47087:2279556f90ec 47089:27050b653624
  1183 
  1183 
  1184 // This must be hard coded because it's the system's temporary
  1184 // This must be hard coded because it's the system's temporary
  1185 // directory not the java application's temp directory, ala java.io.tmpdir.
  1185 // directory not the java application's temp directory, ala java.io.tmpdir.
  1186 const char* os::get_temp_directory() { return "/tmp"; }
  1186 const char* os::get_temp_directory() { return "/tmp"; }
  1187 
  1187 
  1188 static bool file_exists(const char* filename) {
       
  1189   struct stat statbuf;
       
  1190   if (filename == NULL || strlen(filename) == 0) {
       
  1191     return false;
       
  1192   }
       
  1193   return os::stat(filename, &statbuf) == 0;
       
  1194 }
       
  1195 
       
  1196 bool os::dll_build_name(char* buffer, size_t buflen,
       
  1197                         const char* pname, const char* fname) {
       
  1198   bool retval = false;
       
  1199   // Copied from libhpi
       
  1200   const size_t pnamelen = pname ? strlen(pname) : 0;
       
  1201 
       
  1202   // Return error on buffer overflow.
       
  1203   if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
       
  1204     *buffer = '\0';
       
  1205     return retval;
       
  1206   }
       
  1207 
       
  1208   if (pnamelen == 0) {
       
  1209     snprintf(buffer, buflen, "lib%s.so", fname);
       
  1210     retval = true;
       
  1211   } else if (strchr(pname, *os::path_separator()) != NULL) {
       
  1212     int n;
       
  1213     char** pelements = split_path(pname, &n);
       
  1214     if (pelements == NULL) {
       
  1215       return false;
       
  1216     }
       
  1217     for (int i = 0; i < n; i++) {
       
  1218       // Really shouldn't be NULL, but check can't hurt
       
  1219       if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
       
  1220         continue; // skip the empty path values
       
  1221       }
       
  1222       snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname);
       
  1223       if (file_exists(buffer)) {
       
  1224         retval = true;
       
  1225         break;
       
  1226       }
       
  1227     }
       
  1228     // release the storage
       
  1229     for (int i = 0; i < n; i++) {
       
  1230       if (pelements[i] != NULL) {
       
  1231         FREE_C_HEAP_ARRAY(char, pelements[i]);
       
  1232       }
       
  1233     }
       
  1234     if (pelements != NULL) {
       
  1235       FREE_C_HEAP_ARRAY(char*, pelements);
       
  1236     }
       
  1237   } else {
       
  1238     snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
       
  1239     retval = true;
       
  1240   }
       
  1241   return retval;
       
  1242 }
       
  1243 
       
  1244 // Check if addr is inside libjvm.so.
  1188 // Check if addr is inside libjvm.so.
  1245 bool os::address_is_in_vm(address addr) {
  1189 bool os::address_is_in_vm(address addr) {
  1246 
  1190 
  1247   // Input could be a real pc or a function pointer literal. The latter
  1191   // Input could be a real pc or a function pointer literal. The latter
  1248   // would be a function descriptor residing in the data segment of a module.
  1192   // would be a function descriptor residing in the data segment of a module.