summaryrefslogtreecommitdiff
path: root/src/debug/debug-pal
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2016-05-27 20:03:32 -0700
committerMike McLaughlin <mikem@microsoft.com>2016-05-27 20:03:32 -0700
commit5ac6af932fe2a3f4b285b6dcc79010caf807ea9d (patch)
tree1796105c114488dcb47993f33e4a114b0a7ef4ff /src/debug/debug-pal
parent7711017de7e9f5d42a0db7fd46f7072a64460913 (diff)
downloadcoreclr-5ac6af932fe2a3f4b285b6dcc79010caf807ea9d.tar.gz
coreclr-5ac6af932fe2a3f4b285b6dcc79010caf807ea9d.tar.bz2
coreclr-5ac6af932fe2a3f4b285b6dcc79010caf807ea9d.zip
Fix the named semaphore leak on OSX (and Linux) (#5269)
* Change the dbgshim launch handshake back. The debugger side now creates the name semaphores like before and the transport pipe existence determines that coreclr is ready. Changed when the transport pipes are created: synchronously on the main thread. Correctly set and check the HAVE_PROCFS_* defines. * Code review feedback.
Diffstat (limited to 'src/debug/debug-pal')
-rw-r--r--src/debug/debug-pal/unix/twowaypipe.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/debug/debug-pal/unix/twowaypipe.cpp b/src/debug/debug-pal/unix/twowaypipe.cpp
index a2304de54f..7b2f54d8a1 100644
--- a/src/debug/debug-pal/unix/twowaypipe.cpp
+++ b/src/debug/debug-pal/unix/twowaypipe.cpp
@@ -3,31 +3,14 @@
// See the LICENSE file in the project root for more information.
#include <pal.h>
-
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <pal_assert.h>
-
#include "twowaypipe.h"
-static const char* PipeNameFormat = "/tmp/clr-debug-pipe-%d-%llu-%s";
-
-void TwoWayPipe::GetPipeName(char *name, DWORD id, const char *suffix)
-{
- BOOL ret = GetProcessIdDisambiguationKey(id, &m_disambiguationKey);
-
- // If GetProcessIdDisambiguationKey failed for some reason, it should set the value
- // to 0. We expect that anyone else making the pipe name will also fail and thus will
- // also try to use 0 as the value.
- _ASSERTE(ret == TRUE || m_disambiguationKey == 0);
-
- int chars = _snprintf(name, MaxPipeNameLength, PipeNameFormat, id, m_disambiguationKey, suffix);
- _ASSERTE(chars > 0 && chars < MaxPipeNameLength);
-}
-
// Creates a server side of the pipe.
// Id is used to create pipes names and uniquely identify the pipe on the machine.
// true - success, false - failure (use GetLastError() for more details)
@@ -38,8 +21,8 @@ bool TwoWayPipe::CreateServer(DWORD id)
return false;
m_id = id;
- GetPipeName(m_inPipeName, id, "in");
- GetPipeName(m_outPipeName, id, "out");
+ PAL_GetTransportPipeName(m_inPipeName, id, "in");
+ PAL_GetTransportPipeName(m_outPipeName, id, "out");
if (mkfifo(m_inPipeName, S_IRWXU) == -1)
{
@@ -67,8 +50,8 @@ bool TwoWayPipe::Connect(DWORD id)
m_id = id;
//"in" and "out" are switched deliberately, because we're on the client
- GetPipeName(m_inPipeName, id, "out");
- GetPipeName(m_outPipeName, id, "in");
+ PAL_GetTransportPipeName(m_inPipeName, id, "out");
+ PAL_GetTransportPipeName(m_outPipeName, id, "in");
// Pipe opening order is reversed compared to WaitForConnection()
// in order to avaid deadlock.
@@ -207,5 +190,4 @@ void TwoWayPipe::CleanupTargetProcess()
{
unlink(m_inPipeName);
unlink(m_outPipeName);
- PAL_CleanupTargetProcess(m_id, m_disambiguationKey);
}