comparison src/os/solaris/vm/attachListener_solaris.cpp @ 1353:a2ea687fdc7c

6938627: Make temporary directory use property java.io.tmpdir when specified Summary: Get java.io.tmpdir property in os::get_temp_directory() and call this instead of harcoding "/tmp". Don't assume trailing file_separator either. Reviewed-by: dholmes, kamg
author coleenp
date Wed, 31 Mar 2010 16:51:18 -0700
parents e392695de029
children 96d554193f72
comparison
equal deleted inserted replaced
1330:4a9cc99938e3 1353:a2ea687fdc7c
373 int dd = ::door_create(enqueue_proc, NULL, 0); 373 int dd = ::door_create(enqueue_proc, NULL, 0);
374 if (dd < 0) { 374 if (dd < 0) {
375 return -1; 375 return -1;
376 } 376 }
377 377
378 sprintf(door_path, "%s/.java_pid%d", os::get_temp_directory(), os::current_process_id()); 378 snprintf(door_path, sizeof(door_path), "%s/.java_pid%d",
379 os::get_temp_directory(), os::current_process_id());
379 RESTARTABLE(::creat(door_path, S_IRUSR | S_IWUSR), fd); 380 RESTARTABLE(::creat(door_path, S_IRUSR | S_IWUSR), fd);
380 381
381 if (fd == -1) { 382 if (fd == -1) {
382 debug_only(warning("attempt to create %s failed", door_path)); 383 debug_only(warning("attempt to create %s failed", door_path));
383 return -1; 384 return -1;
589 // or /tmp then this is the trigger to start the attach mechanism 590 // or /tmp then this is the trigger to start the attach mechanism
590 bool AttachListener::is_init_trigger() { 591 bool AttachListener::is_init_trigger() {
591 if (init_at_startup() || is_initialized()) { 592 if (init_at_startup() || is_initialized()) {
592 return false; // initialized at startup or already initialized 593 return false; // initialized at startup or already initialized
593 } 594 }
594 char fn[32]; 595 char fn[128];
595 sprintf(fn, ".attach_pid%d", os::current_process_id()); 596 sprintf(fn, ".attach_pid%d", os::current_process_id());
596 int ret; 597 int ret;
597 struct stat64 st; 598 struct stat64 st;
598 RESTARTABLE(::stat64(fn, &st), ret); 599 RESTARTABLE(::stat64(fn, &st), ret);
599 if (ret == -1) { 600 if (ret == -1) {
600 sprintf(fn, "/tmp/.attach_pid%d", os::current_process_id()); 601 snprintf(fn, sizeof(fn), "%s/.attach_pid%d",
602 os::get_temp_directory(), os::current_process_id());
601 RESTARTABLE(::stat64(fn, &st), ret); 603 RESTARTABLE(::stat64(fn, &st), ret);
602 } 604 }
603 if (ret == 0) { 605 if (ret == 0) {
604 // simple check to avoid starting the attach mechanism when 606 // simple check to avoid starting the attach mechanism when
605 // a bogus user creates the file 607 // a bogus user creates the file