226 } 227 live_objects_only = strcmp(arg0, "-live") == 0; 228 } 229 VM_GC_HeapInspection heapop(out, live_objects_only /* request full gc */); 230 VMThread::execute(&heapop); 231 return JNI_OK; 232 } 233 234 // Implementation of "setflag" command 235 static jint set_flag(AttachOperation* op, outputStream* out) { 236 237 const char* name = NULL; 238 if ((name = op->arg(0)) == NULL) { 239 out->print_cr("flag name is missing"); 240 return JNI_ERR; 241 } 242 243 FormatBuffer<80> err_msg("%s", ""); 244 245 int ret = WriteableFlags::set_flag(op->arg(0), op->arg(1), Flag::ATTACH_ON_DEMAND, err_msg); 246 if (ret != WriteableFlags::SUCCESS) { 247 if (ret == WriteableFlags::NON_WRITABLE) { 248 // if the flag is not manageable try to change it through 249 // the platform dependent implementation 250 return AttachListener::pd_set_flag(op, out); 251 } else { 252 out->print_cr("%s", err_msg.buffer()); 253 } 254 255 return JNI_ERR; 256 } 257 return JNI_OK; 258 } 259 260 // Implementation of "printflag" command 261 // See also: PrintVMFlagsDCmd class 262 static jint print_flag(AttachOperation* op, outputStream* out) { 263 const char* name = NULL; 264 if ((name = op->arg(0)) == NULL) { 265 out->print_cr("flag name is missing"); 266 return JNI_ERR; 267 } | 226 } 227 live_objects_only = strcmp(arg0, "-live") == 0; 228 } 229 VM_GC_HeapInspection heapop(out, live_objects_only /* request full gc */); 230 VMThread::execute(&heapop); 231 return JNI_OK; 232 } 233 234 // Implementation of "setflag" command 235 static jint set_flag(AttachOperation* op, outputStream* out) { 236 237 const char* name = NULL; 238 if ((name = op->arg(0)) == NULL) { 239 out->print_cr("flag name is missing"); 240 return JNI_ERR; 241 } 242 243 FormatBuffer<80> err_msg("%s", ""); 244 245 int ret = WriteableFlags::set_flag(op->arg(0), op->arg(1), Flag::ATTACH_ON_DEMAND, err_msg); 246 if (ret != Flag::SUCCESS) { 247 if (ret == Flag::NON_WRITABLE) { 248 // if the flag is not manageable try to change it through 249 // the platform dependent implementation 250 return AttachListener::pd_set_flag(op, out); 251 } else { 252 out->print_cr("%s", err_msg.buffer()); 253 } 254 255 return JNI_ERR; 256 } 257 return JNI_OK; 258 } 259 260 // Implementation of "printflag" command 261 // See also: PrintVMFlagsDCmd class 262 static jint print_flag(AttachOperation* op, outputStream* out) { 263 const char* name = NULL; 264 if ((name = op->arg(0)) == NULL) { 265 out->print_cr("flag name is missing"); 266 return JNI_ERR; 267 } |