diff options
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc index ef93d16968..0fb897bc8e 100644 --- a/src/util.cc +++ b/src/util.cc @@ -24,6 +24,14 @@ #include "node_internals.h" #include <stdio.h> +#ifdef __POSIX__ +#include <unistd.h> // getpid() +#endif + +#ifdef _MSC_VER +#include <windows.h> // GetCurrentProcessId() +#endif + namespace node { using v8::Isolate; @@ -105,4 +113,12 @@ void LowMemoryNotification() { } } +uint32_t GetProcessId() { +#ifdef _WIN32 + return GetCurrentProcessId(); +#else + return getpid(); +#endif +} + } // namespace node |