(path: &CStr)
| 544 | |
| 545 | #[inline] |
| 546 | pub(crate) fn stat(path: &CStr) -> io::Result<Stat> { |
| 547 | // See the comments in `fstat` about using `crate::fs::statx` here. |
| 548 | #[cfg(any( |
| 549 | target_pointer_width = "32", |
| 550 | target_arch = "mips64", |
| 551 | target_arch = "mips64r6" |
| 552 | ))] |
| 553 | { |
| 554 | match crate::fs::statx( |
| 555 | crate::fs::CWD, |
| 556 | path, |
| 557 | AtFlags::empty(), |
| 558 | StatxFlags::BASIC_STATS, |
| 559 | ) { |
| 560 | Ok(x) => statx_to_stat(x), |
| 561 | Err(io::Errno::NOSYS) => stat_old(path), |
| 562 | Err(err) => Err(err), |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | #[cfg(all( |
| 567 | target_pointer_width = "64", |
| 568 | not(target_arch = "mips64"), |
| 569 | not(target_arch = "mips64r6"), |
| 570 | ))] |
| 571 | unsafe { |
| 572 | let mut result = MaybeUninit::<Stat>::uninit(); |
| 573 | ret(syscall!( |
| 574 | __NR_newfstatat, |
| 575 | raw_fd(AT_FDCWD), |
| 576 | path, |
| 577 | &mut result, |
| 578 | c_uint(0) |
| 579 | ))?; |
| 580 | Ok(result.assume_init()) |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | #[cfg(any( |
| 585 | target_pointer_width = "32", |
no test coverage detected