@@ -277,6 +277,9 @@ struct StatResult {
277
277
st_mode : u32 ,
278
278
st_ino : u64 ,
279
279
st_dev : u64 ,
280
+ st_nlink : u64 ,
281
+ st_uid : u32 ,
282
+ st_gid : u32 ,
280
283
}
281
284
282
285
impl PyValue for StatResult {
@@ -299,6 +302,18 @@ impl StatResultRef {
299
302
fn st_dev ( self , _vm : & VirtualMachine ) -> u64 {
300
303
self . st_dev
301
304
}
305
+
306
+ fn st_nlink ( self , _vm : & VirtualMachine ) -> u64 {
307
+ self . st_nlink
308
+ }
309
+
310
+ fn st_uid ( self , _vm : & VirtualMachine ) -> u32 {
311
+ self . st_uid
312
+ }
313
+
314
+ fn st_gid ( self , _vm : & VirtualMachine ) -> u32 {
315
+ self . st_gid
316
+ }
302
317
}
303
318
304
319
#[ cfg( unix) ]
@@ -309,6 +324,9 @@ fn os_stat(path: PyStringRef, vm: &VirtualMachine) -> PyResult {
309
324
st_mode : meta. st_mode ( ) ,
310
325
st_ino : meta. st_ino ( ) ,
311
326
st_dev : meta. st_dev ( ) ,
327
+ st_nlink : meta. st_nlink ( ) ,
328
+ st_uid : meta. st_uid ( ) ,
329
+ st_gid : meta. st_gid ( ) ,
312
330
}
313
331
. into_ref ( vm)
314
332
. into_object ( ) ) ,
@@ -322,8 +340,11 @@ fn os_stat(path: PyStringRef, vm: &VirtualMachine) -> PyResult {
322
340
match fs:: metadata ( & path. value ) {
323
341
Ok ( meta) => Ok ( StatResult {
324
342
st_mode : meta. file_attributes ( ) ,
325
- st_ino : 0 , // TODO: Not implemented in std::os::windows::fs::MetadataExt.
326
- st_dev : 0 , // TODO: Not implemented in std::os::windows::fs::MetadataExt.
343
+ st_ino : 0 , // TODO: Not implemented in std::os::windows::fs::MetadataExt.
344
+ st_dev : 0 , // TODO: Not implemented in std::os::windows::fs::MetadataExt.
345
+ st_nlink : 0 , // TODO: Not implemented in std::os::windows::fs::MetadataExt.
346
+ st_uid : 0 , // 0 on windows
347
+ st_gid : 0 , // 0 on windows
327
348
}
328
349
. into_ref ( vm)
329
350
. into_object ( ) ) ,
@@ -363,6 +384,9 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
363
384
"st_mode" => ctx. new_property( StatResultRef :: st_mode) ,
364
385
"st_ino" => ctx. new_property( StatResultRef :: st_ino) ,
365
386
"st_dev" => ctx. new_property( StatResultRef :: st_dev) ,
387
+ "st_nlink" => ctx. new_property( StatResultRef :: st_nlink) ,
388
+ "st_uid" => ctx. new_property( StatResultRef :: st_uid) ,
389
+ "st_gid" => ctx. new_property( StatResultRef :: st_gid) ,
366
390
} ) ;
367
391
368
392
py_module ! ( vm, "_os" , {
0 commit comments