diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/system/getpid.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/system/getpid.cpp')
-rw-r--r-- | util/system/getpid.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/util/system/getpid.cpp b/util/system/getpid.cpp new file mode 100644 index 0000000000..b9615f0dfa --- /dev/null +++ b/util/system/getpid.cpp @@ -0,0 +1,23 @@ +#include "getpid.h" + +#ifdef _win_ + // The include file should be Windows.h for Windows <=7, Processthreadsapi.h for Windows >=8 and Server 2012, + // see http://msdn.microsoft.com/en-us/library/windows/desktop/ms683180%28v=vs.85%29.aspx + // The way to determine windows version is described in http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx + // with additions about Windows Server 2012 in https://social.msdn.microsoft.com/forums/vstudio/en-US/8d76d1d7-d078-4c55-963b-77e060845d0c/what-is-ntddiversion-value-for-ws-2012 + #include <Windows.h> + #if defined(NTDDI_WIN8) && (NTDDI_VERSION >= NTDDI_WIN8) + #include <processthreadsapi.h> + #endif +#else + #include <sys/types.h> + #include <unistd.h> +#endif + +TProcessId GetPID() { +#ifdef _win_ + return GetCurrentProcessId(); +#else + return getpid(); +#endif +} |