about summary refs log tree commit diff
path: root/src/libstd/sys
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/sys
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/sys')
-rw-r--r--src/libstd/sys/redox/os.rs4
-rw-r--r--src/libstd/sys/unix/os.rs4
-rw-r--r--src/libstd/sys/windows/os.rs4
3 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs
index efddd5f0294..c27e2ee172c 100644
--- a/src/libstd/sys/redox/os.rs
+++ b/src/libstd/sys/redox/os.rs
@@ -209,3 +209,7 @@ pub fn exit(code: i32) -> ! {
     let _ = syscall::exit(code as usize);
     unreachable!();
 }
+
+pub fn getpid() -> u32 {
+    syscall::getpid().unwrap() as u32
+}
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index d8c30534eed..40b73f1b307 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -511,3 +511,7 @@ pub fn home_dir() -> Option<PathBuf> {
 pub fn exit(code: i32) -> ! {
     unsafe { libc::exit(code as c_int) }
 }
+
+pub fn getpid() -> u32 {
+    unsafe { libc::getpid() as u32 }
+}
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index a51b458451e..b9448243559 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -318,6 +318,10 @@ pub fn exit(code: i32) -> ! {
     unsafe { c::ExitProcess(code as c::UINT) }
 }
 
+pub fn getpid() -> u32 {
+    unsafe { c::GetCurrentProcessId() as u32 }
+}
+
 #[cfg(test)]
 mod tests {
     use io::Error;