about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-12-25 05:11:36 +0000
committerbors <bors@rust-lang.org>2014-12-25 05:11:36 +0000
commitead198c5133fd649d1e385cfc46f344a2baaef8b (patch)
tree2878f9c5e35ed8b43f9c312f863cdb4873c1c97f /src/libstd/sys
parent65248c5e05493d2f90acf2944ea657a03bce380a (diff)
parent4c3a8f17cc4bb4b68a910e028b50463d73429add (diff)
downloadrust-ead198c5133fd649d1e385cfc46f344a2baaef8b.tar.gz
rust-ead198c5133fd649d1e385cfc46f344a2baaef8b.zip
auto merge of #20024 : mneumann/rust/dragonfly-fixes3, r=alexcrichton
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/unix/os.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index 316d97064ee..cafe52f8403 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -172,7 +172,7 @@ pub fn join_paths<T: BytesContainer>(paths: &[T]) -> Result<Vec<u8>, &'static st
     Ok(joined)
 }
 
-#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
+#[cfg(target_os = "freebsd")]
 pub fn load_self() -> Option<Vec<u8>> {
     unsafe {
         use libc::funcs::bsd44::*;
@@ -198,6 +198,16 @@ pub fn load_self() -> Option<Vec<u8>> {
     }
 }
 
+#[cfg(target_os = "dragonfly")]
+pub fn load_self() -> Option<Vec<u8>> {
+    use std::io;
+
+    match io::fs::readlink(&Path::new("/proc/curproc/file")) {
+        Ok(path) => Some(path.into_vec()),
+        Err(..) => None
+    }
+}
+
 #[cfg(any(target_os = "linux", target_os = "android"))]
 pub fn load_self() -> Option<Vec<u8>> {
     use std::io;