diff options
author | cjihrig <cjihrig@gmail.com> | 2017-12-01 09:57:07 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2017-12-04 10:34:28 -0500 |
commit | a803bcaab8420d3c4d29dbc3d0c3b641ceafdfc7 (patch) | |
tree | f15f5396d1fb8dd48b268b6683011ddb3df58777 /src/util.cc | |
parent | f29992206807ca3c483301a88688f456cbcd3bf6 (diff) | |
download | android-node-v8-a803bcaab8420d3c4d29dbc3d0c3b641ceafdfc7.tar.gz android-node-v8-a803bcaab8420d3c4d29dbc3d0c3b641ceafdfc7.tar.bz2 android-node-v8-a803bcaab8420d3c4d29dbc3d0c3b641ceafdfc7.zip |
src: use uv_os_getpid() to get process id
This commit uses the new uv_os_getpid() method to retrieve the
current process id.
PR-URL: https://github.com/nodejs/node/pull/17415
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Khaidi Chu <i@2333.moe>
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/util.cc b/src/util.cc index 2aa9fb026e..77824acb03 100644 --- a/src/util.cc +++ b/src/util.cc @@ -22,16 +22,9 @@ #include "string_bytes.h" #include "node_buffer.h" #include "node_internals.h" +#include "uv.h" #include <stdio.h> -#ifdef __POSIX__ -#include <unistd.h> // getpid() -#endif - -#ifdef _MSC_VER -#include <windows.h> // GetCurrentProcessId() -#endif - namespace node { using v8::Isolate; @@ -122,15 +115,7 @@ std::string GetHumanReadableProcessName() { void GetHumanReadableProcessName(char (*name)[1024]) { char title[1024] = "Node.js"; uv_get_process_title(title, sizeof(title)); - snprintf(*name, sizeof(*name), "%s[%u]", title, GetProcessId()); -} - -uint32_t GetProcessId() { -#ifdef _WIN32 - return GetCurrentProcessId(); -#else - return getpid(); -#endif + snprintf(*name, sizeof(*name), "%s[%u]", title, uv_os_getpid()); } } // namespace node |