1 /* |
1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
430 thread->check_and_wait_while_suspended(); |
430 thread->check_and_wait_while_suspended(); |
431 |
431 |
432 return op; |
432 return op; |
433 } |
433 } |
434 |
434 |
|
435 |
|
436 // Performs initialization at vm startup |
|
437 // For Linux we remove any stale .java_pid file which could cause |
|
438 // an attaching process to think we are ready to receive on the |
|
439 // domain socket before we are properly initialized |
|
440 |
|
441 void AttachListener::vm_start() { |
|
442 char fn[UNIX_PATH_MAX]; |
|
443 struct stat64 st; |
|
444 int ret; |
|
445 |
|
446 int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d", |
|
447 os::get_temp_directory(), os::current_process_id()); |
|
448 assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow"); |
|
449 |
|
450 RESTARTABLE(::stat64(fn, &st), ret); |
|
451 if (ret == 0) { |
|
452 ret = ::unlink(fn); |
|
453 if (ret == -1) { |
|
454 debug_only(warning("failed to remove stale attach pid file at %s", fn)); |
|
455 } |
|
456 } |
|
457 } |
|
458 |
435 int AttachListener::pd_init() { |
459 int AttachListener::pd_init() { |
436 JavaThread* thread = JavaThread::current(); |
460 JavaThread* thread = JavaThread::current(); |
437 ThreadBlockInVM tbivm(thread); |
461 ThreadBlockInVM tbivm(thread); |
438 |
462 |
439 thread->set_suspend_equivalent(); |
463 thread->set_suspend_equivalent(); |