FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: use uv_os_getpid() to get process id by cjihrig · Pull Request #17415 · nodejs/node · GitHub

/ node Public

src: use uv_os_getpid() to get process id - #17415

Merged
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:getpid
Dec 4, 2017
Merged

src: use uv_os_getpid() to get process id#17415
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:getpid

Conversation

cjihrig commented Dec 1, 2017

Copy link
Copy Markdown
Contributor

This commit uses the new uv_os_getpid() method to retrieve the
current process id.

I currently left GetProcessId() in util.cc. Not sure if it should be removed or not.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

src

nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Dec 1, 2017

bnoordhuis commented Dec 1, 2017
edited
Loading

Copy link
Copy Markdown
Member

I'd just remove GetProcessId(), it serves no purpose now.

(edit: I guess it ensures that you're always dealing with a uint32_t, which is useful in format strings.)

cjihrig commented Dec 1, 2017

Copy link
Copy Markdown
Contributor Author

I just pushed an updated commit that removes it, and just saw your edit. Should I put it back?

bnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No, I think it's fine. It's 32 bits on all our platforms so it probably makes no practical difference.

Copy link
Copy Markdown
Member

We should be consistent -- either it stays and the rest of the code base uses it or it is removed and the code base directly calls uv_os_getpid().

Copy link
Copy Markdown
Contributor

Can uv_os_getpid() fail? If not it doesn't matter but if it can I guess we could fall back to that stuff?

cjihrig commented Dec 1, 2017

Copy link
Copy Markdown
Contributor Author

It cannot.

Copy link
Copy Markdown
Member

getpid() can fail on Linux in a seccomp2 sandbox. The sandbox can reject the system call with an ENOSYS error, for example.

But that's probably an academical concern, and arguably a bug in the sandbox, not the application.

cjihrig commented Dec 2, 2017

Copy link
Copy Markdown
Contributor Author

TIL. We also wouldn't use the old code as a fallback since uv_os_getpid() is built using it 😄

This commit uses the new uv_os_getpid() method to retrieve the
current process id.

PR-URL: nodejs#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>

cjihrig commented Dec 4, 2017

Copy link
Copy Markdown
Contributor Author

cjihrig merged commit a803bca into nodejs:master Dec 4, 2017
cjihrig deleted the getpid branch December 4, 2017 15:38
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
This commit uses the new uv_os_getpid() method to retrieve the
current process id.

PR-URL: #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>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
This commit uses the new uv_os_getpid() method to retrieve the
current process id.

PR-URL: #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>
MylesBorins mentioned this pull request Dec 12, 2017

gibfahn commented Dec 20, 2017

Copy link
Copy Markdown
Member

Should be good to land in the next 6.x and 8.x releases.

Copy link
Copy Markdown
Member

@gibfahn FYI this PR depends on libuv 1.18.0.

Copy link
Copy Markdown
Contributor

@richardlau I think we'll be updating libuv in the next version (as long as it doesn't change gcc requirements)

gibfahn pushed a commit that referenced this pull request Feb 19, 2018
This commit uses the new uv_os_getpid() method to retrieve the
current process id.

PR-URL: #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>

Copy link
Copy Markdown
Contributor

6.x is currently running on libuv 1.16.1, so I'm setting this to don't-land

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.


Back | FazBrowse Home | New Git URL