< prev index next >

src/hotspot/os/windows/attachListener_windows.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 270,286 **** } // open the pipe to the client HANDLE Win32AttachOperation::open_pipe() { ! HANDLE hPipe = ::CreateFile( pipe(), // pipe name GENERIC_WRITE, // write only 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe 0, // default attributes NULL); // no template file return hPipe; } // write to the pipe BOOL Win32AttachOperation::write_pipe(HANDLE hPipe, char* buf, int len) { --- 270,296 ---- } // open the pipe to the client HANDLE Win32AttachOperation::open_pipe() { ! HANDLE hPipe; ! ! hPipe = ::CreateFile( pipe(), // pipe name GENERIC_WRITE, // write only 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe 0, // default attributes NULL); // no template file + + if (hPipe != INVALID_HANDLE_VALUE) { + // shouldn't happen as there is a pipe created per operation + if (::GetLastError() == ERROR_PIPE_BUSY) { + ::CloseHandle(hPipe); + return INVALID_HANDLE_VALUE; + } + } return hPipe; } // write to the pipe BOOL Win32AttachOperation::write_pipe(HANDLE hPipe, char* buf, int len) {
*** 295,305 **** if (!fSuccess) { return fSuccess; } buf += nwrote; len -= nwrote; ! } while (len > 0); return TRUE; } // Complete the operation: // - open the pipe to the client --- 305,316 ---- if (!fSuccess) { return fSuccess; } buf += nwrote; len -= nwrote; ! } ! while (len > 0); return TRUE; } // Complete the operation: // - open the pipe to the client
*** 313,323 **** thread->set_suspend_equivalent(); // cleared by handle_special_suspend_equivalent_condition() or // java_suspend_self() via check_and_wait_while_suspended() HANDLE hPipe = open_pipe(); - int lastError = (int)::GetLastError(); if (hPipe != INVALID_HANDLE_VALUE) { BOOL fSuccess; char msg[32]; _snprintf(msg, sizeof(msg), "%d\n", result); --- 324,333 ----
*** 325,347 **** fSuccess = write_pipe(hPipe, msg, (int)strlen(msg)); if (fSuccess) { fSuccess = write_pipe(hPipe, (char*)result_stream->base(), (int)(result_stream->size())); } - lastError = (int)::GetLastError(); // Need to flush buffers FlushFileBuffers(hPipe); CloseHandle(hPipe); if (fSuccess) { log_debug(attach)("wrote result of attach operation %s to pipe %s", name(), pipe()); } else { ! log_error(attach)("failure (%d) writing result of operation %s to pipe %s", lastError, name(), pipe()); } } else { ! log_error(attach)("could not open (%d) pipe %s to send result of operation %s", lastError, pipe(), name()); } DWORD res = ::WaitForSingleObject(Win32AttachListener::mutex(), INFINITE); if (res == WAIT_OBJECT_0) { --- 335,356 ---- fSuccess = write_pipe(hPipe, msg, (int)strlen(msg)); if (fSuccess) { fSuccess = write_pipe(hPipe, (char*)result_stream->base(), (int)(result_stream->size())); } // Need to flush buffers FlushFileBuffers(hPipe); CloseHandle(hPipe); if (fSuccess) { log_debug(attach)("wrote result of attach operation %s to pipe %s", name(), pipe()); } else { ! log_error(attach)("failure writing result of operation %s to pipe %s", name(), pipe()); } } else { ! log_error(attach)("could not open pipe %s to send result of operation %s", pipe(), name()); } DWORD res = ::WaitForSingleObject(Win32AttachListener::mutex(), INFINITE); if (res == WAIT_OBJECT_0) {
*** 381,396 **** int AttachListener::pd_init() { return Win32AttachListener::init(); } - // This function is used for Un*x OSes only. - // We need not to implement it for Windows. - bool AttachListener::check_socket_file() { - return false; - } - bool AttachListener::init_at_startup() { return true; } // no trigger mechanism on Windows to start Attach Listener lazily --- 390,399 ----
< prev index next >