From 25c1bfe175fbdeb3ba67d9365a554602937c25a7 Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Fri, 19 Dec 2014 13:05:06 +0100 Subject: Several fixes for DragonFly (rebase) --- src/libstd/sys/unix/os.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/libstd/sys') 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(paths: &[T]) -> Result, &'static st Ok(joined) } -#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] +#[cfg(target_os = "freebsd")] pub fn load_self() -> Option> { unsafe { use libc::funcs::bsd44::*; @@ -198,6 +198,16 @@ pub fn load_self() -> Option> { } } +#[cfg(target_os = "dragonfly")] +fn load_self() -> Option> { + 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> { use std::io; -- cgit 1.4.1-3-g733a5 From 4c3a8f17cc4bb4b68a910e028b50463d73429add Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Fri, 19 Dec 2014 22:19:37 +0100 Subject: load_self() needs to be public --- src/libstd/sys/unix/os.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 4c1ec4cc858..f1663df6a9b 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -199,7 +199,7 @@ pub fn load_self() -> Option> { } #[cfg(target_os = "dragonfly")] -fn load_self() -> Option> { +pub fn load_self() -> Option> { use std::io; match io::fs::readlink(&Path::new("/proc/curproc/file")) { -- cgit 1.4.1-3-g733a5