From 85fc57dea2d3768e7e4855cdd04a61fd2702a232 Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Thu, 20 Jul 2017 14:58:23 -0700 Subject: [PATCH] getpid --- src/connection.h | 3 +++ src/connection_unix.cpp | 8 ++++++++ src/connection_win.cpp | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/src/connection.h b/src/connection.h index 2e2da2d..6a548ce 100644 --- a/src/connection.h +++ b/src/connection.h @@ -5,6 +5,9 @@ #include #include +// not really connectiony, but need per-platform +int GetProcessId(); + struct BaseConnection { static BaseConnection* Create(); static void Destroy(BaseConnection*&); diff --git a/src/connection_unix.cpp b/src/connection_unix.cpp index fbf5a23..50e5199 100644 --- a/src/connection_unix.cpp +++ b/src/connection_unix.cpp @@ -1,5 +1,13 @@ #include "connection.h" +#include +#include + +int GetProcessId() +{ + return ::getpid(); +} + const int RpcVersion = 1; const int NumFrames = 4; diff --git a/src/connection_win.cpp b/src/connection_win.cpp index 1a5a445..9497170 100644 --- a/src/connection_win.cpp +++ b/src/connection_win.cpp @@ -6,6 +6,11 @@ #define NOIME #include +int GetProcessId() +{ + return ::GetCurrentProcessId(); +} + struct BaseConnectionWin : public BaseConnection { HANDLE pipe{INVALID_HANDLE_VALUE}; };