diff options
author | Aditya Mandaleeka <adityam@microsoft.com> | 2016-02-18 18:43:52 -0800 |
---|---|---|
committer | Aditya Mandaleeka <adityam@microsoft.com> | 2016-02-18 18:43:52 -0800 |
commit | 0208fdd15297dd76a088d5af412746ba3e6d7bf2 (patch) | |
tree | f72126406ae34204fd8e54d0db4954a5907df6cb /src/debug | |
parent | 2bb58c00bbd05465ce0e8abcc8bd2a9ea8cf6dc3 (diff) | |
download | coreclr-0208fdd15297dd76a088d5af412746ba3e6d7bf2.tar.gz coreclr-0208fdd15297dd76a088d5af412746ba3e6d7bf2.tar.bz2 coreclr-0208fdd15297dd76a088d5af412746ba3e6d7bf2.zip |
Disambiguate debug pipe names with more than just PID.
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/debug-pal/unix/twowaypipe.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/debug/debug-pal/unix/twowaypipe.cpp b/src/debug/debug-pal/unix/twowaypipe.cpp index 062dc1a145..2892ef8125 100644 --- a/src/debug/debug-pal/unix/twowaypipe.cpp +++ b/src/debug/debug-pal/unix/twowaypipe.cpp @@ -13,11 +13,19 @@ #include "twowaypipe.h" -#define PIPE_NAME_FORMAT_STR "/tmp/clr-debug-pipe-%d-%s" +#define PIPE_NAME_FORMAT_STR "/tmp/clr-debug-pipe-%llu-%d-%s" static void GetPipeName(char *name, DWORD id, const char *suffix) { - int chars = _snprintf(name, PATH_MAX, PIPE_NAME_FORMAT_STR, id, suffix); + UINT64 uniqueTimeValue; + BOOL ret = GetUniqueTimeValueForProcess(id, &uniqueTimeValue); + + // If GetUniqueTimeValueForProcess failed for some reason, it shouldn't have + // modified uniqueTimeValue. We expect that anyone else making the pipe name + // will also fail and thus will also try to use 0 as the time value. + _ASSERTE(ret == TRUE || uniqueTimeValue == 0); + + int chars = _snprintf(name, PATH_MAX, PIPE_NAME_FORMAT_STR, uniqueTimeValue, id, suffix); _ASSERTE(chars > 0 && chars < PATH_MAX); } |