< prev index next >

src/hotspot/os/aix/os_aix.cpp

Print this page




1189 // called from signal handler. Before adding something to os::abort(), make
1190 // sure it is async-safe and can handle partially initialized VM.
1191 void os::abort(bool dump_core, void* siginfo, const void* context) {
1192   os::shutdown();
1193   if (dump_core) {
1194 #ifndef PRODUCT
1195     fdStream out(defaultStream::output_fd());
1196     out.print_raw("Current thread is ");
1197     char buf[16];
1198     jio_snprintf(buf, sizeof(buf), UINTX_FORMAT, os::current_thread_id());
1199     out.print_raw_cr(buf);
1200     out.print_raw_cr("Dumping core ...");
1201 #endif
1202     ::abort(); // dump core
1203   }
1204 
1205   ::exit(1);
1206 }
1207 
1208 // Die immediately, no exit hook, no abort hook, no cleanup.
1209 // Dump a core file, if possible, for debugging.
1210 void os::die() {
1211   if (TestUnresponsiveErrorHandler && !CreateCoredumpOnCrash) {
1212     // For TimeoutInErrorHandlingTest.java, we just kill the VM
1213     // and don't take the time to generate a core file.
1214     os::signal_raise(SIGKILL);
1215   } else {
1216     ::abort();
1217   }
1218 }
1219 
1220 intx os::current_thread_id() {
1221   return (intx)pthread_self();
1222 }
1223 
1224 int os::current_process_id() {
1225   return getpid();
1226 }
1227 
1228 // DLL functions
1229 
1230 const char* os::dll_file_extension() { return ".so"; }
1231 
1232 // This must be hard coded because it's the system's temporary
1233 // directory not the java application's temp directory, ala java.io.tmpdir.
1234 const char* os::get_temp_directory() { return "/tmp"; }
1235 
1236 // Check if addr is inside libjvm.so.
1237 bool os::address_is_in_vm(address addr) {


1310   return AixSymbols::get_module_name(addr, buf, buflen);
1311 }
1312 
1313 // Loads .dll/.so and in case of error it checks if .dll/.so was built
1314 // for the same architecture as Hotspot is running on.
1315 void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
1316 
1317   if (ebuf && ebuflen > 0) {
1318     ebuf[0] = '\0';
1319     ebuf[ebuflen - 1] = '\0';
1320   }
1321 
1322   if (!filename || strlen(filename) == 0) {
1323     ::strncpy(ebuf, "dll_load: empty filename specified", ebuflen - 1);
1324     return NULL;
1325   }
1326 
1327   // RTLD_LAZY is currently not implemented. The dl is loaded immediately with all its dependants.
1328   void * result= ::dlopen(filename, RTLD_LAZY);
1329   if (result != NULL) {
1330     Events::log(NULL, "Loaded shared library %s", filename);
1331     // Reload dll cache. Don't do this in signal handling.
1332     LoadedLibraries::reload();
1333     return result;
1334   } else {
1335     // error analysis when dlopen fails
1336     const char* error_report = ::dlerror();
1337     if (error_report == NULL) {
1338       error_report = "dlerror returned no error description";
1339     }
1340     if (ebuf != NULL && ebuflen > 0) {
1341       snprintf(ebuf, ebuflen - 1, "%s, LIBPATH=%s, LD_LIBRARY_PATH=%s : %s",
1342                filename, ::getenv("LIBPATH"), ::getenv("LD_LIBRARY_PATH"), error_report);
1343     }
1344     Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
1345   }
1346   return NULL;
1347 }
1348 
1349 void* os::dll_lookup(void* handle, const char* name) {
1350   void* res = dlsym(handle, name);
1351   return res;
1352 }
1353 
1354 void* os::get_default_process_handle() {
1355   return (void*)::dlopen(NULL, RTLD_LAZY);
1356 }
1357 
1358 void os::print_dll_info(outputStream *st) {
1359   st->print_cr("Dynamic libraries:");
1360   LoadedLibraries::print(st);
1361 }
1362 
1363 void os::get_summary_os_info(char* buf, size_t buflen) {
1364   // There might be something more readable than uname results for AIX.




1189 // called from signal handler. Before adding something to os::abort(), make
1190 // sure it is async-safe and can handle partially initialized VM.
1191 void os::abort(bool dump_core, void* siginfo, const void* context) {
1192   os::shutdown();
1193   if (dump_core) {
1194 #ifndef PRODUCT
1195     fdStream out(defaultStream::output_fd());
1196     out.print_raw("Current thread is ");
1197     char buf[16];
1198     jio_snprintf(buf, sizeof(buf), UINTX_FORMAT, os::current_thread_id());
1199     out.print_raw_cr(buf);
1200     out.print_raw_cr("Dumping core ...");
1201 #endif
1202     ::abort(); // dump core
1203   }
1204 
1205   ::exit(1);
1206 }
1207 
1208 // Die immediately, no exit hook, no abort hook, no cleanup.

1209 void os::die() {
1210   ::abort();






1211 }
1212 
1213 intx os::current_thread_id() {
1214   return (intx)pthread_self();
1215 }
1216 
1217 int os::current_process_id() {
1218   return getpid();
1219 }
1220 
1221 // DLL functions
1222 
1223 const char* os::dll_file_extension() { return ".so"; }
1224 
1225 // This must be hard coded because it's the system's temporary
1226 // directory not the java application's temp directory, ala java.io.tmpdir.
1227 const char* os::get_temp_directory() { return "/tmp"; }
1228 
1229 // Check if addr is inside libjvm.so.
1230 bool os::address_is_in_vm(address addr) {


1303   return AixSymbols::get_module_name(addr, buf, buflen);
1304 }
1305 
1306 // Loads .dll/.so and in case of error it checks if .dll/.so was built
1307 // for the same architecture as Hotspot is running on.
1308 void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
1309 
1310   if (ebuf && ebuflen > 0) {
1311     ebuf[0] = '\0';
1312     ebuf[ebuflen - 1] = '\0';
1313   }
1314 
1315   if (!filename || strlen(filename) == 0) {
1316     ::strncpy(ebuf, "dll_load: empty filename specified", ebuflen - 1);
1317     return NULL;
1318   }
1319 
1320   // RTLD_LAZY is currently not implemented. The dl is loaded immediately with all its dependants.
1321   void * result= ::dlopen(filename, RTLD_LAZY);
1322   if (result != NULL) {

1323     // Reload dll cache. Don't do this in signal handling.
1324     LoadedLibraries::reload();
1325     return result;
1326   } else {
1327     // error analysis when dlopen fails
1328     const char* const error_report = ::dlerror();
1329     if (error_report && ebuf && ebuflen > 0) {



1330       snprintf(ebuf, ebuflen - 1, "%s, LIBPATH=%s, LD_LIBRARY_PATH=%s : %s",
1331                filename, ::getenv("LIBPATH"), ::getenv("LD_LIBRARY_PATH"), error_report);
1332     }

1333   }
1334   return NULL;
1335 }
1336 
1337 void* os::dll_lookup(void* handle, const char* name) {
1338   void* res = dlsym(handle, name);
1339   return res;
1340 }
1341 
1342 void* os::get_default_process_handle() {
1343   return (void*)::dlopen(NULL, RTLD_LAZY);
1344 }
1345 
1346 void os::print_dll_info(outputStream *st) {
1347   st->print_cr("Dynamic libraries:");
1348   LoadedLibraries::print(st);
1349 }
1350 
1351 void os::get_summary_os_info(char* buf, size_t buflen) {
1352   // There might be something more readable than uname results for AIX.


< prev index next >