Several fixes for DragonFly (rebase)
This commit is contained in:
parent
0efafac398
commit
25c1bfe175
7 changed files with 46 additions and 26 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue