File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1126,6 +1126,19 @@ impl fmt::Debug for File {
11261126 Some ( PathBuf :: from ( OsString :: from_vec ( buf) ) )
11271127 }
11281128
1129+ #[ cfg( target_os = "freebsd" ) ]
1130+ fn get_path ( fd : c_int ) -> Option < PathBuf > {
1131+ let info = Box :: < libc:: kinfo_file > :: new_zeroed ( ) ;
1132+ let mut info = unsafe { info. assume_init ( ) } ;
1133+ info. kf_structsize = mem:: size_of :: < libc:: kinfo_file > ( ) as libc:: c_int ;
1134+ let n = unsafe { libc:: fcntl ( fd, libc:: F_KINFO , & mut * info) } ;
1135+ if n == -1 {
1136+ return None ;
1137+ }
1138+ let buf = unsafe { CStr :: from_ptr ( info. kf_path . as_mut_ptr ( ) ) . to_bytes ( ) . to_vec ( ) } ;
1139+ Some ( PathBuf :: from ( OsString :: from_vec ( buf) ) )
1140+ }
1141+
11291142 #[ cfg( target_os = "vxworks" ) ]
11301143 fn get_path ( fd : c_int ) -> Option < PathBuf > {
11311144 let mut buf = vec ! [ 0 ; libc:: PATH_MAX as usize ] ;
@@ -1142,6 +1155,7 @@ impl fmt::Debug for File {
11421155 target_os = "linux" ,
11431156 target_os = "macos" ,
11441157 target_os = "vxworks" ,
1158+ target_os = "freebsd" ,
11451159 target_os = "netbsd"
11461160 ) ) ) ]
11471161 fn get_path ( _fd : c_int ) -> Option < PathBuf > {
You can’t perform that action at this time.
0 commit comments