src/os/solaris/vm/attachListener_solaris.cpp

Print this page




 651     }
 652   }
 653   return false;
 654 }
 655 
 656 // if VM aborts then detach/cleanup
 657 void AttachListener::abort() {
 658   listener_cleanup();
 659 }
 660 
 661 void AttachListener::pd_data_dump() {
 662   os::signal_notify(SIGQUIT);
 663 }
 664 
 665 static jint enable_dprobes(AttachOperation* op, outputStream* out) {
 666   const char* probe = op->arg(0);
 667   if (probe == NULL || probe[0] == '\0') {
 668     out->print_cr("No probe specified");
 669     return JNI_ERR;
 670   } else {
 671     int probe_typess = atoi(probe);

 672     if (errno) {
 673       out->print_cr("invalid probe type");
 674       return JNI_ERR;
 675     } else {
 676       DTrace::enable_dprobes(probe_typess);
 677       return JNI_OK;
 678     }
 679   }
 680 }
 681 
 682 // platform specific operations table
 683 static AttachOperationFunctionInfo funcs[] = {
 684   { "enabledprobes", enable_dprobes },
 685   { NULL, NULL }
 686 };
 687 
 688 AttachOperationFunctionInfo* AttachListener::pd_find_operation(const char* name) {
 689   int i;
 690   for (i = 0; funcs[i].name != NULL; i++) {
 691     if (strcmp(funcs[i].name, name) == 0) {
 692       return &funcs[i];
 693     }
 694   }
 695   return NULL;
 696 }
 697 
 698 // Solaris specific global flag set. Currently, we support only
 699 // changing ExtendedDTraceProbes flag.
 700 jint AttachListener::pd_set_flag(AttachOperation* op, outputStream* out) {
 701   const char* name = op->arg(0);
 702   assert(name != NULL, "flag name should not be null");
 703   bool flag = true;
 704   const char* arg1;
 705   if ((arg1 = op->arg(1)) != NULL) {
 706     flag = (atoi(arg1) != 0);

 707     if (errno) {
 708       out->print_cr("flag value has to be an integer");
 709       return JNI_ERR;
 710     }
 711   }
 712 
 713   if (strcmp(name, "ExtendedDTraceProbes") == 0) {
 714     DTrace::set_extended_dprobes(flag);
 715     return JNI_OK;
 716   }
 717 
 718   if (strcmp(name, "DTraceMonitorProbes") == 0) {
 719     DTrace::set_monitor_dprobes(flag);
 720     return JNI_OK;
 721   }
 722 
 723   out->print_cr("flag '%s' cannot be changed", name);
 724   return JNI_ERR;
 725 }
 726 


 651     }
 652   }
 653   return false;
 654 }
 655 
 656 // if VM aborts then detach/cleanup
 657 void AttachListener::abort() {
 658   listener_cleanup();
 659 }
 660 
 661 void AttachListener::pd_data_dump() {
 662   os::signal_notify(SIGQUIT);
 663 }
 664 
 665 static jint enable_dprobes(AttachOperation* op, outputStream* out) {
 666   const char* probe = op->arg(0);
 667   if (probe == NULL || probe[0] == '\0') {
 668     out->print_cr("No probe specified");
 669     return JNI_ERR;
 670   } else {
 671     errno = 0;
 672     int probe_typess = (int)strtol(probe, (char **)NULL, 10);
 673     if (errno) {
 674       out->print_cr("invalid probe type");
 675       return JNI_ERR;
 676     } else {
 677       DTrace::enable_dprobes(probe_typess);
 678       return JNI_OK;
 679     }
 680   }
 681 }
 682 
 683 // platform specific operations table
 684 static AttachOperationFunctionInfo funcs[] = {
 685   { "enabledprobes", enable_dprobes },
 686   { NULL, NULL }
 687 };
 688 
 689 AttachOperationFunctionInfo* AttachListener::pd_find_operation(const char* name) {
 690   int i;
 691   for (i = 0; funcs[i].name != NULL; i++) {
 692     if (strcmp(funcs[i].name, name) == 0) {
 693       return &funcs[i];
 694     }
 695   }
 696   return NULL;
 697 }
 698 
 699 // Solaris specific global flag set. Currently, we support only
 700 // changing ExtendedDTraceProbes flag.
 701 jint AttachListener::pd_set_flag(AttachOperation* op, outputStream* out) {
 702   const char* name = op->arg(0);
 703   assert(name != NULL, "flag name should not be null");
 704   bool flag = true;
 705   const char* arg1;
 706   if ((arg1 = op->arg(1)) != NULL) {
 707     errno = 0;
 708     flag = (strtol(arg1, (char **)NULL, 10) != 0);
 709     if (errno) {
 710       out->print_cr("flag value has to be an integer");
 711       return JNI_ERR;
 712     }
 713   }
 714 
 715   if (strcmp(name, "ExtendedDTraceProbes") == 0) {
 716     DTrace::set_extended_dprobes(flag);
 717     return JNI_OK;
 718   }
 719 
 720   if (strcmp(name, "DTraceMonitorProbes") == 0) {
 721     DTrace::set_monitor_dprobes(flag);
 722     return JNI_OK;
 723   }
 724 
 725   out->print_cr("flag '%s' cannot be changed", name);
 726   return JNI_ERR;
 727 }
 728