about summary refs log tree commit diff
path: root/src/libstd/process.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-10-25 22:21:44 +0000
committerbors <bors@rust-lang.org>2017-10-25 22:21:44 +0000
commite847f30f571e617990f7193665ab10127100e9df (patch)
treea2a8f24bd05e4c97879826ee4454cdb3bfc92461 /src/libstd/process.rs
parentf9d24165948a926263444bfe763f9861cb683246 (diff)
parent851d1c736571b38e68001023167199225377e3b9 (diff)
downloadrust-e847f30f571e617990f7193665ab10127100e9df.tar.gz
rust-e847f30f571e617990f7193665ab10127100e9df.zip
Auto merge of #45532 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

- Successful merges: #45059, #45212, #45398, #45483, #45496, #45508, #45526
- Failed merges:
Diffstat (limited to 'src/libstd/process.rs')
-rw-r--r--src/libstd/process.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 7c107177c64..c19ece6a314 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -1310,6 +1310,25 @@ pub fn abort() -> ! {
     unsafe { ::sys::abort_internal() };
 }
 
+/// Returns the OS-assigned process identifier associated with this process.
+///
+/// # Examples
+///
+/// Basic usage:
+///
+/// ```no_run
+/// #![feature(getpid)]
+/// use std::process;
+///
+/// println!("My pid is {}", process::id());
+/// ```
+///
+///
+#[unstable(feature = "getpid", issue = "44971", reason = "recently added")]
+pub fn id() -> u32 {
+    ::sys::os::getpid()
+}
+
 #[cfg(all(test, not(target_os = "emscripten")))]
 mod tests {
     use io::prelude::*;