about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorMichael Neumann <mneumann@ntecs.de>2014-12-19 13:05:06 +0100
committerMichael Neumann <mneumann@ntecs.de>2014-12-19 13:05:06 +0100
commit25c1bfe175fbdeb3ba67d9365a554602937c25a7 (patch)
tree0a419d3166d0091a5c8da38b98349c58d1f8b08d /src/libstd/sys
parent0efafac398ff7f28c5f0fe756c15b9008b3e0534 (diff)
downloadrust-25c1bfe175fbdeb3ba67d9365a554602937c25a7.tar.gz
rust-25c1bfe175fbdeb3ba67d9365a554602937c25a7.zip
Several fixes for DragonFly (rebase)
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 0ed079df55b..4c1ec4cc858 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")]
+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;