diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2017-11-20 23:37:50 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2017-11-20 23:37:50 +0100 |
commit | 7dc35e937d6b3cf57e6184dfc3d54633e5b69082 (patch) | |
tree | 486c58a6c57a33611ee526fb1acfd63e2991d5fa /src/env.cc | |
parent | 65439b4c17e14890a67f3db832fde6cfd15ac59c (diff) | |
download | android-node-v8-7dc35e937d6b3cf57e6184dfc3d54633e5b69082.tar.gz android-node-v8-7dc35e937d6b3cf57e6184dfc3d54633e5b69082.tar.bz2 android-node-v8-7dc35e937d6b3cf57e6184dfc3d54633e5b69082.zip |
src: abstract getpid() operation
There are a few places where we paper over the fact that getpid() is
called GetCurrentProcessId() on Windows. Let's move it into a function.
PR-URL: https://github.com/nodejs/node/pull/17087
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'src/env.cc')
-rw-r--r-- | src/env.cc | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/env.cc b/src/env.cc index d4ca34aa74..425333ed7a 100644 --- a/src/env.cc +++ b/src/env.cc @@ -4,12 +4,6 @@ #include "node_buffer.h" #include "node_platform.h" -#if defined(_MSC_VER) -#define getpid GetCurrentProcessId -#else -#include <unistd.h> -#endif - #include <stdio.h> #include <algorithm> @@ -184,7 +178,8 @@ void Environment::PrintSyncTrace() const { Local<v8::StackTrace> stack = StackTrace::CurrentStackTrace(isolate(), 10, StackTrace::kDetailed); - fprintf(stderr, "(node:%d) WARNING: Detected use of sync API\n", getpid()); + fprintf(stderr, "(node:%u) WARNING: Detected use of sync API\n", + GetProcessId()); for (int i = 0; i < stack->GetFrameCount() - 1; i++) { Local<StackFrame> stack_frame = stack->GetFrame(i); |