File tree 1 file changed +14
-0
lines changed
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 {
1126
1126
Some ( PathBuf :: from ( OsString :: from_vec ( buf) ) )
1127
1127
}
1128
1128
1129
+ #[ cfg( all( target_os = "freebsd" , target_arch = "x86_64" ) ) ]
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
+
1129
1142
#[ cfg( target_os = "vxworks" ) ]
1130
1143
fn get_path ( fd : c_int ) -> Option < PathBuf > {
1131
1144
let mut buf = vec ! [ 0 ; libc:: PATH_MAX as usize ] ;
@@ -1142,6 +1155,7 @@ impl fmt::Debug for File {
1142
1155
target_os = "linux" ,
1143
1156
target_os = "macos" ,
1144
1157
target_os = "vxworks" ,
1158
+ all( target_os = "freebsd" , target_arch = "x86_64" ) ,
1145
1159
target_os = "netbsd"
1146
1160
) ) ) ]
1147
1161
fn get_path ( _fd : c_int ) -> Option < PathBuf > {
You can’t perform that action at this time.
0 commit comments