comparison src/os/solaris/vm/attachListener_solaris.cpp @ 11139:2e8f19c2feef

7162400: Intermittent java.io.IOException: Bad file number during HotSpotVirtualMachine.executeCommand Summary: Intermittent java.io.IOException: Bad file number during HotSpotVirtualMachine.executeCommand Reviewed-by: dcubed, dholmes, sspitsyn, mgerdin, ctornqvi, dsamersoff
author allwin
date Fri, 12 Jul 2013 18:43:27 +0200
parents e95fc50106cf
children
comparison
equal deleted inserted replaced
11136:dbc0b5dc08f5 11139:2e8f19c2feef
1 /* 1 /*
2 * Copyright (c) 2005, 2012, 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.
574 thread->check_and_wait_while_suspended(); 574 thread->check_and_wait_while_suspended();
575 575
576 return op; 576 return op;
577 } 577 }
578 578
579
580 // Performs initialization at vm startup
581 // For Solaris we remove any stale .java_pid file which could cause
582 // an attaching process to think we are ready to receive a door_call
583 // before we are properly initialized
584
585 void AttachListener::vm_start() {
586 char fn[PATH_MAX+1];
587 struct stat64 st;
588 int ret;
589
590 int n = snprintf(fn, sizeof(fn), "%s/.java_pid%d",
591 os::get_temp_directory(), os::current_process_id());
592 assert(n < sizeof(fn), "java_pid file name buffer overflow");
593
594 RESTARTABLE(::stat64(fn, &st), ret);
595 if (ret == 0) {
596 ret = ::unlink(fn);
597 if (ret == -1) {
598 debug_only(warning("failed to remove stale attach pid file at %s", fn));
599 }
600 }
601 }
602
579 int AttachListener::pd_init() { 603 int AttachListener::pd_init() {
580 JavaThread* thread = JavaThread::current(); 604 JavaThread* thread = JavaThread::current();
581 ThreadBlockInVM tbivm(thread); 605 ThreadBlockInVM tbivm(thread);
582 606
583 thread->set_suspend_equivalent(); 607 thread->set_suspend_equivalent();