Uh oh!
There was an error while loading. Please reload this page.
Add current_pid function - #45059
Conversation
rust-highfive
commented
Oct 6, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @BurntSushi (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
| /// Basic usage: | ||
| /// | ||
| /// ```no_run | ||
| /// use std::process:current_pid; |
There was a problem hiding this comment.
Missing a colon in process::current_pid.
| } | ||
| pub fn getpid() -> u32 { | ||
| syscall::getpid().unwrap() as u32 |
There was a problem hiding this comment.
pid_t is a usize on redox, so this may lose bits.
There was a problem hiding this comment.
Does Redox really allow PIDs greater than 4 billion-ish though?
There was a problem hiding this comment.
If it does, we'll need to reconsider the current Child::id method.
There was a problem hiding this comment.
I made it a u32 to be consistent with Child::id.
| } | ||
| pub fn getpid() -> u32 { | ||
| unsafe { libc::getpid() as u32 } |
There was a problem hiding this comment.
pid_t is technically signed by standard, defined as i32 on all of libc's unix platforms.
There was a problem hiding this comment.
Yes, but getpid() is guaranteed to return a non-negative number, and so u32 is valid here. The signed-ness represents process groups, not IDs.
| /// | ||
| /// | ||
| #[unstable(feature = "getpid", issue = "44971", reason = "recently added")] | ||
| pub fn current_pid() -> u32 { |
There was a problem hiding this comment.
I think i64 or u64 would be more prudent.
There was a problem hiding this comment.
We already use u32 elsewhere: https://doc.rust-lang.org/std/process/struct.Child.html#method.id
There was a problem hiding this comment.
Yep, that's why I chose u32. Although I think usize or u64 would probably make more sense for both.
sfackler
commented
Oct 7, 2017
I think I might lean towards |
sfackler
commented
Oct 7, 2017
@rfcbot fcp merge |
Team member @sfackler has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
alexcrichton
commented
Oct 8, 2017
Looks good to me! I might throw out the names |
carols10cents
commented
Oct 16, 2017
ping @BurntSushi and @aturon for your ticky boxes here! |
kennytm
commented
Oct 25, 2017
Ping @BurntSushi, @aturon again — ticky boxes~ |
aturon
commented
Oct 25, 2017
Checking off for @BurntSushi as well -- because this is an unstable function, full FCP isn't really needed. |
rfcbot
commented
Oct 25, 2017
🔔 This is now entering its final comment period, as per the review above. 🔔 |
alexcrichton
commented
Oct 25, 2017
@bors: r+ |
bors
commented
Oct 25, 2017
📌 Commit 29b319b has been approved by |
Add current_pid function Fixesrust-lang#44971
bors
commented
Oct 26, 2017
☔ The latest upstream changes (presumably #45532) made this pull request unmergeable. Please resolve the merge conflicts. |
Fixes#44971